diff options
author | 2019-03-17 18:17:44 +0000 | |
---|---|---|
committer | 2019-03-17 18:17:44 +0000 | |
commit | 30ffc4574f4d62548fcb4f1527d68e920de17b92 (patch) | |
tree | 7de015372c158c935a5401f73c2712e8e64c56db /lib/libcrypto/evp/p_lib.c | |
parent | Provide EVP_aes_{128,192,256}_wrap(). This is a compatible (diff) | |
download | wireguard-openbsd-30ffc4574f4d62548fcb4f1527d68e920de17b92.tar.xz wireguard-openbsd-30ffc4574f4d62548fcb4f1527d68e920de17b92.zip |
Provide EVP_PKEY_get0_hmac(). From OpenSSL 1.1.1 which is still
freely licensed.
From jsing
Diffstat (limited to 'lib/libcrypto/evp/p_lib.c')
-rw-r--r-- | lib/libcrypto/evp/p_lib.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/libcrypto/evp/p_lib.c b/lib/libcrypto/evp/p_lib.c index 0e4c38e2188..13a9d65f28b 100644 --- a/lib/libcrypto/evp/p_lib.c +++ b/lib/libcrypto/evp/p_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_lib.c,v 1.24 2018/05/30 15:40:50 tb Exp $ */ +/* $OpenBSD: p_lib.c,v 1.25 2019/03/17 18:17:45 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -282,6 +282,22 @@ EVP_PKEY_get0(const EVP_PKEY *pkey) return pkey->pkey.ptr; } +const unsigned char * +EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len) +{ + ASN1_OCTET_STRING *os; + + if (pkey->type != EVP_PKEY_HMAC) { + EVPerror(EVP_R_EXPECTING_AN_HMAC_KEY); + return NULL; + } + + os = EVP_PKEY_get0(pkey); + *len = os->length; + + return os->data; +} + #ifndef OPENSSL_NO_RSA RSA * EVP_PKEY_get0_RSA(EVP_PKEY *pkey) |