s32k1_crypto.h
Go to the documentation of this file.
1 /**
2  * @file s32k1_crypto.h
3  * @brief S32K1 hardware cryptographic accelerator (CSEq)
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 _S32K1_CRYPTO_H
32 #define _S32K1_CRYPTO_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //Commands
38 #define CSEQ_CMD_ENC_ECB 0x01000000
39 #define CSEQ_CMD_ENC_CBC 0x02000000
40 #define CSEQ_CMD_DEC_ECB 0x03000000
41 #define CSEQ_CMD_DEC_CBC 0x04000000
42 #define CSEQ_CMD_GENERATE_MAC 0x05000000
43 #define CSEQ_CMD_VERIFY_MAC 0x06000000
44 #define CSEQ_CMD_LOAD_KEY 0x07000000
45 #define CSEQ_CMD_LOAD_PLAIN_KEY 0x08000000
46 #define CSEQ_CMD_EXPORT_RAM_KEY 0x09000000
47 #define CSEQ_CMD_INIT_RNG 0x0A000000
48 #define CSEQ_CMD_EXTEND_SEED 0x0B000000
49 #define CSEQ_CMD_RND 0x0C000000
50 #define CSEQ_CMD_BOOT_FAILURE 0x0E000000
51 #define CSEQ_CMD_BOOT_OK 0x0F000000
52 #define CSEQ_CMD_GET_ID 0x10000000
53 #define CSEQ_CMD_BOOT_DEFINE 0x11000000
54 #define CSEQ_CMD_DBG_CHAL 0x12000000
55 #define CSEQ_CMD_DBG_AUTH 0x13000000
56 #define CSEQ_CMD_MP_COMPRESS 0x16000000
57 
58 //Function format
59 #define CSEQ_FORMAT_COPY 0x00000000
60 #define CSEQ_FORMAT_POINTER 0x00010000
61 
62 //Call sequence
63 #define CSEQ_CALL_SEQ_FIRST 0x00000000
64 #define CSEQ_CALL_SEQ_SUBSEQUENT 0x00000100
65 
66 //Key identifiers
67 #define CSEQ_SECRET_KEY 0x00000000
68 #define CSEQ_MASTER_ECU_KEY 0x00000001
69 #define CSEQ_BOOT_MAC_KEY 0x00000002
70 #define CSEQ_BOOT_MAC 0x00000003
71 #define CSEQ_KEY_1 0x00000004
72 #define CSEQ_KEY_2 0x00000005
73 #define CSEQ_KEY_3 0x00000006
74 #define CSEQ_KEY_4 0x00000007
75 #define CSEQ_KEY_5 0x00000008
76 #define CSEQ_KEY_6 0x00000009
77 #define CSEQ_KEY_7 0x0000000A
78 #define CSEQ_KEY_8 0x0000000B
79 #define CSEQ_KEY_9 0x0000000C
80 #define CSEQ_KEY_10 0x0000000D
81 #define CSEQ_RAM_KEY 0x0000000F
82 #define CSEQ_KEY_11 0x00000014
83 #define CSEQ_KEY_12 0x00000015
84 #define CSEQ_KEY_13 0x00000016
85 #define CSEQ_KEY_14 0x00000017
86 #define CSEQ_KEY_15 0x00000018
87 #define CSEQ_KEY_16 0x00000019
88 #define CSEQ_KEY_17 0x0000001A
89 #define CSEQ_KEY_18 0x0000001B
90 #define CSEQ_KEY_19 0x0000001C
91 #define CSEQ_KEY_20 0x0000001D
92 #define CSEQ_KEY_21 0x0000001E
93 
94 //Error codes
95 #define CSEQ_ERC_NO_ERROR 0x0001
96 #define CSEQ_ERC_SEQUENCE_ERROR 0x0002
97 #define CSEQ_ERC_KEY_NOT_AVAILABLE 0x0004
98 #define CSEQ_ERC_KEY_INVALID 0x0008
99 #define CSEQ_ERC_KEY_EMPTY 0x0010
100 #define CSEQ_ERC_NO_SECURE_BOOT 0x0020
101 #define CSEQ_ERC_KEY_WRITE_PROTECTED 0x0040
102 #define CSEQ_ERC_KEY_UPDATE_ERROR 0x0080
103 #define CSEQ_ERC_RNG_SEED 0x0100
104 #define CSEQ_ERC_NO_DEBUGGING 0x0200
105 #define CSEQ_ERC_MEMORY_FAILURE 0x0400
106 #define CSEQ_ERC_GENERAL_ERROR 0x0800
107 
108 //C++ guard
109 #ifdef __cplusplus
110 extern "C" {
111 #endif
112 
113 //Global variables
115 
116 //S32K1 hardware cryptographic accelerator related functions
118 
119 //C++ guard
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif
OsMutex s32k1CryptoMutex
Definition: s32k1_crypto.c:41
error_t
Error codes.
Definition: error.h:43
General definitions for cryptographic algorithms.
Mutex object.
error_t s32k1CryptoInit(void)
Initialize hardware cryptographic accelerator.
Definition: s32k1_crypto.c:49