Commit c1da4b2a authored by Paul Yang's avatar Paul Yang
Browse files

Add poly1305 MAC support



This is based on the latest EVP MAC interface introduced in PR #7393.

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7459)
parent 748099b9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -810,6 +810,7 @@ EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN:164:PKCS5_v2_PBKDF2_keyivgen
EVP_F_PKCS5_V2_SCRYPT_KEYIVGEN:180:PKCS5_v2_scrypt_keyivgen
EVP_F_PKEY_MAC_INIT:214:pkey_mac_init
EVP_F_PKEY_SET_TYPE:158:pkey_set_type
EVP_F_POLY1305_CTRL:215:poly1305_ctrl
EVP_F_RC2_MAGIC_TO_METH:109:rc2_magic_to_meth
EVP_F_RC5_CTRL:125:rc5_ctrl
EVP_F_S390X_AES_GCM_CTRL:201:s390x_aes_gcm_ctrl
+3 −0
Original line number Diff line number Diff line
@@ -20,4 +20,7 @@ void openssl_add_all_macs_int(void)
#ifndef OPENSSL_NO_SIPHASH
    EVP_add_mac(&siphash_meth);
#endif
#ifndef OPENSSL_NO_POLY1305
    EVP_add_mac(&poly1305_meth);
#endif
}
+1 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@ static const ERR_STRING_DATA EVP_str_functs[] = {
     "PKCS5_v2_scrypt_keyivgen"},
    {ERR_PACK(ERR_LIB_EVP, EVP_F_PKEY_MAC_INIT, 0), "pkey_mac_init"},
    {ERR_PACK(ERR_LIB_EVP, EVP_F_PKEY_SET_TYPE, 0), "pkey_set_type"},
    {ERR_PACK(ERR_LIB_EVP, EVP_F_POLY1305_CTRL, 0), "poly1305_ctrl"},
    {ERR_PACK(ERR_LIB_EVP, EVP_F_RC2_MAGIC_TO_METH, 0), "rc2_magic_to_meth"},
    {ERR_PACK(ERR_LIB_EVP, EVP_F_RC5_CTRL, 0), "rc5_ctrl"},
    {ERR_PACK(ERR_LIB_EVP, EVP_F_S390X_AES_GCM_CTRL, 0), "s390x_aes_gcm_ctrl"},
+33 −0
Original line number Diff line number Diff line
@@ -425,3 +425,36 @@ const EVP_PKEY_METHOD siphash_pkey_meth = {
    pkey_mac_ctrl,
    pkey_mac_ctrl_str
};

const EVP_PKEY_METHOD poly1305_pkey_meth = {
    EVP_PKEY_POLY1305,
    EVP_PKEY_FLAG_SIGCTX_CUSTOM,
    pkey_mac_init,
    pkey_mac_copy,
    pkey_mac_cleanup,

    0, 0,

    0,
    pkey_mac_keygen,

    0, 0,

    0, 0,

    0, 0,

    pkey_mac_signctx_init,
    pkey_mac_signctx,

    0, 0,

    0, 0,

    0, 0,

    0, 0,

    pkey_mac_ctrl,
    pkey_mac_ctrl_str
};
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ extern const EVP_MAC cmac_meth;
extern const EVP_MAC gmac_meth;
extern const EVP_MAC hmac_meth;
extern const EVP_MAC siphash_meth;
extern const EVP_MAC poly1305_meth;

/*
 * This function is internal for now, but can be made external when needed.
Loading