saml11_crypto.h
Go to the documentation of this file.
1 /**
2  * @file saml11_crypto.h
3  * @brief SAML11 hardware cryptographic 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.0
29  **/
30 
31 #ifndef _SAML11_CRYPTO_H
32 #define _SAML11_CRYPTO_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //CRYA function entry points
38 #define CRYA_SHA_ADDR 0x02001900
39 #define CRYA_AES_ENC_ADDR 0x02001904
40 #define CRYA_AES_DEC_ADDR 0x02001908
41 #define CRYA_GF_MULT128_ADDR 0x0200190C
42 
43 //C++ guard
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 //CRYA function prototypes
49 typedef void (*crya_sha_process_t)(uint32_t digest[8],
50  const uint8_t data[64], uint32_t buffer[64]);
51 
52 typedef void (*crya_aes_encrypt_t)(const uint8_t *key, uint32_t keyLen,
53  const uint8_t *src, uint8_t *dest);
54 
55 typedef void (*crya_aes_decrypt_t)(const uint8_t *key, uint32_t keyLen,
56  const uint8_t *src, uint8_t *dest);
57 
58 typedef void (*crya_gf_mult128_t)(const uint32_t *block1,
59  const uint32_t *block2, uint32_t *dest);
60 
61 //CRYA related functions
62 #define crya_sha_process ((crya_sha_process_t) (CRYA_SHA_ADDR | 1))
63 #define crya_aes_encrypt ((crya_aes_encrypt_t) (CRYA_AES_ENC_ADDR | 1))
64 #define crya_aes_decrypt ((crya_aes_decrypt_t) (CRYA_AES_DEC_ADDR | 1))
65 #define crya_gf_mult128 ((crya_gf_mult128_t) (CRYA_GF_MULT128_ADDR | 1))
66 
67 //Global variables
69 
70 //SAML11 hardware cryptographic accelerator related functions
72 
73 //C++ guard
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
General definitions for cryptographic algorithms.
error_t
Error codes.
Definition: error.h:43
uint8_t data[]
Definition: ethernet.h:222
void(* crya_aes_decrypt_t)(const uint8_t *key, uint32_t keyLen, const uint8_t *src, uint8_t *dest)
Definition: saml11_crypto.h:55
void(* crya_sha_process_t)(uint32_t digest[8], const uint8_t data[64], uint32_t buffer[64])
Definition: saml11_crypto.h:49
OsMutex saml11CryptoMutex
Definition: saml11_crypto.c:41
error_t saml11CryptoInit(void)
Initialize hardware cryptographic accelerator.
Definition: saml11_crypto.c:49
void(* crya_aes_encrypt_t)(const uint8_t *key, uint32_t keyLen, const uint8_t *src, uint8_t *dest)
Definition: saml11_crypto.h:52
void(* crya_gf_mult128_t)(const uint32_t *block1, const uint32_t *block2, uint32_t *dest)
Definition: saml11_crypto.h:58
Mutex object.