apm32f4xx_crypto_cipher.h
Go to the documentation of this file.
1 /**
2  * @file apm32f4xx_crypto_cipher.h
3  * @brief APM32F4 cipher hardware accelerator
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _APM32F4XX_CRYPTO_CIPHER_H
32 #define _APM32F4XX_CRYPTO_CIPHER_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //Cipher hardware accelerator
38 #ifndef APM32F4XX_CRYPTO_CIPHER_SUPPORT
39  #define APM32F4XX_CRYPTO_CIPHER_SUPPORT DISABLED
40 #elif (APM32F4XX_CRYPTO_CIPHER_SUPPORT != ENABLED && APM32F4XX_CRYPTO_CIPHER_SUPPORT != DISABLED)
41  #error APM32F4XX_CRYPTO_CIPHER_SUPPORT parameter is not valid
42 #endif
43 
44 //CRYP Control register
45 #define CRYP_CTRL_CRYPEN 0x00008000
46 #define CRYP_CTRL_FFLUSH 0x00004000
47 #define CRYP_CTRL_KSIZESEL 0x00000300
48 #define CRYP_CTRL_KSIZESEL_128B 0x00000000
49 #define CRYP_CTRL_KSIZESEL_192B 0x00000100
50 #define CRYP_CTRL_KSIZESEL_256B 0x00000200
51 #define CRYP_CTRL_DTSEL 0x000000C0
52 #define CRYP_CTRL_DTSEL_32B 0x00000000
53 #define CRYP_CTRL_DTSEL_16B 0x00000040
54 #define CRYP_CTRL_DTSEL_8B 0x00000080
55 #define CRYP_CTRL_DTSEL_1B 0x000000C0
56 #define CRYP_CTRL_ALGOMSEL 0x00000038
57 #define CRYP_CTRL_ALGOMSEL_TDES_ECB 0x00000000
58 #define CRYP_CTRL_ALGOMSEL_TDES_CBC 0x00000008
59 #define CRYP_CTRL_ALGOMSEL_DES_ECB 0x00000010
60 #define CRYP_CTRL_ALGOMSEL_DES_CBC 0x00000018
61 #define CRYP_CTRL_ALGOMSEL_AES_ECB 0x00000020
62 #define CRYP_CTRL_ALGOMSEL_AES_CBC 0x00000028
63 #define CRYP_CTRL_ALGOMSEL_AES_CTR 0x00000030
64 #define CRYP_CTRL_ALGOMSEL_AES_KEY 0x00000038
65 #define CRYP_CTRL_ALGODIRSEL 0x00000004
66 
67 //CRYP Status register
68 #define CRYP_STS_BUSY 0x00000010
69 #define CRYP_STS_OFFULL 0x00000008
70 #define CRYP_STS_OFEMPT 0x00000004
71 #define CRYP_STS_IFFULL 0x00000002
72 #define CRYP_STS_IFEMPT 0x00000001
73 
74 //C++ guard
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
78 
79 //Cipher related functions
80 error_t crypInit(void);
81 
82 //C++ guard
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif
error_t crypInit(void)
CRYP module initialization.
error_t
Error codes.
Definition: error.h:43
General definitions for cryptographic algorithms.