diff options
| author | jsing <> | 2023-06-21 07:16:08 +0000 |
|---|---|---|
| committer | jsing <> | 2023-06-21 07:16:08 +0000 |
| commit | a88d085da8637994f920a65e914fe4811644321e (patch) | |
| tree | 5db1714eca7804d0f142111b89fb327e628148c3 /src | |
| parent | 67f8a09245c56c043aedb4e517cc230194c8cbc2 (diff) | |
| download | openbsd-a88d085da8637994f920a65e914fe4811644321e.tar.gz openbsd-a88d085da8637994f920a65e914fe4811644321e.tar.bz2 openbsd-a88d085da8637994f920a65e914fe4811644321e.zip | |
Add BN_cmp()/BN_ucmp() tests with zero padded inputs.
Currently BN_hex2bn() removes the leading zeros, however this will not be
the case in the future.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/bn/bn_cmp.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/bn/bn_cmp.c b/src/regress/lib/libcrypto/bn/bn_cmp.c index 2f5c7c02e7..047fac3ba9 100644 --- a/src/regress/lib/libcrypto/bn/bn_cmp.c +++ b/src/regress/lib/libcrypto/bn/bn_cmp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_cmp.c,v 1.1 2022/11/30 02:51:05 jsing Exp $ */ | 1 | /* $OpenBSD: bn_cmp.c,v 1.2 2023/06/21 07:16:08 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -75,6 +75,30 @@ struct bn_cmp_test bn_cmp_tests[] = { | |||
| 75 | .cmp = -1, | 75 | .cmp = -1, |
| 76 | .ucmp = 1, | 76 | .ucmp = 1, |
| 77 | }, | 77 | }, |
| 78 | { | ||
| 79 | .a = "1ffffffffffffffff", | ||
| 80 | .b = "00000000000000001ffffffffffffffff", | ||
| 81 | .cmp = 0, | ||
| 82 | .ucmp = 0, | ||
| 83 | }, | ||
| 84 | { | ||
| 85 | .a = "-1ffffffffffffffff", | ||
| 86 | .b = "-00000000000000001ffffffffffffffff", | ||
| 87 | .cmp = 0, | ||
| 88 | .ucmp = 0, | ||
| 89 | }, | ||
| 90 | { | ||
| 91 | .a = "1ffffffffffffffff", | ||
| 92 | .b = "-00000000000000001ffffffffffffffff", | ||
| 93 | .cmp = 1, | ||
| 94 | .ucmp = 0, | ||
| 95 | }, | ||
| 96 | { | ||
| 97 | .a = "-1ffffffffffffffff", | ||
| 98 | .b = "00000000000000001ffffffffffffffff", | ||
| 99 | .cmp = -1, | ||
| 100 | .ucmp = 0, | ||
| 101 | }, | ||
| 78 | }; | 102 | }; |
| 79 | 103 | ||
| 80 | #define N_BN_CMP_TESTS \ | 104 | #define N_BN_CMP_TESTS \ |
