summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2024-11-03 12:46:55 +0000
committerjsing <>2024-11-03 12:46:55 +0000
commit4847ae71f9695f306b983673f5bcdcc5310dacaa (patch)
tree2683de78105cb48972891ed2af2e62d76ad51701 /src
parent8827eed559ba59fd0a1d63af9f2eff091ab07034 (diff)
downloadopenbsd-4847ae71f9695f306b983673f5bcdcc5310dacaa.tar.gz
openbsd-4847ae71f9695f306b983673f5bcdcc5310dacaa.tar.bz2
openbsd-4847ae71f9695f306b983673f5bcdcc5310dacaa.zip
Add some additional BN conversion test cases.
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/bn/bn_convert.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/regress/lib/libcrypto/bn/bn_convert.c b/src/regress/lib/libcrypto/bn/bn_convert.c
index 65f014693d..bd4eba3663 100644
--- a/src/regress/lib/libcrypto/bn/bn_convert.c
+++ b/src/regress/lib/libcrypto/bn/bn_convert.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_convert.c,v 1.6 2024/04/17 08:51:11 jsing Exp $ */ 1/* $OpenBSD: bn_convert.c,v 1.7 2024/11/03 12:46:55 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -274,7 +274,7 @@ static const struct bn_convert_test bn_convert_tests[] = {
274 .neg = 0, 274 .neg = 0,
275 .dec = "8388607", 275 .dec = "8388607",
276 .hex = "7FFFFF", 276 .hex = "7FFFFF",
277 .mpi = { 0x00, 0x00, 0x00, 0x03, 0x7f, 0xff, 0xff }, 277 .mpi = { 0x00, 0x00, 0x00, 0x03, 0x7f, 0xff, 0xff, },
278 .mpi_len = 7, 278 .mpi_len = 7,
279 }, 279 },
280 { 280 {
@@ -283,10 +283,28 @@ static const struct bn_convert_test bn_convert_tests[] = {
283 .neg = 1, 283 .neg = 1,
284 .dec = "-8388607", 284 .dec = "-8388607",
285 .hex = "-7FFFFF", 285 .hex = "-7FFFFF",
286 .mpi = { 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff }, 286 .mpi = { 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, },
287 .mpi_len = 7, 287 .mpi_len = 7,
288 }, 288 },
289 { 289 {
290 .bin = { 0x01, 0x02, 0x03, 0x04, },
291 .bin_len = 4,
292 .neg = 0,
293 .dec = "16909060",
294 .hex = "01020304",
295 .mpi = { 0x00, 0x00, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04, },
296 .mpi_len = 8,
297 },
298 {
299 .bin = { 0x04, 0x03, 0x02, 0x01, },
300 .bin_len = 4,
301 .neg = 0,
302 .dec = "67305985",
303 .hex = "04030201",
304 .mpi = { 0x00, 0x00, 0x00, 0x04, 0x04, 0x03, 0x02, 0x01, },
305 .mpi_len = 8,
306 },
307 {
290 .bin = { 0xff, 0xff, 0xff, 0xff, }, 308 .bin = { 0xff, 0xff, 0xff, 0xff, },
291 .bin_len = 4, 309 .bin_len = 4,
292 .neg = 0, 310 .neg = 0,