summaryrefslogtreecommitdiffstats
path: root/crypto/hmac
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2007-05-15 23:52:03 +0000
committerDr. Stephen Henson <steve@openssl.org>2007-05-15 23:52:03 +0000
commite69adea53921cac7a7a012cade24cce228a310a5 (patch)
treeb4720b439776fb071d1d1d2c8b23c5403b27e315 /crypto/hmac
parent9660cbcd6b5981f631d10dad6a55008306e5c20b (diff)
New function EVP_PKEY_asn1_copy(). Use default MD if type param is NULL.
Diffstat (limited to 'crypto/hmac')
-rw-r--r--crypto/hmac/hm_ameth.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/crypto/hmac/hm_ameth.c b/crypto/hmac/hm_ameth.c
index 204bdb2492..0b05923ba1 100644
--- a/crypto/hmac/hm_ameth.c
+++ b/crypto/hmac/hm_ameth.c
@@ -84,6 +84,19 @@ static void hmac_key_free(EVP_PKEY *pkey)
}
+static int hmac_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
+ {
+ switch (op)
+ {
+ case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
+ *(int *)arg2 = NID_sha1;
+ return 1;
+
+ default:
+ return -2;
+ }
+ }
+
#ifdef HMAC_TEST_PRIVATE_KEY_FORMAT
/* A bogus private key format for test purposes. This is simply the
* HMAC key with "HMAC PRIVATE KEY" in the headers. When enabled the
@@ -143,7 +156,7 @@ const EVP_PKEY_ASN1_METHOD hmac_asn1_meth =
0,0,0,0,0,0,
hmac_key_free,
- 0,
+ hmac_pkey_ctrl,
#ifdef HMAC_TEST_PRIVATE_KEY_FORMAT
old_hmac_decode,
old_hmac_encode