Go to the source code of this file.
|
| 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) |
| |
| 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_pkcs_decode (uint32_t k, uint8_t *EM, uint8_t **message, uint32_t *mLen) |
| |
| 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_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_pss_decode (uint32_t emLen, uint32_t hash_alg, uint8_t *EM, uint8_t *hash, uint32_t sLen, uint32_t n0) |
| |
| void | rsa_pad_zeros (uint8_t *EM, uint32_t emLen, uint8_t *hash, uint32_t hashLen) |
| |
- Copyright
- Copyright (c) 2021 Semidrive Semiconductor. All rights reserved.
◆ MAC_BUFF_MAX_SIZE
| #define MAC_BUFF_MAX_SIZE (4096/8) |
◆ MAX_BLOCKSIZE
◆ MAX_DIGESTSIZE
◆ MD5_BLOCKSIZE
◆ MD5_DIGESTSIZE
| #define MD5_DIGESTSIZE 16 |
◆ MD5_INITSIZE
◆ RSA_MAX_SIZE
| #define RSA_MAX_SIZE (4096/8) |
◆ SEIP_CACHE_ALIGN_32BYTE_ADDR_MASK
| #define SEIP_CACHE_ALIGN_32BYTE_ADDR_MASK (0x1F) |
◆ SHA1_BLOCKSIZE
| #define SHA1_BLOCKSIZE 64 |
◆ SHA1_DIGESTSIZE
| #define SHA1_DIGESTSIZE 20 |
◆ SHA1_INITSIZE
◆ SHA224_BLOCKSIZE
| #define SHA224_BLOCKSIZE 64 |
◆ SHA224_DIGESTSIZE
| #define SHA224_DIGESTSIZE 28 |
◆ SHA224_INITSIZE
| #define SHA224_INITSIZE 32 |
◆ SHA256_BLOCKSIZE
| #define SHA256_BLOCKSIZE 64 |
◆ SHA256_DIGESTSIZE
| #define SHA256_DIGESTSIZE 32 |
◆ SHA256_INITSIZE
| #define SHA256_INITSIZE 32 |
◆ SHA384_BLOCKSIZE
| #define SHA384_BLOCKSIZE 128 |
◆ SHA384_DIGESTSIZE
| #define SHA384_DIGESTSIZE 48 |
◆ SHA384_INITSIZE
| #define SHA384_INITSIZE 64 |
◆ SHA512_BLOCKSIZE
| #define SHA512_BLOCKSIZE 128 |
◆ SHA512_DIGESTSIZE
| #define SHA512_DIGESTSIZE 64 |
◆ SHA512_INITSIZE
| #define SHA512_INITSIZE 64 |
◆ SM3_BLOCKSIZE
◆ SM3_DIGESTSIZE
| #define SM3_DIGESTSIZE 32 |
◆ SM3_INITSIZE
◆ rsa_padding_mode_e
CRYPTO mode of rsa padding.
| Enumerator |
|---|
| CRYPTO_ALGOMODE_RSAES_OAEP | |
| CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5 | |
| CRYPTO_ALGOMODE_RSASSA_PSS | |
| CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 | |
| CRYPTO_ALGOMODE_RSA_NO_PAD | |
◆ rsa_pad_eme_oaep_decode()
| 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 |
|
) |
| |
Decode a message using OEAP
- Parameters
-
| k | RSA parameter length in bytes |
| hashType | the hash function to use |
| EM | Pointer to the encoded message (EM) buffer |
| message | Output: Pointer to the decoded message. The decoding is done in place within the limits of the EM buffer. |
| mLen | Output: Length of the decoded message |
- Returns
- E_OK when no error occurs
◆ rsa_pad_eme_oaep_encode()
| 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 |
|
) |
| |
Encode a message using OAEP
- Parameters
-
| k | RSA parameter length in bytes |
| hashType | The hash function to use |
| EM | Pointer to the encoded message (EM) buffer |
| message | Block containing address of the message to encode |
| mLen | Length of the message to be encoded (bytes) |
| rng | Random number generator to use |
- Returns
- E_OK when no error occurs
◆ rsa_pad_eme_pkcs_decode()
Decodes encoded message using PKCS. message will point to the decoded message in EM
- Parameters
-
| k | RSA param length in bytes |
| EM | Pointer to the encoded message (EM) buffer |
| message | Output: Pointer to the decoded message in EM. The decoding is done in place within the limits of the EM buffer. |
| mLen | Output: Length of the decoded message (bytes) |
- Returns
- E_OK when no error occurs
◆ rsa_pad_eme_pkcs_encode()
Encode message using PKCS
- Parameters
-
| k | RSA parameter length in bytes |
| EM | Pointer to the encoded message (EM) buffer |
| message | Block containing address of the message to encode |
| mLen | Len of the message to be encoded (bytes) |
| rng | random number generator to use |
- Returns
- E_OK when no error occurs
◆ rsa_pad_emsa_pkcs_encode()
Encode hash using PKCS
- Parameters
-
| emLen | Length of encoded message (EM) buffer (RSA parameter length in bytes) |
| hashype | Hash function used for hashing hash (also used for the PKCS algorithm) |
| EM | Output: Pointer to the encoded message buffer |
| hash | Input: Hash to encode |
- Returns
- E_OK if no error occurs
◆ rsa_pad_emsa_pss_decode()
| 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 |
|
) |
| |
Decode encoded message using PSS and compares hash to the decoded hash
- Parameters
-
| emLen | Length of encoded message (EM) buffer (RSA parameter length in bytes) |
| hashType | Hash function used for hasing hash |
| EM | Input: Pointer to the encoded message buffer |
| hash | Hash to compare with |
| sLen | Intended length of the salt |
| n0 | MSB of the modulus (for masking in order to match the modulus size) |
- Returns
- E_OK if no error occurs and hash is valid
◆ rsa_pad_emsa_pss_encode()
| 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 |
|
) |
| |
Encode hash using PSS. This function uses a salt length equal to the hash digest length.
- Parameters
-
| emLen | Length of encoded message (EM) buffer (RSA parameter length in bytes) |
| hashType | Hash function used for hashing hash (also used for PKCS algorithm) |
| EM | Output: Pointer to the encoded message buffer |
| hash | Input: Hash to encode |
| n0 | MSB of the modulus (for masking in order to match the modulus size) |
| sLen | Intended length of the salt |
| rng | Random number generator to use |
- Returns
- E_OK if no error occurs
◆ rsa_pad_zeros()
| void rsa_pad_zeros |
( |
uint8_t * |
EM, |
|
|
uint32_t |
emLen, |
|
|
uint8_t * |
hash, |
|
|
uint32_t |
hashLen |
|
) |
| |
Pads the hash of hashLen to EM of emLen. MSBs are set to 0.
- Warning
- There should not be overlapping between EM and hash !
- Parameters
-
| EM | Destination buffer (pointer) |
| emLen | Length of the destination buffer (bytes) |
| hash | Input to pad |
| hashLen | Length of the input |