1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00

Sync EVP_MD_meth removal with what landed upstream

discussed with djm
This commit is contained in:
tb 2024-03-29 02:31:22 +00:00
parent 4696080585
commit 7dcdad297d
2 changed files with 8 additions and 40 deletions

View File

@ -9,32 +9,17 @@
#include "fido.h"
#if OPENSSL_VERSION_NUMBER >= 0x30000000
static EVP_MD *
rs1_get_EVP_MD(void)
{
return (EVP_MD_fetch(NULL, "SHA-1", NULL));
}
#define PRAGMA(s)
static void
rs1_free_EVP_MD(EVP_MD *md)
{
EVP_MD_free(md);
}
#else
static EVP_MD *
rs1_get_EVP_MD(void)
{
PRAGMA("GCC diagnostic push");
PRAGMA("GCC diagnostic ignored \"-Wcast-qual\"");
return ((EVP_MD *)EVP_sha1());
PRAGMA("GCC diagnostic pop");
}
static void
rs1_free_EVP_MD(EVP_MD *md)
{
(void)md;
}
#endif /* OPENSSL_VERSION_NUMBER */
int
rs1_verify_sig(const fido_blob_t *dgst, EVP_PKEY *pkey,
const fido_blob_t *sig)
@ -70,7 +55,6 @@ rs1_verify_sig(const fido_blob_t *dgst, EVP_PKEY *pkey,
ok = 0;
fail:
EVP_PKEY_CTX_free(pctx);
rs1_free_EVP_MD(md);
return (ok);
}

View File

@ -17,32 +17,17 @@
#define get0_RSA(x) EVP_PKEY_get0((x))
#endif
#if OPENSSL_VERSION_NUMBER >= 0x30000000
static EVP_MD *
rs256_get_EVP_MD(void)
{
return (EVP_MD_fetch(NULL, "SHA2-256", NULL));
}
#define PRAGMA(s)
static void
rs256_free_EVP_MD(EVP_MD *md)
{
EVP_MD_free(md);
}
#else
static EVP_MD *
rs256_get_EVP_MD(void)
{
PRAGMA("GCC diagnostic push");
PRAGMA("GCC diagnostic ignored \"-Wcast-qual\"");
return ((EVP_MD *)EVP_sha256());
PRAGMA("GCC diagnostic pop");
}
static void
rs256_free_EVP_MD(EVP_MD *md)
{
(void)md;
}
#endif /* OPENSSL_VERSION_NUMBER */
static int
decode_bignum(const cbor_item_t *item, void *ptr, size_t len)
{
@ -266,7 +251,6 @@ rs256_verify_sig(const fido_blob_t *dgst, EVP_PKEY *pkey,
ok = 0;
fail:
EVP_PKEY_CTX_free(pctx);
rs256_free_EVP_MD(md);
return (ok);
}