From 0d5b2381861f14fed24be2ca73592a06d17e5adc Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Sun, 20 Nov 2022 00:30:13 -0600 Subject: [PATCH] hx509: PKCS#12 missing error check --- lib/hx509/ks_p12.c | 14 +++++++------- lib/hx509/test_req.in | 30 +++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/lib/hx509/ks_p12.c b/lib/hx509/ks_p12.c index 6fd7cd105..953ce7880 100644 --- a/lib/hx509/ks_p12.c +++ b/lib/hx509/ks_p12.c @@ -91,14 +91,14 @@ keyBag_parser(hx509_context context, if (ret) return ret; - _hx509_collector_private_key_add(context, - c, - &ki.privateKeyAlgorithm, - NULL, - &ki.privateKey, - os); + ret = _hx509_collector_private_key_add(context, + c, + &ki.privateKeyAlgorithm, + NULL, + &ki.privateKey, + os); free_PKCS8PrivateKeyInfo(&ki); - return 0; + return ret; } static int diff --git a/lib/hx509/test_req.in b/lib/hx509/test_req.in index a070b1dd9..9288df673 100644 --- a/lib/hx509/test_req.in +++ b/lib/hx509/test_req.in @@ -131,5 +131,33 @@ Certificate Request: email:foo@test.h5l.se, DNS:nutcracker.test.h5l.se, DNS:foo.nutcracker.test.h5l.se, othername:, othername:, Registered ID:1.2.3.4.5.6.9 Signature Algorithm: sha256WithRSAEncryption EOF - diff -w "${objdir}/expected" "${objdir}/actual" || exit 1 + if ! diff -u -w "${objdir}/expected" "${objdir}/actual"; then + cat > "$objdir/expected" <, othername: 1.3.6.1.5.2.2::, Registered ID:1.2.3.4.5.6.9 + Signature Algorithm: sha256WithRSAEncryption +EOF + fi fi