From 4847ae71f9695f306b983673f5bcdcc5310dacaa Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sun, 3 Nov 2024 12:46:55 +0000 Subject: Add some additional BN conversion test cases. --- src/regress/lib/libcrypto/bn/bn_convert.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src') 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 @@ -/* $OpenBSD: bn_convert.c,v 1.6 2024/04/17 08:51:11 jsing Exp $ */ +/* $OpenBSD: bn_convert.c,v 1.7 2024/11/03 12:46:55 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -274,7 +274,7 @@ static const struct bn_convert_test bn_convert_tests[] = { .neg = 0, .dec = "8388607", .hex = "7FFFFF", - .mpi = { 0x00, 0x00, 0x00, 0x03, 0x7f, 0xff, 0xff }, + .mpi = { 0x00, 0x00, 0x00, 0x03, 0x7f, 0xff, 0xff, }, .mpi_len = 7, }, { @@ -283,9 +283,27 @@ static const struct bn_convert_test bn_convert_tests[] = { .neg = 1, .dec = "-8388607", .hex = "-7FFFFF", - .mpi = { 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff }, + .mpi = { 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, }, .mpi_len = 7, }, + { + .bin = { 0x01, 0x02, 0x03, 0x04, }, + .bin_len = 4, + .neg = 0, + .dec = "16909060", + .hex = "01020304", + .mpi = { 0x00, 0x00, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04, }, + .mpi_len = 8, + }, + { + .bin = { 0x04, 0x03, 0x02, 0x01, }, + .bin_len = 4, + .neg = 0, + .dec = "67305985", + .hex = "04030201", + .mpi = { 0x00, 0x00, 0x00, 0x04, 0x04, 0x03, 0x02, 0x01, }, + .mpi_len = 8, + }, { .bin = { 0xff, 0xff, 0xff, 0xff, }, .bin_len = 4, -- cgit v1.2.3-55-g6feb