libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
f4/crypto.h
Go to the documentation of this file.
1/** @defgroup crypto_defines CRYPTO Defines
2 *
3 * @brief <b>Defined constants and Types for the STM32F4xx Crypto Coprocessor</b>
4 *
5 * @ingroup STM32F4xx_defines
6 *
7 * @version 1.0.0
8 *
9 * @date 22 Jun 2013
10 *
11 * LGPL License Terms @ref lgpl_license
12 */
13
14/*
15 * This file is part of the libopencm3 project.
16 *
17 * This library is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU Lesser General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public License
28 * along with this library. If not, see <http://www.gnu.org/licenses/>.
29 */
30
31#ifndef LIBOPENCM3_CRYPTO_H
32#define LIBOPENCM3_CRYPTO_H
33
35
36/**@{*/
37
38/* --- CRYP registers ------------------------------------------------------ */
39/** @defgroup crypto_defines_registers Registers (for F42xx or F43xx only)
40 *
41 * @brief Register access to the CRYP controller. Registers for F42xx and 43xx
42 *
43 * @ingroup crypto_defines
44 */
45/**@{*/
46
47/* CRYP_CSGCMCCMxR: Crypto context registers CCM mode, i=0-7*/
48#define CRYP_CSGCMCCMR(i) MMIO32(CRYP_BASE + 0x50 + (i) * 4)
49
50/* CRYP_CSGCMxR: Crypto context registers all modes, i=0-7*/
51#define CRYP_CSGCMR(i) MMIO32(CRYP_BASE + 0x70 + (i) * 4)
52
53/* --- CRYP_CR values ------------------------------------------------------ */
54
55/* Only for part STM32F42xx and STM32F43xx: */
56
57/* GCM_CMPH: GCM or CCM phase state */
58#define CRYP_CR_GCM_CMPH_SHIFT 16
59#define CRYP_CR_GCM_CMPH (3 << CRYP_CR_GCM_CMPH_SHIFT)
60#define CRYP_CR_GCM_CMPH_INIT (0 << CRYP_CR_GCM_CMPH_SHIFT)
61#define CRYP_CR_GCM_CMPH_HEADER (1 << CRYP_CR_GCM_CMPH_SHIFT)
62#define CRYP_CR_GCM_CMPH_PAYLOAD (2 << CRYP_CR_GCM_CMPH_SHIFT)
63#define CRYP_CR_GCM_CMPH_FINAL (3 << CRYP_CR_GCM_CMPH_SHIFT)
64
65/* ALGOMODE3: Algorithm mode, fourth bit */
66#define CRYP_CR_ALGOMODE3 (1 << 19)
67
68/**@}*/
69
70/** @defgroup crypto_api API (for F42xx or F43xx only)
71 *
72 * @brief API for the CRYP controller.
73 *
74 * @warning Only for F42xx and 43xx
75 *
76 * @ingroup crypto_defines
77 */
78/**@{*/
79
87};
88
90
91void crypto_context_swap(uint32_t *buf);
93
95/**@}*/
96/**@}*/
97#endif
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
crypto_mode_mac
Definition: f4/crypto.h:80
void crypto_context_swap(uint32_t *buf)
Swap context.
Definition: crypto.c:49
void crypto_set_mac_algorithm(enum crypto_mode_mac mode)
Set the MAC algorithm.
Definition: crypto.c:39
@ DECRYPT_GCM
Definition: f4/crypto.h:83
@ ENCRYPT_GCM
Definition: f4/crypto.h:81
@ DECRYPT_CCM
Definition: f4/crypto.h:85
@ ENCRYPT_CCM
Definition: f4/crypto.h:82
#define CRYP_CR_ALGOMODE3
Definition: f4/crypto.h:66
#define CRYP_CR_ALGODIR
#define CRYP_CR_ALGOMODE_TDES_CBC
#define CRYP_CR_ALGOMODE_TDES_ECB