pic32cm_ls_crypto.h
Go to the documentation of this file.
1 /**
2  * @file pic32cm_ls_crypto.h
3  * @brief PIC32CM LS00/LS60 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.4
29  **/
30 
31 #ifndef _PIC32CM_LS_CRYPTO_H
32 #define _PIC32CM_LS_CRYPTO_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //CRYA function entry points
38 #define CRYA_SHA_ADDR 0x02006800
39 #define CRYA_AES_ENC_ADDR 0x02006804
40 #define CRYA_AES_DEC_ADDR 0x02006808
41 #define CRYA_GF_MULT128_ADDR 0x0200680C
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 //PIC32CM LS00/LS60 hardware cryptographic accelerator related functions
72 
73 //C++ guard
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
error_t pic32cmlsCryptoInit(void)
Initialize hardware cryptographic accelerator.
void(* crya_aes_decrypt_t)(const uint8_t *key, uint32_t keyLen, const uint8_t *src, uint8_t *dest)
uint8_t data[]
Definition: ethernet.h:222
void(* crya_sha_process_t)(uint32_t digest[8], const uint8_t data[64], uint32_t buffer[64])
error_t
Error codes.
Definition: error.h:43
General definitions for cryptographic algorithms.
void(* crya_aes_encrypt_t)(const uint8_t *key, uint32_t keyLen, const uint8_t *src, uint8_t *dest)
Mutex object.
void(* crya_gf_mult128_t)(const uint32_t *block1, const uint32_t *block2, uint32_t *dest)
OsMutex pic32cmlsCryptoMutex