* https://www.openssl.org/source/license.html
*/
+/*
+ * Because of *asn1_*
+ */
+#define OPENSSL_SUPPRESS_DEPRECATED
+
#include <string.h>
#include <openssl/e_os2.h>
__owur static int parse_expected_key_type(int *ptype, const char *value)
{
int nid;
+#ifndef OPENSSL_NO_DEPRECATED_3_6
const EVP_PKEY_ASN1_METHOD *ameth;
+#endif
if (value == NULL)
return 0;
+#ifndef OPENSSL_NO_DEPRECATED_3_6
ameth = EVP_PKEY_asn1_find_str(NULL, value, -1);
if (ameth != NULL)
EVP_PKEY_asn1_get0_info(&nid, NULL, NULL, NULL, NULL, ameth);
else
nid = OBJ_sn2nid(value);
- if (nid == NID_undef)
+#else
+ /*
+ * These functions map the values differently than
+ * EVP_PKEY_asn1_find_str (which was used before) so use this hack
+ * to make it work
+ */
+ if (strcmp("RSA", value) == 0) {
+ nid = OBJ_ln2nid("rsaEncryption");
+ } else if (strcmp("RSA-PSS", value) == 0) {
+ nid = OBJ_ln2nid("rsassaPss");
+ } else if (strcmp("Ed448", value) == 0) {
+ nid = OBJ_sn2nid("ED448");
+ } else if (strcmp("Ed25519", value) == 0) {
+ nid = OBJ_sn2nid("ED25519");
+ } else if (strcmp("EC", value) == 0) {
+ nid = OBJ_sn2nid("id-ecPublicKey");
+ } else {
nid = OBJ_ln2nid(value);
+ }
+#endif
+ if (nid == NID_undef)
+ nid = OBJ_sn2nid(value);
#ifndef OPENSSL_NO_EC
if (nid == NID_undef)
nid = EC_curve_nist2nid(value);
/* Internal tests for EVP_PKEY method ordering */
-/* We need to use some deprecated APIs */
+/*
+ * Because of *asn1_*
+ */
#define OPENSSL_SUPPRESS_DEPRECATED
#include <stdio.h>
#include <openssl/evp.h>
#include "testutil.h"
+#ifndef OPENSSL_NO_DEPRECATED_3_6
/* Test of EVP_PKEY_ASN1_METHOD ordering */
static int test_asn1_meths(void)
{
}
return good;
}
+#endif
#ifndef OPENSSL_NO_DEPRECATED_3_0
/* Test of EVP_PKEY_METHOD ordering */
int setup_tests(void)
{
+#ifndef OPENSSL_NO_DEPRECATED_3_6
ADD_TEST(test_asn1_meths);
+#endif
#ifndef OPENSSL_NO_DEPRECATED_3_0
ADD_TEST(test_pkey_meths);
#endif