Skip to content

Commit

Permalink
Teach EVP_PKEY_HMAC keys how to EVP_PKEY_cmp()
Browse files Browse the repository at this point in the history
Fixes #1236

Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from #1237)
  • Loading branch information
npmccallum authored and Rich Salz committed Jun 24, 2016
1 parent 5bea15e commit 3b92e51
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crypto/hmac/hm_ameth.c
Expand Up @@ -46,6 +46,11 @@ static int hmac_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
}
}

static int hmac_pkey_public_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
{
return ASN1_OCTET_STRING_cmp(EVP_PKEY_get0(a), EVP_PKEY_get0(b));
}

#ifdef HMAC_TEST_PRIVATE_KEY_FORMAT
/*
* A bogus private key format for test purposes. This is simply the HMAC key
Expand Down Expand Up @@ -101,7 +106,7 @@ const EVP_PKEY_ASN1_METHOD hmac_asn1_meth = {
"HMAC",
"OpenSSL HMAC method",

0, 0, 0, 0,
0, 0, hmac_pkey_public_cmp, 0,

0, 0, 0,

Expand Down

0 comments on commit 3b92e51

Please sign in to comment.