libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
crypto.c
Go to the documentation of this file.
1/** @defgroup crypto_file CRYPTO
2 *
3 * @ingroup STM32F4xx
4 *
5 * @brief <b>libopencm3 STM32F4xx CRYPTO</b>
6 *
7 * @version 1.0.0
8 *
9 * @date 18 Jun 2013
10 *
11 */
12/*
13 * This file is part of the libopencm3 project.
14 *
15 * Copyright (C) 2011 Stephen Caudle <scaudle@doceme.com>
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
32
33/**@{*/
34
35/*---------------------------------------------------------------------------*/
36
37/** @brief Set the MAC algorithm
38 */
40{
42}
43
44/**
45 * @brief Swap context
46 *
47 *@param[in] buf uint32_t Memory space for swap (16 items length)
48 */
49void crypto_context_swap(uint32_t *buf)
50{
51 int i;
52 /* Apply exact order of ? */
53 for (i = 0; i < 8; i++) {
54 uint32_t save = *buf;
55 *buf++ = CRYP_CSGCMCCMR(i);
56 CRYP_CSGCMCCMR(i) = save;
57 };
58
59 for (i = 0; i < 8; i++) {
60 uint32_t save = *buf;
61 *buf++ = CRYP_CSGCMR(i);
62 CRYP_CSGCMCCMR(i) = save;
63 };
64}
65
66/**@}*/
void crypto_set_algorithm(enum crypto_mode mode)
Set the algorithm for Encryption/decryption.
crypto_mode
crypto_mode_mac
Definition: f4/crypto.h:80
#define CRYP_CSGCMR(i)
Definition: f4/crypto.h:51
#define CRYP_CSGCMCCMR(i)
Definition: f4/crypto.h:48
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