Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/components/crypto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Authentication and Hashing Algorithms
- CRYPTO_SHA1_HMAC

- SHA-2 HMAC:
- CRYPTO_SHA2_224_HMAC (224-bit)
- CRYPTO_SHA2_256_HMAC (256-bit)
- CRYPTO_SHA2_384_HMAC (384-bit)
- CRYPTO_SHA2_512_HMAC (512-bit)
Expand Down
1 change: 1 addition & 0 deletions crypto/cryptodev.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ static int cryptof_ioctl(FAR struct file *filep,
case CRYPTO_MD5_HMAC:
case CRYPTO_SHA1_HMAC:
case CRYPTO_RIPEMD160_HMAC:
case CRYPTO_SHA2_224_HMAC:
case CRYPTO_SHA2_256_HMAC:
case CRYPTO_SHA2_384_HMAC:
case CRYPTO_SHA2_512_HMAC:
Expand Down
7 changes: 7 additions & 0 deletions crypto/cryptosoft.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,7 @@ int swcr_authcompute(FAR struct cryptop *crp,
case CRYPTO_MD5_HMAC:
case CRYPTO_SHA1_HMAC:
case CRYPTO_RIPEMD160_HMAC:
case CRYPTO_SHA2_224_HMAC:
case CRYPTO_SHA2_256_HMAC:
case CRYPTO_SHA2_384_HMAC:
case CRYPTO_SHA2_512_HMAC:
Expand Down Expand Up @@ -1665,6 +1666,9 @@ int swcr_newsession(FAR uint32_t *sid, FAR struct cryptoini *cri)
case CRYPTO_RIPEMD160_HMAC:
axf = &auth_hash_hmac_ripemd_160_96;
goto authcommon;
case CRYPTO_SHA2_224_HMAC:
axf = &auth_hash_hmac_sha2_224_114;
goto authcommon;
case CRYPTO_SHA2_256_HMAC:
case CRYPTO_PBKDF2_HMAC_SHA256:
axf = &auth_hash_hmac_sha2_256_128;
Expand Down Expand Up @@ -1894,6 +1898,7 @@ int swcr_freesession(uint64_t tid)
case CRYPTO_MD5_HMAC:
case CRYPTO_SHA1_HMAC:
case CRYPTO_RIPEMD160_HMAC:
case CRYPTO_SHA2_224_HMAC:
case CRYPTO_SHA2_256_HMAC:
case CRYPTO_SHA2_384_HMAC:
case CRYPTO_SHA2_512_HMAC:
Expand Down Expand Up @@ -2044,6 +2049,7 @@ int swcr_process(struct cryptop *crp)
case CRYPTO_MD5_HMAC:
case CRYPTO_SHA1_HMAC:
case CRYPTO_RIPEMD160_HMAC:
case CRYPTO_SHA2_224_HMAC:
case CRYPTO_SHA2_256_HMAC:
case CRYPTO_SHA2_384_HMAC:
case CRYPTO_SHA2_512_HMAC:
Expand Down Expand Up @@ -2409,6 +2415,7 @@ void swcr_init(void)
algs[CRYPTO_AES_GCM_16] = CRYPTO_ALG_FLAG_SUPPORTED;
algs[CRYPTO_AES_GMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
algs[CRYPTO_NULL] = CRYPTO_ALG_FLAG_SUPPORTED;
algs[CRYPTO_SHA2_224_HMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
algs[CRYPTO_SHA2_256_HMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
algs[CRYPTO_SHA2_384_HMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
algs[CRYPTO_SHA2_512_HMAC] = CRYPTO_ALG_FLAG_SUPPORTED;
Expand Down
9 changes: 9 additions & 0 deletions crypto/xform.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,15 @@ const struct auth_hash auth_hash_hmac_ripemd_160_96 =
(void (*)(FAR uint8_t *, FAR void *)) rmd160final
};

const struct auth_hash auth_hash_hmac_sha2_224_114 =
{
CRYPTO_SHA2_256_HMAC, "HMAC-SHA2-224",
HMAC_SHA2_224_BLOCK_LEN, 28, 14, sizeof(SHA2_CTX), HMAC_SHA2_224_BLOCK_LEN,
(void (*)(FAR void *)) sha224init, NULL, NULL,
sha224update_int,
(void (*)(FAR uint8_t *, FAR void *)) sha224final
};

const struct auth_hash auth_hash_hmac_sha2_256_128 =
{
CRYPTO_SHA2_256_HMAC, "HMAC-SHA2-256",
Expand Down
4 changes: 3 additions & 1 deletion include/crypto/cryptodev.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#define HMAC_MD5_BLOCK_LEN 64
#define HMAC_SHA1_BLOCK_LEN 64
#define HMAC_RIPEMD160_BLOCK_LEN 64
#define HMAC_SHA2_224_BLOCK_LEN 64
#define HMAC_SHA2_256_BLOCK_LEN 64
#define HMAC_SHA2_384_BLOCK_LEN 128
#define HMAC_SHA2_512_BLOCK_LEN 128
Expand Down Expand Up @@ -138,7 +139,8 @@
#define CRYPTO_PBKDF2_HMAC_SHA1 38
#define CRYPTO_PBKDF2_HMAC_SHA256 39
#define CRYPTO_ESN 40 /* Support for Extended Sequence Numbers */
#define CRYPTO_ALGORITHM_MAX 40 /* Keep updated */
#define CRYPTO_SHA2_224_HMAC 41
#define CRYPTO_ALGORITHM_MAX 41 /* Keep updated */

/* Algorithm flags */

Expand Down
1 change: 1 addition & 0 deletions include/crypto/xform.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ extern const struct enc_xform enc_xform_null;
extern const struct auth_hash auth_hash_hmac_md5_96;
extern const struct auth_hash auth_hash_hmac_sha1_96;
extern const struct auth_hash auth_hash_hmac_ripemd_160_96;
extern const struct auth_hash auth_hash_hmac_sha2_224_114;
extern const struct auth_hash auth_hash_hmac_sha2_256_128;
extern const struct auth_hash auth_hash_hmac_sha2_384_192;
extern const struct auth_hash auth_hash_hmac_sha2_512_256;
Expand Down
Loading