SemiDrive SSDK Appication Program Interface PTG3.0
sdrv_crypto_rsapadding.h
Go to the documentation of this file.
1
9#ifndef CRYPTO_RSAPADDING_H
10#define CRYPTO_RSAPADDING_H
11
16#include <armv7-r/cache.h>
17
21typedef enum {
22 /* RSA Optimal Asymmetric Encryption Padding */
24 /* RSA encryption/decryption with PKCS#1 v1.5 padding */
26 /* RSA Probabilistic Signature */
28 /* RSA signature with PKCS#1 v1.5 */
30 /* No padding */
33
34/* Size of MD5 data block in bytes */
35#define MD5_BLOCKSIZE 64
36/* Size of MD5 initialization value in bytes */
37#define MD5_INITSIZE 16
38/* Size of MD5 digest in bytes */
39#define MD5_DIGESTSIZE 16
40/* Size of SHA1 data block in bytes */
41#define SHA1_BLOCKSIZE 64
42/* Size of SHA1 initialization value in bytes */
43#define SHA1_INITSIZE 20
44/* Size of SHA1 digest in bytes */
45#define SHA1_DIGESTSIZE 20
46/* Size of SHA224 data block in bytes */
47#define SHA224_BLOCKSIZE 64
48/* Size of SHA224 initialization value in bytes */
49#define SHA224_INITSIZE 32
50/* Size of SHA224 digest in bytes */
51#define SHA224_DIGESTSIZE 28
52/* Size of SHA256 data block in bytes */
53#define SHA256_BLOCKSIZE 64
54/* Size of SHA256 initialization value in bytes */
55#define SHA256_INITSIZE 32
56/* Size of SHA256 digest in bytes */
57#define SHA256_DIGESTSIZE 32
58/* Size of SHA384 data block in bytes */
59#define SHA384_BLOCKSIZE 128
60/* Size of SHA384 initialization value in bytes */
61#define SHA384_INITSIZE 64
62/* Size of SHA384 digest in bytes */
63#define SHA384_DIGESTSIZE 48
64/* Size of SHA512 data block in bytes */
65#define SHA512_BLOCKSIZE 128
66/* Size of SHA512 initialization value in bytes */
67#define SHA512_INITSIZE 64
68/* Size of SHA512 digest in bytes */
69#define SHA512_DIGESTSIZE 64
70/* Size of SHA512 data block in bytes */
71#define SM3_BLOCKSIZE 64
72/* Size of SHA512 initialization value in bytes */
73#define SM3_INITSIZE 32
74/* Size of SHA512 digest in bytes */
75#define SM3_DIGESTSIZE 32
76/* Maximum block size to be supported */
77#define MAX_BLOCKSIZE SHA512_BLOCKSIZE
78/* Maximum digest size to be supported */
79#define MAX_DIGESTSIZE SHA512_DIGESTSIZE
80
81#define RSA_MAX_SIZE (4096/8)
82
83#define MAC_BUFF_MAX_SIZE (4096/8)
84
85#define SEIP_CACHE_ALIGN_32BYTE_ADDR_MASK (0x1F)
86
98 uint32_t hash_alg,
99 uint8_t *EM,
100 uint8_t *message,
101 uint32_t mLen);
102
114 uint32_t hash_alg,
115 uint8_t *EM,
116 uint8_t **message,
117 uint32_t *mLen);
118
129 uint8_t *EM,
130 uint8_t *message,
131 uint32_t mLen);
132
143 uint8_t *EM,
144 uint8_t **message,
145 uint32_t *mLen);
146
158 uint32_t hash_type,
159 uint8_t *EM,
160 uint8_t *hash);
177 uint32_t hash_alg,
178 uint8_t *EM,
179 uint8_t *hash,
180 uint32_t n0,
181 uint32_t sLen);
195 uint32_t hash_alg,
196 uint8_t *EM,
197 uint8_t *hash,
198 uint32_t sLen,
199 uint32_t n0);
209void rsa_pad_zeros(uint8_t *EM,
210 uint32_t emLen,
211 uint8_t *hash,
212 uint32_t hashLen);
213
214#endif /* SDRV_CRYPTO_RSAPADDING_H */
uint32_t hash(HASH_ALG hash_alg, uint8_t *msg, uint32_t msg_bytes, uint8_t *digest)
SemiDrive CRYPTO mailbox common api header file.
SemiDrive CRYPTO hash interface header file.
crypto mailbox trng cmd interface
rsa_padding_mode_e
CRYPTO mode of rsa padding.
Definition: sdrv_crypto_rsapadding.h:21
@ CRYPTO_ALGOMODE_RSAES_OAEP
Definition: sdrv_crypto_rsapadding.h:23
@ CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5
Definition: sdrv_crypto_rsapadding.h:25
@ CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5
Definition: sdrv_crypto_rsapadding.h:29
@ CRYPTO_ALGOMODE_RSASSA_PSS
Definition: sdrv_crypto_rsapadding.h:27
@ CRYPTO_ALGOMODE_RSA_NO_PAD
Definition: sdrv_crypto_rsapadding.h:31
sdrv_crypto_error_status_e rsa_pad_emsa_pss_encode(uint32_t emLen, uint32_t hash_alg, uint8_t *EM, uint8_t *hash, uint32_t n0, uint32_t sLen)
sdrv_crypto_error_status_e rsa_pad_emsa_pkcs_encode(uint32_t emLen, uint32_t hash_type, uint8_t *EM, uint8_t *hash)
sdrv_crypto_error_status_e rsa_pad_eme_pkcs_encode(uint32_t k, uint8_t *EM, uint8_t *message, uint32_t mLen)
sdrv_crypto_error_status_e rsa_pad_eme_oaep_encode(uint32_t k, uint32_t hash_alg, uint8_t *EM, uint8_t *message, uint32_t mLen)
sdrv_crypto_error_status_e rsa_pad_eme_oaep_decode(uint32_t k, uint32_t hash_alg, uint8_t *EM, uint8_t **message, uint32_t *mLen)
void rsa_pad_zeros(uint8_t *EM, uint32_t emLen, uint8_t *hash, uint32_t hashLen)
sdrv_crypto_error_status_e rsa_pad_emsa_pss_decode(uint32_t emLen, uint32_t hash_alg, uint8_t *EM, uint8_t *hash, uint32_t sLen, uint32_t n0)
sdrv_crypto_error_status_e rsa_pad_eme_pkcs_decode(uint32_t k, uint8_t *EM, uint8_t **message, uint32_t *mLen)
crypto sharemem interface
enum sdrv_crypto_error_status sdrv_crypto_error_status_e
CRYPTO error status return codes.