]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add DetECDSA self test, signature is one byte shorter somehow
authorDimitri John Ledkov <dimitri.ledkov@surgut.co.uk>
Mon, 11 Aug 2025 13:14:34 +0000 (14:14 +0100)
committerPauli <ppzgs1@gmail.com>
Wed, 20 Aug 2025 23:58:55 +0000 (09:58 +1000)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28213)

doc/man7/OSSL_PROVIDER-FIPS.pod
include/openssl/self_test.h
providers/fips/self_test_data.inc

index b38a6697a7ed7db9a8cef2c22126018e67277cf5..bbc9042fc8516cfae9e813d2074e4c8f2f33d118 100644 (file)
@@ -447,6 +447,8 @@ Digest tests used with the "KAT_Digest" type.
 
 =item "ECDSA" (B<OSSL_SELF_TEST_DESC_SIGN_ECDSA>)
 
+=item "DetECDSA" (B<OSSL_SELF_TEST_DESC_SIGN_DetECDSA>)
+
 =item "EDDSA" (B<OSSL_SELF_TEST_DESC_SIGN_EDDSA>)
 
 =item "LMS" (B<OSSL_SELF_TEST_DESC_SIGN_LMS>)
index 93a395bbbcdb61bfa0c7584c8db5284357bfecca..3ce64611738e4007d7c58f8b50bf91c945c3847b 100644 (file)
@@ -66,6 +66,7 @@ extern "C" {
 # define OSSL_SELF_TEST_DESC_SIGN_DSA       "DSA"
 # define OSSL_SELF_TEST_DESC_SIGN_RSA       "RSA"
 # define OSSL_SELF_TEST_DESC_SIGN_ECDSA     "ECDSA"
+# define OSSL_SELF_TEST_DESC_SIGN_DetECDSA  "DetECDSA"
 # define OSSL_SELF_TEST_DESC_SIGN_EDDSA     "EDDSA"
 # define OSSL_SELF_TEST_DESC_SIGN_LMS       "LMS"
 # define OSSL_SELF_TEST_DESC_SIGN_ML_DSA    "ML-DSA"
index b062eeaca003448abe138db4dcd10633c1d82040..fd81cf0d9384b5dd386978b49373e83c6232e286 100644 (file)
@@ -1521,6 +1521,16 @@ static const unsigned char ecdsa_prime_expected_sig[] = {
     0x45, 0xc3, 0x6f, 0x9e, 0x2e, 0xc1, 0x44, 0x9f,
     0xfd, 0x79, 0xdb, 0x90, 0x3e, 0xb9, 0xb2
 };
+static const unsigned char ecdsa_prime_expected_detsig[] = {
+    0x30, 0x3c, 0x02, 0x1c, 0x6a, 0x6d, 0x2c, 0x88,
+    0x2b, 0xe5, 0x6b, 0xe6, 0xb1, 0x28, 0xe7, 0xa8,
+    0xbd, 0xca, 0x2e, 0xad, 0x22, 0x22, 0x8d, 0xe0,
+    0xd6, 0x83, 0x5b, 0xc9, 0x5b, 0x5f, 0x06, 0x2e,
+    0x02, 0x1c, 0x71, 0xec, 0x10, 0x8e, 0x31, 0x5d,
+    0xfc, 0x16, 0xed, 0x9d, 0x7d, 0x9b, 0x42, 0x5e,
+    0xf9, 0x16, 0xe6, 0x06, 0xa5, 0xf0, 0x94, 0x2f,
+    0x57, 0xf1, 0x7e, 0xf2, 0x16, 0x76
+};
 static const ST_KAT_PARAM ecdsa_prime_key[] = {
     ST_KAT_PARAM_UTF8STRING(OSSL_PKEY_PARAM_GROUP_NAME, ecd_prime_curve_name),
     ST_KAT_PARAM_OCTET(OSSL_PKEY_PARAM_PUB_KEY, ecd_prime_pub),
@@ -1528,6 +1538,12 @@ static const ST_KAT_PARAM ecdsa_prime_key[] = {
     ST_KAT_PARAM_END()
 };
 
+static int ecdsa_nonce_type = 1;
+static const ST_KAT_PARAM ecdsa_sig_params[] = {
+    ST_KAT_PARAM_INT(OSSL_SIGNATURE_PARAM_NONCE_TYPE, ecdsa_nonce_type),
+    ST_KAT_PARAM_END()
+};
+
 # ifndef OPENSSL_NO_EC2M
 static const char ecd_bin_curve_name[] = "sect233r1";
 static const unsigned char ecd_bin_priv[] = {
@@ -3103,6 +3119,15 @@ static const ST_KAT_SIGN st_kat_sign_tests[] = {
         ITM(sig_kat_persstr),
         ITM(ecdsa_prime_expected_sig)
     },
+    {
+        OSSL_SELF_TEST_DESC_SIGN_DetECDSA,
+        "EC", "ECDSA-SHA256", 0,
+        ecdsa_prime_key,
+        ITM_STR(rsa_sig_msg),
+        NULL, 0, NULL, 0, NULL, 0,
+        ITM(ecdsa_prime_expected_detsig),
+        ecdsa_sig_params
+    },
 # ifndef OPENSSL_NO_EC2M
     {
         OSSL_SELF_TEST_DESC_SIGN_ECDSA,