summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJuergen Christ <jchrist@linux.ibm.com>2022-01-28 10:53:43 +0100
committerTomas Mraz <tomas@openssl.org>2022-11-11 10:02:44 +0100
commite8f1d76b50204d87a0ef7f6879eb1dd507a54368 (patch)
tree03f945eb31c816cc7b741713c0fc407462ab87c7 /test
parent34ca334e5de6837f2c6bc0b0b0df28bdd237e4d7 (diff)
Fix endianness problem in params_api_test
On a big endian machine, we get test failures in params_api_test like # ERROR: (memory) 'buf1 == buf2' failed @ test/params_api_test.c:473 # --- buf1 # +++ buf2 # 0000:-e901 # 0000:+01e9 # ^^^^ # # OPENSSL_TEST_RAND_ORDER=1643313367 not ok 157 - iteration 3 They are due to an additional conversion copy. Remove this copy to solve the problem. Signed-off-by: Juergen Christ <jchrist@linux.ibm.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17608) (cherry picked from commit 9927749ec2b8fc4b6146f0bd54cb6a44b8295974)
Diffstat (limited to 'test')
-rw-r--r--test/params_api_test.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/params_api_test.c b/test/params_api_test.c
index 76cc6c30be..4c243a8be8 100644
--- a/test/params_api_test.c
+++ b/test/params_api_test.c
@@ -424,14 +424,15 @@ static int test_param_bignum(int n)
int ret = 0;
param.data = bnbuf;
- param.data_size = len;
+ param.data_size = sizeof(bnbuf);
- le_copy(buf, raw_values[n].value, len);
if (!TEST_ptr(b = BN_lebin2bn(raw_values[n].value, (int)len, NULL)))
goto err;
- if (!TEST_true(OSSL_PARAM_set_BN(&param, b))
- || !TEST_mem_eq(bnbuf, param.return_size, buf, param.return_size))
+ if (!TEST_true(OSSL_PARAM_set_BN(&param, b)))
+ goto err;
+ le_copy(buf, bnbuf, len);
+ if (!TEST_mem_eq(raw_values[n].value, len, buf, len))
goto err;
param.data_size = param.return_size;
if (!TEST_true(OSSL_PARAM_get_BN(&param, &c))