Sync EVP_MD_meth removal with what landed upstream
authortb <tb@openbsd.org>
Fri, 29 Mar 2024 02:31:22 +0000 (02:31 +0000)
committertb <tb@openbsd.org>
Fri, 29 Mar 2024 02:31:22 +0000 (02:31 +0000)
discussed with djm

lib/libfido2/src/rs1.c
lib/libfido2/src/rs256.c

index 326c84c..f9a36d6 100644 (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);
 }
index 400d063..7c4962d 100644 (file)
 #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);
 }