From b81e93673fc6d97ce2337ecc36f630b960a8eb62 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 20 Jul 2022 16:18:41 +1000 Subject: [PATCH] Check if RSASHA1 is supported by the OS (cherry picked from commit 1690cb7bb4444f985dfed4edb25b92afa0e5651a) --- ...rsa.+005+29235.key => Krsa.+008+29238.key} | 2 +- tests/dns/Makefile.am | 2 +- tests/dns/rsa_test.c | 31 ++++++++++--------- 3 files changed, 19 insertions(+), 16 deletions(-) rename tests/dns/{Krsa.+005+29235.key => Krsa.+008+29238.key} (89%) diff --git a/tests/dns/Krsa.+005+29235.key b/tests/dns/Krsa.+008+29238.key similarity index 89% rename from tests/dns/Krsa.+005+29235.key rename to tests/dns/Krsa.+008+29238.key index e2d81e79db..8a09067197 100644 --- a/tests/dns/Krsa.+005+29235.key +++ b/tests/dns/Krsa.+008+29238.key @@ -2,4 +2,4 @@ ; Created: 20160819191802 (Fri Aug 19 21:18:02 2016) ; Publish: 20160819191802 (Fri Aug 19 21:18:02 2016) ; Activate: 20160819191802 (Fri Aug 19 21:18:02 2016) -rsa. IN DNSKEY 256 3 5 AwEAAdLT1R3qiqCqll3Xzh2qFMvehQ9FODsPftw5U4UjB3QwnJ/3+dph 9kZBBeaJagUBVYzoArk6XNydpp3HhSCFDcIiepL6r8XAifW3SqI1KCne OD38kSCl/Qm9P0+3CFWokGVubsSQ+3dpQZxqx5bzOXthbuzAr6X+gDUE LAyHtCQNmJ+4ktdCoj3DNYW0z/xLvrcB2Lns7H+/qWnGPL4f3hr7Vbak Oeay+4J4KGdY2LFxJUVts6QrgAA8gz4mV9YIJFP+C4B3b/Z7qgqZRxmT 0pic+fJC5+sq0l8KwavPn0n+HqVuJNvppVKMdTbsmmuk69RFGMjbFkP7 tnCiqC9Zi6s= +rsa. IN DNSKEY 256 3 8 AwEAAdLT1R3qiqCqll3Xzh2qFMvehQ9FODsPftw5U4UjB3QwnJ/3+dph 9kZBBeaJagUBVYzoArk6XNydpp3HhSCFDcIiepL6r8XAifW3SqI1KCne OD38kSCl/Qm9P0+3CFWokGVubsSQ+3dpQZxqx5bzOXthbuzAr6X+gDUE LAyHtCQNmJ+4ktdCoj3DNYW0z/xLvrcB2Lns7H+/qWnGPL4f3hr7Vbak Oeay+4J4KGdY2LFxJUVts6QrgAA8gz4mV9YIJFP+C4B3b/Z7qgqZRxmT 0pic+fJC5+sq0l8KwavPn0n+HqVuJNvppVKMdTbsmmuk69RFGMjbFkP7 tnCiqC9Zi6s= diff --git a/tests/dns/Makefile.am b/tests/dns/Makefile.am index a467ef0f97..25f593b3b3 100644 --- a/tests/dns/Makefile.am +++ b/tests/dns/Makefile.am @@ -116,7 +116,7 @@ testdata/master/master18.data: testdata/master/master18.data.in EXTRA_DIST = \ Kdh.+002+18602.key \ - Krsa.+005+29235.key \ + Krsa.+008+29238.key \ comparekeys \ mkraw.pl \ testdata \ diff --git a/tests/dns/rsa_test.c b/tests/dns/rsa_test.c index bebe68139d..40652541f5 100644 --- a/tests/dns/rsa_test.c +++ b/tests/dns/rsa_test.c @@ -150,27 +150,30 @@ ISC_RUN_TEST_IMPL(isc_rsa_verify) { ret = dns_name_fromtext(name, &buf, NULL, 0, NULL); assert_int_equal(ret, ISC_R_SUCCESS); - ret = dst_key_fromfile(name, 29235, DST_ALG_RSASHA1, DST_TYPE_PUBLIC, + ret = dst_key_fromfile(name, 29238, DST_ALG_RSASHA256, DST_TYPE_PUBLIC, TESTS_DIR, mctx, &key); assert_int_equal(ret, ISC_R_SUCCESS); - /* RSASHA1 */ + /* RSASHA1 - May not be supported by the OS */ + if (dst_algorithm_supported(DST_ALG_RSASHA1)) { + key->key_alg = DST_ALG_RSASHA1; - ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC, false, 0, - &ctx); - assert_int_equal(ret, ISC_R_SUCCESS); + ret = dst_context_create(key, mctx, DNS_LOGCATEGORY_DNSSEC, + false, 0, &ctx); + assert_int_equal(ret, ISC_R_SUCCESS); - r.base = d; - r.length = 10; - ret = dst_context_adddata(ctx, &r); - assert_int_equal(ret, ISC_R_SUCCESS); + r.base = d; + r.length = 10; + ret = dst_context_adddata(ctx, &r); + assert_int_equal(ret, ISC_R_SUCCESS); - r.base = sigsha1; - r.length = 256; - ret = dst_context_verify(ctx, &r); - assert_int_equal(ret, ISC_R_SUCCESS); + r.base = sigsha1; + r.length = 256; + ret = dst_context_verify(ctx, &r); + assert_int_equal(ret, ISC_R_SUCCESS); - dst_context_destroy(&ctx); + dst_context_destroy(&ctx); + } /* RSASHA256 */