[openssl] master update
The branch master has been updated via 17cca0e85e83eac23069ddc5c5ebab6d7dd13ee1 (commit) from 336923c0c8d705cb8af5216b29a205662db0d590 (commit) - Log - commit 17cca0e85e83eac23069ddc5c5ebab6d7dd13ee1 Author: Bernd Edlinger Date: Sat Dec 11 21:25:23 2021 +0100 Remove some unnecessary undefs in bn_asm.c This is likely the leftover of a previous hack, and thus should be removed now. Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17259) --- Summary of changes: crypto/bn/bn_asm.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/crypto/bn/bn_asm.c b/crypto/bn/bn_asm.c index 257701d9dc..485bfd838b 100644 --- a/crypto/bn/bn_asm.c +++ b/crypto/bn/bn_asm.c @@ -422,11 +422,6 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, #if defined(BN_MUL_COMBA) && !defined(OPENSSL_SMALL_FOOTPRINT) -# undef bn_mul_comba8 -# undef bn_mul_comba4 -# undef bn_sqr_comba8 -# undef bn_sqr_comba4 - /* mul_add_c(a,b,c0,c1,c2) -- c+=a*b for three word number c=(c2,c1,c0) */ /* mul_add_c2(a,b,c0,c1,c2) -- c+=2*a*b for three word number c=(c2,c1,c0) */ /* sqr_add_c(a,i,c0,c1,c2) -- c+=a[i]^2 for three word number c=(c2,c1,c0) */ @@ -950,8 +945,6 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, #else /* !BN_MUL_COMBA */ /* hmm... is it faster just to do a multiply? */ -# undef bn_sqr_comba4 -# undef bn_sqr_comba8 void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a) { BN_ULONG t[8];
[openssl] OpenSSL_1_1_1-stable update
The branch OpenSSL_1_1_1-stable has been updated via e9e726506cd2a3fd9c0f12daf8cc1fe934c7dddb (commit) from 8b35838b44e83f323eaa5d7aeecc45c8e2321cf8 (commit) - Log - commit e9e726506cd2a3fd9c0f12daf8cc1fe934c7dddb Author: Bernd Edlinger Date: Sat Dec 11 20:28:11 2021 +0100 Fix a carry overflow bug in bn_sqr_comba4/8 for mips 32-bit targets bn_sqr_comba8 does for instance compute a wrong result for the value: a=0x4aaac919 62056c84 fba7334e 1a6be678 022181ba fd3aa878 899b2346 ee210f45 The correct result is: r=0x15c72e32 605a3061 d11b1012 3c187483 6df96999 bd0c22ba d3e7d437 4724a82f 912c5e61 6a187efe 8f7c47fc f6945fe5 75be8e3d 97ed17d4 7950b465 3cb32899 but the actual result was: r=0x15c72e32 605a3061 d11b1012 3c187483 6df96999 bd0c22ba d3e7d437 4724a82f 912c5e61 6a187efe 8f7c47fc f6945fe5 75be8e3c 97ed17d4 7950b465 3cb32899 so the forth word of the result was 0x75be8e3c but should have been 0x75be8e3d instead. Likewise bn_sqr_comba4 has an identical bug for the same value as well: a=0x022181ba fd3aa878 899b2346 ee210f45 correct result: r=0x00048a69 9fe82f8b 62bd2ed1 88781335 75be8e3d 97ed17d4 7950b465 3cb32899 wrong result: r=0x00048a69 9fe82f8b 62bd2ed1 88781335 75be8e3c 97ed17d4 7950b465 3cb32899 Fortunately the bn_mul_comba4/8 code paths are not affected. Also the mips64 target does in fact not handle the carry propagation correctly. Example: a=0x4aaac919 62056c84 fba7334e 1a6be678 022181ba fd3aa878 899b234635dad283 ee210f450001 correct result: r=0x15c72e32272c4471 392debf018c679c8 b85496496bf8254c d0204f36611e2be1 0cdb3db8f3c081d8 c94ba0e1bacc5061 191b83d47ff929f6 5be0aebfc13ae68d 3eea7a7fdf2f5758 42f7ec656cab3cb5 6a28095be34756f2 64f24687bf37de06 2822309cd1d292f9 6fa698c972372f09 771e97d3a868cda0 dc421e8a0001 wrong result: r=0x15c72e32272c4471 392debf018c679c8 b85496496bf8254c d0204f36611e2be1 0cdb3db8f3c081d8 c94ba0e1bacc5061 191b83d47ff929f6 5be0aebfc13ae68d 3eea7a7fdf2f5758 42f7ec656cab3cb5 6a28095be34756f2 64f24687bf37de06 2822309cd1d292f8 6fa698c972372f09 771e97d3a868cda0 dc421e8a0001 Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17258) (cherry picked from commit 336923c0c8d705cb8af5216b29a205662db0d590) --- Summary of changes: crypto/bn/asm/mips.pl | 4 test/bntest.c | 45 + 2 files changed, 49 insertions(+) diff --git a/crypto/bn/asm/mips.pl b/crypto/bn/asm/mips.pl index 8ad715bda4..74101030f2 100644 --- a/crypto/bn/asm/mips.pl +++ b/crypto/bn/asm/mips.pl @@ -1984,6 +1984,8 @@ $code.=<<___; sltu$at,$c_2,$t_1 $ADDU $c_3,$t_2,$at $ST $c_2,$BNSZ($a0) + sltu$at,$c_3,$t_2 + $ADDU $c_1,$at mflo($t_1,$a_2,$a_0) mfhi($t_2,$a_2,$a_0) ___ @@ -2194,6 +2196,8 @@ $code.=<<___; sltu$at,$c_2,$t_1 $ADDU $c_3,$t_2,$at $ST $c_2,$BNSZ($a0) + sltu$at,$c_3,$t_2 + $ADDU $c_1,$at mflo($t_1,$a_2,$a_0) mfhi($t_2,$a_2,$a_0) ___ diff --git a/test/bntest.c b/test/bntest.c index b58028a301..bab34ba54b 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -627,6 +627,51 @@ static int test_modexp_mont5(void) if (!TEST_BN_eq(c, d)) goto err; +/* + * Regression test for overflow bug in bn_sqr_comba4/8 for + * mips-linux-gnu and mipsel-linux-gnu 32bit targets. + */ +{ +static const char *ehex[] = { +"95564994a96c45954227b845a1e99cb939d5a1da99ee91acc962396ae999a9ee", +"38603790448f2f7694c242a875f0cad0aae658eba085f312d2febbbd128dd2b5", +"8f7d1149f03724215d704344d0d62c587ae3c5939cba4b9b5f3dc5e8e911ef9a", +"5ce1a5a749a4989d0d8368f6e1f8cdf3a362a6c97fb02047ff152b480a4ad985", +"2d45efdf0770542992afca6a0590d52930434bba96017afbc9f99e112950a8b1", +"a359473ec376f329bdae6a19f503be6d4be7393c4e43468831234e27e3838680", +"b949390d2e416a3f9759e5349ab4c253f6f29f819a6fe4cbfd27ada34903300e", +"da021f62839f5878a36f1bc3085375b00fd5fa3e68d316c0fdace87a97558465", +NULL}; +static const char *phex[] = { +"f95dc0f980fbd22e90caa5a387cc4a369f3f830d50dd321c40db8c09a7e1a241", +"a536e096622d3280c0c1ba849c1f4a79bf490f60006d081e8cf69960189f0d31", +"2cd9e17073a3fba7881b21474a13b334116cb2f5dbf3189a6de3515d0840f053", +"c776d3982d391b6d04d642dda5cc6d1640174c09875addb70595658f89efb439", +"dc6fbd55f903aadd307982d3f659207f265e1ec6271b274521b7a5e28e8fd7a5", +
[openssl] openssl-3.0 update
The branch openssl-3.0 has been updated via 3bf7b73ea7123045b8f972badc67ed6878e6c37f (commit) from 110b005465f3d3edb0fe0f61b87595d011770317 (commit) - Log - commit 3bf7b73ea7123045b8f972badc67ed6878e6c37f Author: Bernd Edlinger Date: Sat Dec 11 20:28:11 2021 +0100 Fix a carry overflow bug in bn_sqr_comba4/8 for mips 32-bit targets bn_sqr_comba8 does for instance compute a wrong result for the value: a=0x4aaac919 62056c84 fba7334e 1a6be678 022181ba fd3aa878 899b2346 ee210f45 The correct result is: r=0x15c72e32 605a3061 d11b1012 3c187483 6df96999 bd0c22ba d3e7d437 4724a82f 912c5e61 6a187efe 8f7c47fc f6945fe5 75be8e3d 97ed17d4 7950b465 3cb32899 but the actual result was: r=0x15c72e32 605a3061 d11b1012 3c187483 6df96999 bd0c22ba d3e7d437 4724a82f 912c5e61 6a187efe 8f7c47fc f6945fe5 75be8e3c 97ed17d4 7950b465 3cb32899 so the forth word of the result was 0x75be8e3c but should have been 0x75be8e3d instead. Likewise bn_sqr_comba4 has an identical bug for the same value as well: a=0x022181ba fd3aa878 899b2346 ee210f45 correct result: r=0x00048a69 9fe82f8b 62bd2ed1 88781335 75be8e3d 97ed17d4 7950b465 3cb32899 wrong result: r=0x00048a69 9fe82f8b 62bd2ed1 88781335 75be8e3c 97ed17d4 7950b465 3cb32899 Fortunately the bn_mul_comba4/8 code paths are not affected. Also the mips64 target does in fact not handle the carry propagation correctly. Example: a=0x4aaac919 62056c84 fba7334e 1a6be678 022181ba fd3aa878 899b234635dad283 ee210f450001 correct result: r=0x15c72e32272c4471 392debf018c679c8 b85496496bf8254c d0204f36611e2be1 0cdb3db8f3c081d8 c94ba0e1bacc5061 191b83d47ff929f6 5be0aebfc13ae68d 3eea7a7fdf2f5758 42f7ec656cab3cb5 6a28095be34756f2 64f24687bf37de06 2822309cd1d292f9 6fa698c972372f09 771e97d3a868cda0 dc421e8a0001 wrong result: r=0x15c72e32272c4471 392debf018c679c8 b85496496bf8254c d0204f36611e2be1 0cdb3db8f3c081d8 c94ba0e1bacc5061 191b83d47ff929f6 5be0aebfc13ae68d 3eea7a7fdf2f5758 42f7ec656cab3cb5 6a28095be34756f2 64f24687bf37de06 2822309cd1d292f8 6fa698c972372f09 771e97d3a868cda0 dc421e8a0001 Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17258) (cherry picked from commit 336923c0c8d705cb8af5216b29a205662db0d590) --- Summary of changes: crypto/bn/asm/mips.pl | 4 test/bntest.c | 45 + 2 files changed, 49 insertions(+) diff --git a/crypto/bn/asm/mips.pl b/crypto/bn/asm/mips.pl index 95cb227dc5..91b7aac6e7 100644 --- a/crypto/bn/asm/mips.pl +++ b/crypto/bn/asm/mips.pl @@ -1986,6 +1986,8 @@ $code.=<<___; sltu$at,$c_2,$t_1 $ADDU $c_3,$t_2,$at $ST $c_2,$BNSZ($a0) + sltu$at,$c_3,$t_2 + $ADDU $c_1,$at mflo($t_1,$a_2,$a_0) mfhi($t_2,$a_2,$a_0) ___ @@ -2196,6 +2198,8 @@ $code.=<<___; sltu$at,$c_2,$t_1 $ADDU $c_3,$t_2,$at $ST $c_2,$BNSZ($a0) + sltu$at,$c_3,$t_2 + $ADDU $c_1,$at mflo($t_1,$a_2,$a_0) mfhi($t_2,$a_2,$a_0) ___ diff --git a/test/bntest.c b/test/bntest.c index 87e5c4065b..fa9fc07cef 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -630,6 +630,51 @@ static int test_modexp_mont5(void) if (!TEST_BN_eq(c, d)) goto err; +/* + * Regression test for overflow bug in bn_sqr_comba4/8 for + * mips-linux-gnu and mipsel-linux-gnu 32bit targets. + */ +{ +static const char *ehex[] = { +"95564994a96c45954227b845a1e99cb939d5a1da99ee91acc962396ae999a9ee", +"38603790448f2f7694c242a875f0cad0aae658eba085f312d2febbbd128dd2b5", +"8f7d1149f03724215d704344d0d62c587ae3c5939cba4b9b5f3dc5e8e911ef9a", +"5ce1a5a749a4989d0d8368f6e1f8cdf3a362a6c97fb02047ff152b480a4ad985", +"2d45efdf0770542992afca6a0590d52930434bba96017afbc9f99e112950a8b1", +"a359473ec376f329bdae6a19f503be6d4be7393c4e43468831234e27e3838680", +"b949390d2e416a3f9759e5349ab4c253f6f29f819a6fe4cbfd27ada34903300e", +"da021f62839f5878a36f1bc3085375b00fd5fa3e68d316c0fdace87a97558465", +NULL}; +static const char *phex[] = { +"f95dc0f980fbd22e90caa5a387cc4a369f3f830d50dd321c40db8c09a7e1a241", +"a536e096622d3280c0c1ba849c1f4a79bf490f60006d081e8cf69960189f0d31", +"2cd9e17073a3fba7881b21474a13b334116cb2f5dbf3189a6de3515d0840f053", +"c776d3982d391b6d04d642dda5cc6d1640174c09875addb70595658f89efb439", +"dc6fbd55f903aadd307982d3f659207f265e1ec6271b274521b7a5e28e8fd7a5", +"
[openssl] master update
The branch master has been updated via 336923c0c8d705cb8af5216b29a205662db0d590 (commit) from 2490d10d5cca0163cad8045857248b175bdf83e7 (commit) - Log - commit 336923c0c8d705cb8af5216b29a205662db0d590 Author: Bernd Edlinger Date: Sat Dec 11 20:28:11 2021 +0100 Fix a carry overflow bug in bn_sqr_comba4/8 for mips 32-bit targets bn_sqr_comba8 does for instance compute a wrong result for the value: a=0x4aaac919 62056c84 fba7334e 1a6be678 022181ba fd3aa878 899b2346 ee210f45 The correct result is: r=0x15c72e32 605a3061 d11b1012 3c187483 6df96999 bd0c22ba d3e7d437 4724a82f 912c5e61 6a187efe 8f7c47fc f6945fe5 75be8e3d 97ed17d4 7950b465 3cb32899 but the actual result was: r=0x15c72e32 605a3061 d11b1012 3c187483 6df96999 bd0c22ba d3e7d437 4724a82f 912c5e61 6a187efe 8f7c47fc f6945fe5 75be8e3c 97ed17d4 7950b465 3cb32899 so the forth word of the result was 0x75be8e3c but should have been 0x75be8e3d instead. Likewise bn_sqr_comba4 has an identical bug for the same value as well: a=0x022181ba fd3aa878 899b2346 ee210f45 correct result: r=0x00048a69 9fe82f8b 62bd2ed1 88781335 75be8e3d 97ed17d4 7950b465 3cb32899 wrong result: r=0x00048a69 9fe82f8b 62bd2ed1 88781335 75be8e3c 97ed17d4 7950b465 3cb32899 Fortunately the bn_mul_comba4/8 code paths are not affected. Also the mips64 target does in fact not handle the carry propagation correctly. Example: a=0x4aaac919 62056c84 fba7334e 1a6be678 022181ba fd3aa878 899b234635dad283 ee210f450001 correct result: r=0x15c72e32272c4471 392debf018c679c8 b85496496bf8254c d0204f36611e2be1 0cdb3db8f3c081d8 c94ba0e1bacc5061 191b83d47ff929f6 5be0aebfc13ae68d 3eea7a7fdf2f5758 42f7ec656cab3cb5 6a28095be34756f2 64f24687bf37de06 2822309cd1d292f9 6fa698c972372f09 771e97d3a868cda0 dc421e8a0001 wrong result: r=0x15c72e32272c4471 392debf018c679c8 b85496496bf8254c d0204f36611e2be1 0cdb3db8f3c081d8 c94ba0e1bacc5061 191b83d47ff929f6 5be0aebfc13ae68d 3eea7a7fdf2f5758 42f7ec656cab3cb5 6a28095be34756f2 64f24687bf37de06 2822309cd1d292f8 6fa698c972372f09 771e97d3a868cda0 dc421e8a0001 Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17258) --- Summary of changes: crypto/bn/asm/mips.pl | 4 test/bntest.c | 45 + 2 files changed, 49 insertions(+) diff --git a/crypto/bn/asm/mips.pl b/crypto/bn/asm/mips.pl index 95cb227dc5..91b7aac6e7 100644 --- a/crypto/bn/asm/mips.pl +++ b/crypto/bn/asm/mips.pl @@ -1986,6 +1986,8 @@ $code.=<<___; sltu$at,$c_2,$t_1 $ADDU $c_3,$t_2,$at $ST $c_2,$BNSZ($a0) + sltu$at,$c_3,$t_2 + $ADDU $c_1,$at mflo($t_1,$a_2,$a_0) mfhi($t_2,$a_2,$a_0) ___ @@ -2196,6 +2198,8 @@ $code.=<<___; sltu$at,$c_2,$t_1 $ADDU $c_3,$t_2,$at $ST $c_2,$BNSZ($a0) + sltu$at,$c_3,$t_2 + $ADDU $c_1,$at mflo($t_1,$a_2,$a_0) mfhi($t_2,$a_2,$a_0) ___ diff --git a/test/bntest.c b/test/bntest.c index ebdd6fa944..69506a0e35 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -630,6 +630,51 @@ static int test_modexp_mont5(void) if (!TEST_BN_eq(c, d)) goto err; +/* + * Regression test for overflow bug in bn_sqr_comba4/8 for + * mips-linux-gnu and mipsel-linux-gnu 32bit targets. + */ +{ +static const char *ehex[] = { +"95564994a96c45954227b845a1e99cb939d5a1da99ee91acc962396ae999a9ee", +"38603790448f2f7694c242a875f0cad0aae658eba085f312d2febbbd128dd2b5", +"8f7d1149f03724215d704344d0d62c587ae3c5939cba4b9b5f3dc5e8e911ef9a", +"5ce1a5a749a4989d0d8368f6e1f8cdf3a362a6c97fb02047ff152b480a4ad985", +"2d45efdf0770542992afca6a0590d52930434bba96017afbc9f99e112950a8b1", +"a359473ec376f329bdae6a19f503be6d4be7393c4e43468831234e27e3838680", +"b949390d2e416a3f9759e5349ab4c253f6f29f819a6fe4cbfd27ada34903300e", +"da021f62839f5878a36f1bc3085375b00fd5fa3e68d316c0fdace87a97558465", +NULL}; +static const char *phex[] = { +"f95dc0f980fbd22e90caa5a387cc4a369f3f830d50dd321c40db8c09a7e1a241", +"a536e096622d3280c0c1ba849c1f4a79bf490f60006d081e8cf69960189f0d31", +"2cd9e17073a3fba7881b21474a13b334116cb2f5dbf3189a6de3515d0840f053", +"c776d3982d391b6d04d642dda5cc6d1640174c09875addb70595658f89efb439", +"dc6fbd55f903aadd307982d3f659207f265e1ec6271b274521b7a5e28e8fd7a5", +"5df089292820477802a43cf5b6b94e999e8c9944ddebb0d0e95a60f88cb7e813", +"ba
Coverity Scan: Analysis completed for openssl/openssl
Your request for analysis of openssl/openssl has been completed successfully. The results are available at https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yoN-2BQSVjTtaSz8wS4wOr7HlekBtV1P4YRtWclMVkCdvAA-3D-3DKXkM_MulOTlHne1IxTRELXXnGni8d68xSVF-2BUCe3a7Ux-2BjeGAaby38E7GysSta4T2JHzHnT8t4yiu-2BLayVYPKJ6R2zzN2s5XWNpAHqLKOsEe2LRGTsG9HE0SCpeqRcLvENjCHRFUjJhcdXP0R9hegYNGeQ98abU4bio7qwjs7D0mnLfVrqg6Q-2B2K-2FKaUa7Mvbwfe3FB3ZZnFe661g7Z6bnhSxmuBMD8PT1IAhpw540Mqa2gk-3D Build ID: 423563 Analysis Summary: New defects found: 0 Defects eliminated: 0
[openssl] master update
The branch master has been updated via 2490d10d5cca0163cad8045857248b175bdf83e7 (commit) from 858d5ac16d256db24f78b8c84e723b7d34c8b1ea (commit) - Log - commit 2490d10d5cca0163cad8045857248b175bdf83e7 Author: Dr. David von Oheimb Date: Sun Nov 21 11:51:09 2021 +0100 OSSL_HTTP_proxy_connect(): Fix glitch in response HTTP header parsing Fixes #17247 Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17250) --- Summary of changes: crypto/http/http_client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index a85bfcec42..b4d42f2eb0 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -1317,7 +1317,7 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port, /* Check for HTTP/1.x */ mbufp = mbuf; -if (!HAS_PREFIX(mbufp, HTTP_PREFIX)) { +if (!CHECK_AND_SKIP_PREFIX(mbufp, HTTP_PREFIX)) { ERR_raise(ERR_LIB_HTTP, HTTP_R_HEADER_PARSE_ERROR); BIO_printf(bio_err, "%s: HTTP CONNECT failed, non-HTTP response\n", prog); @@ -1335,6 +1335,8 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port, /* RFC 7231 4.3.6: any 2xx status code is valid */ if (!HAS_PREFIX(mbufp, " 2")) { +if (ossl_isspace(*mbufp)) +mbufp++; /* chop any trailing whitespace */ while (read_len > 0 && ossl_isspace(mbuf[read_len - 1])) read_len--;
[openssl] openssl-3.0 update
The branch openssl-3.0 has been updated via 110b005465f3d3edb0fe0f61b87595d011770317 (commit) from bfa90fcaeaef775d0dfa5da3c0ad7da9f09fb60d (commit) - Log - commit 110b005465f3d3edb0fe0f61b87595d011770317 Author: Tomas Mraz Date: Wed Dec 8 18:26:03 2021 +0100 bn2binpad: Use memset as the buffer will be used later Apparently using OPENSSL_cleanse() confuses the fuzzer so it makes the buffer to appear uninitialized. And memset can be safely used here and it is also potentially faster. Fixes #17237 Reviewed-by: Bernd Edlinger (Merged from https://github.com/openssl/openssl/pull/17240) (cherry picked from commit 858d5ac16d256db24f78b8c84e723b7d34c8b1ea) --- Summary of changes: crypto/bn/bn_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index 28a3e91679..d37b89c2a6 100644 --- a/crypto/bn/bn_lib.c +++ b/crypto/bn/bn_lib.c @@ -505,7 +505,8 @@ int bn2binpad(const BIGNUM *a, unsigned char *to, int tolen, endianess_t endiane /* Swipe through whole available data and don't give away padded zero. */ atop = a->dmax * BN_BYTES; if (atop == 0) { -OPENSSL_cleanse(to, tolen); +if (tolen != 0) +memset(to, '\0', tolen); return tolen; }
[openssl] master update
The branch master has been updated via 858d5ac16d256db24f78b8c84e723b7d34c8b1ea (commit) from 61fa00a4d03f6808389bc1847937f72d184f0627 (commit) - Log - commit 858d5ac16d256db24f78b8c84e723b7d34c8b1ea Author: Tomas Mraz Date: Wed Dec 8 18:26:03 2021 +0100 bn2binpad: Use memset as the buffer will be used later Apparently using OPENSSL_cleanse() confuses the fuzzer so it makes the buffer to appear uninitialized. And memset can be safely used here and it is also potentially faster. Fixes #17237 Reviewed-by: Bernd Edlinger (Merged from https://github.com/openssl/openssl/pull/17240) --- Summary of changes: crypto/bn/bn_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index 28a3e91679..d37b89c2a6 100644 --- a/crypto/bn/bn_lib.c +++ b/crypto/bn/bn_lib.c @@ -505,7 +505,8 @@ int bn2binpad(const BIGNUM *a, unsigned char *to, int tolen, endianess_t endiane /* Swipe through whole available data and don't give away padded zero. */ atop = a->dmax * BN_BYTES; if (atop == 0) { -OPENSSL_cleanse(to, tolen); +if (tolen != 0) +memset(to, '\0', tolen); return tolen; }
[openssl] master update
The branch master has been updated via 20b0579cbfd1986d00ad8eb2167bc865519f23cd (commit) via 22dd3f8b273b18fc20f0650b5a19166eda1950ee (commit) via 7e5be5c3267dc90a77d243d900448c3a62c0b1c9 (commit) from edc8566f475d63278d5f85cd25f324cf2fe9aaf9 (commit) - Log - commit 20b0579cbfd1986d00ad8eb2167bc865519f23cd Author: Dr. David von Oheimb Date: Thu Dec 9 20:28:08 2021 +0100 CMP test_commands.csv: improve test for -reqin, adding -reqin_new_tid Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17252) commit 22dd3f8b273b18fc20f0650b5a19166eda1950ee Author: Dr. David von Oheimb Date: Thu Dec 9 20:25:19 2021 +0100 CMP test_verification.csv: add missing test case for -untrusted with non-matching cert Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17252) commit 7e5be5c3267dc90a77d243d900448c3a62c0b1c9 Author: Dr. David von Oheimb Date: Thu Dec 9 12:40:08 2021 +0100 CMP test_enrollment.csv: clean up test cases regarding (non-existing) directories Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17252) --- Summary of changes: test/recipes/80-test_cmp_http_data/test_commands.csv | 4 ++-- test/recipes/80-test_cmp_http_data/test_enrollment.csv | 8 test/recipes/80-test_cmp_http_data/test_verification.csv | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/recipes/80-test_cmp_http_data/test_commands.csv b/test/recipes/80-test_cmp_http_data/test_commands.csv index ce12de4a8b..0a9ad1a5f5 100644 --- a/test/recipes/80-test_cmp_http_data/test_commands.csv +++ b/test/recipes/80-test_cmp_http_data/test_commands.csv @@ -1,4 +1,4 @@ -expected,description, -section,val, -cmd,val,val2, -cacertsout,val,val2, -infotype,val,, -oldcert,val, -revreason,int, -geninfo,val +expected,description, -section,val, -cmd,val,val2, -cacertsout,val,val2, -infotype,val,, -oldcert,val, -revreason,int, -geninfo,val,-reqin_new_tid ,Generic,message options:Misc,request options:,, , 1,minimum options, -section,, -cmd,ir,,BLANK,,,BLANK,,,BLANK,,BLANK, @@ -55,5 +55,5 @@ expected,description, -section,val, -cmd,val,val2, -cacertsout,val,val2, -infoty 0,geninfo bad syntax: missing ':int', -section,, -cmd,cr,, -cert,signer.crt, -key,signer.p12, -keypass,pass:12345,BLANK,, -geninfo,1.2.3 ,,, 1,reqout+rspout, -section,, -cmd,ir,,-reqout,_RESULT_DIR/req1.der _RESULT_DIR/req2.der,,-rspout,_RESULT_DIR/rsp1.der _RESULT_DIR/rsp2.der,,BLANK,,BLANK, -1,reqin, -section,, -cmd,ir,,-reqin,_RESULT_DIR/req1.der _RESULT_DIR/req2.der,,BLANK,,,BLANK,,BLANK, +1,reqin, -section,, -cmd,ir,,-reqin,_RESULT_DIR/req1.der _RESULT_DIR/req2.der,,BLANK,,,BLANK,,BLANK,-reqin_new_tid 1,rspin, -section,, -cmd,ir,,BLANK,,,-rspin,_RESULT_DIR/rsp1.der _RESULT_DIR/rsp2.der,,BLANK,,BLANK, diff --git a/test/recipes/80-test_cmp_http_data/test_enrollment.csv b/test/recipes/80-test_cmp_http_data/test_enrollment.csv index 358521de28..53bb162b9e 100644 --- a/test/recipes/80-test_cmp_http_data/test_enrollment.csv +++ b/test/recipes/80-test_cmp_http_data/test_enrollment.csv @@ -3,7 +3,7 @@ expected,description, -section,val, -cmd,val, -newkey,val,val, -newkeypass,val, , 1,newkey, -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -certout,_RESULT_DIR/test.certout_newkey.pem,, -out_trusted,root.crt,,BLANK,,BLANK,,, 0,newkey missing arg, -section,, -cmd,ir, -newkey,,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -certout,_RESULT_DIR/test.certout_newkey1.pem,, -out_trusted,root.crt,,BLANK,,BLANK,,, -0,newkey is directory, -section,, -cmd,ir, -newkey,dir/,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -certout,_RESULT_DIR/test.certout_newkey2.pem,, -out_trusted,root.crt,,BLANK,,BLANK,,, +0,newkey is non-existing directory and file, -section,, -cmd,ir, -newkey,idontexist/idontexist,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -certout,_RESULT_DIR/test.certout_newkey2.pem,, -out_trusted,root.crt,,BLANK,,BLANK,,, 0,newkey too many parameters, -section,, -cmd,ir, -newkey,abc,def, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -certout,_RESULT_DIR/test.certout_newkey3.pem,, -out_trusted,root.crt,,BLANK,,BLANK,,, 0,newkey is an RSA key, -section,, -cmd,ir, -newkey,test.RSA2048.pem,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -certout,_RESULT_DIR/test.certout_newkey4.pem,, -out_trusted,root.crt,,BLANK,,BLANK,,, ,,,
[openssl] master update
The branch master has been updated via 61fa00a4d03f6808389bc1847937f72d184f0627 (commit) via e46997111af3a11632df411b01d62fd39cc3faaf (commit) from 20b0579cbfd1986d00ad8eb2167bc865519f23cd (commit) - Log - commit 61fa00a4d03f6808389bc1847937f72d184f0627 Author: Dr. David von Oheimb Date: Tue Dec 7 18:02:19 2021 +0100 APPS/cmp: Simplify read_write_req_resp() - 'req' arg must not be NULL anyway Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17251) commit e46997111af3a11632df411b01d62fd39cc3faaf Author: Dr. David von Oheimb Date: Thu Dec 9 20:52:59 2021 +0100 ossl_cmp_msg_check_update(): align recipNone check with improved transactionID check Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17251) --- Summary of changes: apps/cmp.c | 3 +-- crypto/cmp/cmp_vfy.c | 52 ++-- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/apps/cmp.c b/apps/cmp.c index e35626ebb2..d6ab2a249b 100644 --- a/apps/cmp.c +++ b/apps/cmp.c @@ -789,8 +789,7 @@ static OSSL_CMP_MSG *read_write_req_resp(OSSL_CMP_CTX *ctx, OSSL_CMP_PKIHEADER *hdr; const char *prev_opt_rspin = opt_rspin; -if (req != NULL && opt_reqout != NULL -&& !write_PKIMESSAGE(req, &opt_reqout)) +if (opt_reqout != NULL && !write_PKIMESSAGE(req, &opt_reqout)) goto err; if (opt_reqin != NULL && opt_rspin == NULL) { if ((req_new = read_PKIMESSAGE(&opt_reqin)) == NULL) diff --git a/crypto/cmp/cmp_vfy.c b/crypto/cmp/cmp_vfy.c index cdfad0a631..bea7e506b6 100644 --- a/crypto/cmp/cmp_vfy.c +++ b/crypto/cmp/cmp_vfy.c @@ -640,6 +640,28 @@ int OSSL_CMP_validate_msg(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg) return 0; } +static int check_transactionID_or_nonce(ASN1_OCTET_STRING *expected, +ASN1_OCTET_STRING *actual, int reason) +{ +if (expected != NULL +&& (actual == NULL || ASN1_OCTET_STRING_cmp(expected, actual) != 0)) { +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION +char *expected_str, *actual_str; + +expected_str = i2s_ASN1_OCTET_STRING(NULL, expected); +actual_str = actual == NULL ? "(none)" +: i2s_ASN1_OCTET_STRING(NULL, actual); +ERR_raise_data(ERR_LIB_CMP, CMP_R_TRANSACTIONID_UNMATCHED, + "expected = %s, actual = %s", + expected_str == NULL ? "?" : expected_str, + actual_str == NULL ? "?" : actual_str); +OPENSSL_free(expected_str); +OPENSSL_free(actual_str); +return 0; +#endif +} +return 1; +} /*- * Check received message (i.e., response by server or request from client) @@ -742,36 +764,14 @@ int ossl_cmp_msg_check_update(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg, } /* compare received transactionID with the expected one in previous msg */ -if (ctx->transactionID != NULL -&& (hdr->transactionID == NULL -|| ASN1_OCTET_STRING_cmp(ctx->transactionID, - hdr->transactionID) != 0)) { -#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -char *ctx_str, *hdr_str; - -ctx_str = i2s_ASN1_OCTET_STRING(NULL, ctx->transactionID); -hdr_str = hdr->transactionID == NULL ? "(none)" -: i2s_ASN1_OCTET_STRING(NULL, hdr->transactionID); -ERR_raise_data(ERR_LIB_CMP, CMP_R_TRANSACTIONID_UNMATCHED, - "expected = %s, actual = %s", - ctx_str == NULL ? "?" : ctx_str, - hdr_str == NULL ? "?" : hdr_str); -OPENSSL_free(ctx_str); -OPENSSL_free(hdr_str); +if (!check_transactionID_or_nonce(ctx->transactionID, hdr->transactionID, + CMP_R_TRANSACTIONID_UNMATCHED)) return 0; -#endif -} /* compare received nonce with the one we sent */ -if (ctx->senderNonce != NULL -&& (msg->header->recipNonce == NULL -|| ASN1_OCTET_STRING_cmp(ctx->senderNonce, - hdr->recipNonce) != 0)) { -#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -ERR_raise(ERR_LIB_CMP, CMP_R_RECIPNONCE_UNMATCHED); +if (!check_transactionID_or_nonce(ctx->senderNonce, hdr->recipNonce, + CMP_R_RECIPNONCE_UNMATCHED)) return 0; -#endif -} /* * RFC 4210 section 5.1.1 states: the recipNonce is copied from