Avoid alignment problems in params API.
authorPauli <paul.dale@oracle.com>
Mon, 8 Apr 2019 04:28:59 +0000 (14:28 +1000)
committerPauli <paul.dale@oracle.com>
Mon, 8 Apr 2019 04:28:59 +0000 (14:28 +1000)
Using a byte buffer causes problems for device that don't handle unaligned
reads.  Instead use the properly aligned variable that was already pointed at.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8696)

test/params_api_test.c

index 94487d613b8841018e51c547dc7e708a87513037..c78a42bade4152684dfdca5c57b8460dfd3c1ade 100644 (file)
@@ -146,7 +146,6 @@ static int test_param_int(int n)
     if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
         return 0;
     in = 0;
-    param.data = buf;
     if (!TEST_true(OSSL_PARAM_get_int(&param, &in)))
         return 0;
     le_copy(cmp, &in, sizeof(in));
@@ -174,7 +173,6 @@ static int test_param_long(int n)
     if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
         return 0;
     in = 0;
-    param.data = buf;
     if (!TEST_true(OSSL_PARAM_get_long(&param, &in)))
         return 0;
     le_copy(cmp, &in, sizeof(in));
@@ -201,7 +199,6 @@ static int test_param_uint(int n)
     if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
         return 0;
     in = 0;
-    param.data = buf;
     if (!TEST_true(OSSL_PARAM_get_uint(&param, &in)))
         return 0;
     le_copy(cmp, &in, sizeof(in));
@@ -229,7 +226,6 @@ static int test_param_ulong(int n)
     if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
         return 0;
     in = 0;
-    param.data = buf;
     if (!TEST_true(OSSL_PARAM_get_ulong(&param, &in)))
         return 0;
     le_copy(cmp, &in, sizeof(in));
@@ -257,7 +253,6 @@ static int test_param_int32(int n)
     if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
         return 0;
     in = 0;
-    param.data = buf;
     if (!TEST_true(OSSL_PARAM_get_int32(&param, &in)))
         return 0;
     le_copy(cmp, &in, sizeof(in));
@@ -285,7 +280,6 @@ static int test_param_uint32(int n)
     if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
         return 0;
     in = 0;
-    param.data = buf;
     if (!TEST_true(OSSL_PARAM_get_uint32(&param, &in)))
         return 0;
     le_copy(cmp, &in, sizeof(in));
@@ -313,7 +307,6 @@ static int test_param_int64(int n)
     if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
         return 0;
     in = 0;
-    param.data = buf;
     if (!TEST_true(OSSL_PARAM_get_int64(&param, &in)))
         return 0;
     le_copy(cmp, &in, sizeof(in));
@@ -341,7 +334,6 @@ static int test_param_uint64(int n)
     if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
         return 0;
     in = 0;
-    param.data = buf;
     if (!TEST_true(OSSL_PARAM_get_uint64(&param, &in)))
         return 0;
     le_copy(cmp, &in, sizeof(in));
@@ -369,7 +361,6 @@ static int test_param_size_t(int n)
     if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
         return 0;
     in = 0;
-    param.data = buf;
     if (!TEST_true(OSSL_PARAM_get_size_t(&param, &in)))
         return 0;
     le_copy(cmp, &in, sizeof(in));