Latest update
This commit is contained in:
@@ -17,6 +17,8 @@ void openssl_add_all_macs_int(void)
|
||||
#endif
|
||||
EVP_add_mac(&gmac_meth);
|
||||
EVP_add_mac(&hmac_meth);
|
||||
EVP_add_mac(&kmac128_meth);
|
||||
EVP_add_mac(&kmac256_meth);
|
||||
#ifndef OPENSSL_NO_SIPHASH
|
||||
EVP_add_mac(&siphash_meth);
|
||||
#endif
|
||||
|
||||
@@ -143,6 +143,8 @@ static const ERR_STRING_DATA EVP_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_VERIFYFINAL, 0), "EVP_VerifyFinal"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_GMAC_CTRL, 0), "gmac_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_INT_CTX_NEW, 0), "int_ctx_new"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_KMAC_CTRL, 0), "kmac_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_KMAC_INIT, 0), "kmac_init"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_OK_NEW, 0), "ok_new"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_PKCS5_PBE_KEYIVGEN, 0), "PKCS5_PBE_keyivgen"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_PKCS5_V2_PBE_KEYIVGEN, 0),
|
||||
@@ -215,6 +217,8 @@ static const ERR_STRING_DATA EVP_str_reasons[] = {
|
||||
"initialization error"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_INPUT_NOT_INITIALIZED),
|
||||
"input not initialized"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_INVALID_CUSTOM_LENGTH),
|
||||
"invalid custom length"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_INVALID_DIGEST), "invalid digest"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_INVALID_FIPS_MODE), "invalid fips mode"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_INVALID_KEY), "invalid key"},
|
||||
|
||||
@@ -59,6 +59,11 @@ static int shake_init(EVP_MD_CTX *evp_ctx)
|
||||
return init(evp_ctx, '\x1f');
|
||||
}
|
||||
|
||||
static int kmac_init(EVP_MD_CTX *evp_ctx)
|
||||
{
|
||||
return init(evp_ctx, '\x04');
|
||||
}
|
||||
|
||||
static int sha3_update(EVP_MD_CTX *evp_ctx, const void *_inp, size_t len)
|
||||
{
|
||||
KECCAK1600_CTX *ctx = evp_ctx->md_data;
|
||||
@@ -395,6 +400,7 @@ const EVP_MD *EVP_shake##bitlen(void) \
|
||||
}; \
|
||||
return &shake##bitlen##_md; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
EVP_MD_SHA3(224)
|
||||
@@ -404,3 +410,27 @@ EVP_MD_SHA3(512)
|
||||
|
||||
EVP_MD_SHAKE(128)
|
||||
EVP_MD_SHAKE(256)
|
||||
|
||||
|
||||
# define EVP_MD_KECCAK_KMAC(bitlen) \
|
||||
const EVP_MD *evp_keccak_kmac##bitlen(void) \
|
||||
{ \
|
||||
static const EVP_MD kmac_##bitlen##_md = { \
|
||||
-1, \
|
||||
0, \
|
||||
2 * bitlen / 8, \
|
||||
EVP_MD_FLAG_XOF, \
|
||||
kmac_init, \
|
||||
sha3_update, \
|
||||
sha3_final, \
|
||||
NULL, \
|
||||
NULL, \
|
||||
(KECCAK1600_WIDTH - bitlen * 2) / 8, \
|
||||
sizeof(KECCAK1600_CTX), \
|
||||
shake_ctrl \
|
||||
}; \
|
||||
return &kmac_##bitlen##_md; \
|
||||
}
|
||||
|
||||
EVP_MD_KECCAK_KMAC(128)
|
||||
EVP_MD_KECCAK_KMAC(256)
|
||||
Reference in New Issue
Block a user