From: jsing Date: Tue, 31 Jan 2023 05:12:16 +0000 (+0000) Subject: Add more regress tests for BN_usub(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3879165ed9e5a93bd2045caa856e4bf3d699a16a;p=openbsd Add more regress tests for BN_usub(). This adds more tests for BN_usub(), particularly where b > a, which should be an error condition. One of these currently succeeds and produces incorrect results. --- diff --git a/regress/lib/libcrypto/bn/bn_add_sub.c b/regress/lib/libcrypto/bn/bn_add_sub.c index 13af33fe9a0..2901dcbc85b 100644 --- a/regress/lib/libcrypto/bn/bn_add_sub.c +++ b/regress/lib/libcrypto/bn/bn_add_sub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_add_sub.c,v 1.2 2022/12/02 00:01:06 tb Exp $ */ +/* $OpenBSD: bn_add_sub.c,v 1.3 2023/01/31 05:12:16 jsing Exp $ */ /* * Copyright (c) 2018 Theo Buehler * @@ -129,6 +129,13 @@ struct hexinput_st test_bn_usub[] = { 1, 1, }, + { + "11100000001", + "100000000001000000000", + "0", + 0, + 0, + }, { "100000000000000000000", "1", @@ -136,6 +143,20 @@ struct hexinput_st test_bn_usub[] = { 1, 1, }, + { + "1", + "0", + "1", + 1, + 1, + }, + { + "1", + "2", + "FFFFFFFFFFFFFFFF", + 0, + 0, + }, { "0", "1",