2 * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
5 * Licensed under the Apache License 2.0 (the "License"). You may not use
6 * this file except in compliance with the License. You can obtain a copy
7 * in the file LICENSE in the source distribution or at
8 * https://www.openssl.org/source/license.html
13 #include "internal/nelem.h"
14 #include "internal/endian.h"
15 #include <openssl/params.h>
16 #include <openssl/bn.h>
18 /* The maximum size of the static buffers used to test most things */
21 static void swap_copy(unsigned char *out, const void *in, size_t len)
25 for (j = 0; j < len; j++)
26 out[j] = ((unsigned char *)in)[len - j - 1];
30 * A memory copy that converts the native byte ordering either to or from
31 * little endian format.
33 * On a little endian machine copying either is just a memcpy(3), on a
34 * big endian machine copying from native to or from little endian involves
37 static void le_copy(unsigned char *out, const void *in, size_t len)
44 swap_copy(out, in, len);
49 unsigned char value[MAX_LEN];
53 { 2, { 0x01, 0xe9 } },
54 { 2, { 0xff, 0x53 } },
55 { 3, { 0x16, 0xff, 0x7c } },
56 { 3, { 0xa8, 0x9c, 0x0e } },
57 { 4, { 0x38, 0x27, 0xbf, 0x3b } },
58 { 4, { 0x9f, 0x26, 0x48, 0x22 } },
59 { 5, { 0x30, 0x65, 0xfa, 0xe4, 0x81 } },
60 { 5, { 0xd1, 0x76, 0x01, 0x1b, 0xcd } },
61 { 8, { 0x59, 0xb2, 0x1a, 0xe9, 0x2a, 0xd8, 0x46, 0x40 } },
62 { 8, { 0xb4, 0xae, 0xbd, 0xb4, 0xdd, 0x04, 0xb1, 0x4c } },
63 { 16, { 0x61, 0xe8, 0x7e, 0x31, 0xe9, 0x33, 0x83, 0x3d,
64 0x87, 0x99, 0xc7, 0xd8, 0x5d, 0xa9, 0x8b, 0x42 } },
65 { 16, { 0xee, 0x6e, 0x8b, 0xc3, 0xec, 0xcf, 0x37, 0xcc,
66 0x89, 0x67, 0xf2, 0x68, 0x33, 0xa0, 0x14, 0xb0 } },
69 static int test_param_type_extra(OSSL_PARAM *param, const unsigned char *cmp,
75 unsigned char buf[MAX_LEN];
76 const int bit32 = param->data_size <= sizeof(int32_t);
77 const int sizet = param->data_size <= sizeof(size_t);
78 const int signd = param->data_type == OSSL_PARAM_INTEGER;
81 * Set the unmodified sentinal directly because there is no param array
84 param->return_size = OSSL_PARAM_UNMODIFIED;
86 if ((bit32 && !TEST_true(OSSL_PARAM_get_int32(param, &i32)))
87 || !TEST_true(OSSL_PARAM_get_int64(param, &i64)))
91 && !TEST_true(OSSL_PARAM_get_uint32(param, (uint32_t *)&i32)))
92 || !TEST_true(OSSL_PARAM_get_uint64(param, (uint64_t *)&i64))
93 || (sizet && !TEST_true(OSSL_PARAM_get_size_t(param, &s))))
96 if (!TEST_false(OSSL_PARAM_modified(param)))
99 /* Check signed types */
101 le_copy(buf, &i32, sizeof(i32));
102 sz = sizeof(i32) < width ? sizeof(i32) : width;
103 if (!TEST_mem_eq(buf, sz, cmp, sz))
106 le_copy(buf, &i64, sizeof(i64));
107 sz = sizeof(i64) < width ? sizeof(i64) : width;
108 if (!TEST_mem_eq(buf, sz, cmp, sz))
110 if (sizet && !signd) {
111 le_copy(buf, &s, sizeof(s));
112 sz = sizeof(s) < width ? sizeof(s) : width;
113 if (!TEST_mem_eq(buf, sz, cmp, sz))
117 /* Check a widening write if possible */
118 if (sizeof(size_t) > width) {
120 if (!TEST_true(OSSL_PARAM_set_int32(param, 12345))
121 || !TEST_true(OSSL_PARAM_get_int64(param, &i64))
122 || !TEST_size_t_eq((size_t)i64, 12345))
125 if (!TEST_true(OSSL_PARAM_set_uint32(param, 12345))
126 || !TEST_true(OSSL_PARAM_get_uint64(param, (uint64_t *)&i64))
127 || !TEST_size_t_eq((size_t)i64, 12345))
130 if (!TEST_true(OSSL_PARAM_modified(param)))
137 * The test cases for each of the bastic integral types are similar.
138 * For each type, a param of that type is set and an attempt to read it
139 * get is made. Finally, the above function is called to verify that
140 * the params can be read as other types.
142 * All the real work is done via byte buffers which are converted to machine
143 * byte order and to little endian for comparisons. Narrower values are best
144 * compared using little endian because their values and positions don't
148 static int test_param_int(int n)
151 unsigned char buf[MAX_LEN], cmp[sizeof(int)];
152 const size_t len = raw_values[n].len >= sizeof(int) ?
153 sizeof(int) : raw_values[n].len;
154 OSSL_PARAM param = OSSL_PARAM_int("a", NULL);
156 memset(buf, 0, sizeof(buf));
157 le_copy(buf, raw_values[n].value, sizeof(in));
158 memcpy(&in, buf, sizeof(in));
160 if (!TEST_true(OSSL_PARAM_set_int(¶m, in)))
162 le_copy(cmp, &out, sizeof(out));
163 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
166 if (!TEST_true(OSSL_PARAM_get_int(¶m, &in)))
168 le_copy(cmp, &in, sizeof(in));
169 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
172 return test_param_type_extra(¶m, raw_values[n].value, sizeof(int));
175 static int test_param_long(int n)
178 unsigned char buf[MAX_LEN], cmp[sizeof(long int)];
179 const size_t len = raw_values[n].len >= sizeof(long int)
180 ? sizeof(long int) : raw_values[n].len;
181 OSSL_PARAM param = OSSL_PARAM_long("a", NULL);
183 memset(buf, 0, sizeof(buf));
184 le_copy(buf, raw_values[n].value, sizeof(in));
185 memcpy(&in, buf, sizeof(in));
187 if (!TEST_true(OSSL_PARAM_set_long(¶m, in)))
189 le_copy(cmp, &out, sizeof(out));
190 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
193 if (!TEST_true(OSSL_PARAM_get_long(¶m, &in)))
195 le_copy(cmp, &in, sizeof(in));
196 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
199 return test_param_type_extra(¶m, raw_values[n].value, sizeof(long int));
202 static int test_param_uint(int n)
204 unsigned int in, out;
205 unsigned char buf[MAX_LEN], cmp[sizeof(unsigned int)];
206 const size_t len = raw_values[n].len >= sizeof(unsigned int) ? sizeof(unsigned int) : raw_values[n].len;
207 OSSL_PARAM param = OSSL_PARAM_uint("a", NULL);
209 memset(buf, 0, sizeof(buf));
210 le_copy(buf, raw_values[n].value, sizeof(in));
211 memcpy(&in, buf, sizeof(in));
213 if (!TEST_true(OSSL_PARAM_set_uint(¶m, in)))
215 le_copy(cmp, &out, sizeof(out));
216 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
219 if (!TEST_true(OSSL_PARAM_get_uint(¶m, &in)))
221 le_copy(cmp, &in, sizeof(in));
222 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
225 return test_param_type_extra(¶m, raw_values[n].value, sizeof(unsigned int));
228 static int test_param_ulong(int n)
230 unsigned long int in, out;
231 unsigned char buf[MAX_LEN], cmp[sizeof(unsigned long int)];
232 const size_t len = raw_values[n].len >= sizeof(unsigned long int)
233 ? sizeof(unsigned long int) : raw_values[n].len;
234 OSSL_PARAM param = OSSL_PARAM_ulong("a", NULL);
236 memset(buf, 0, sizeof(buf));
237 le_copy(buf, raw_values[n].value, sizeof(in));
238 memcpy(&in, buf, sizeof(in));
240 if (!TEST_true(OSSL_PARAM_set_ulong(¶m, in)))
242 le_copy(cmp, &out, sizeof(out));
243 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
246 if (!TEST_true(OSSL_PARAM_get_ulong(¶m, &in)))
248 le_copy(cmp, &in, sizeof(in));
249 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
252 return test_param_type_extra(¶m, raw_values[n].value, sizeof(unsigned long int));
255 static int test_param_int32(int n)
258 unsigned char buf[MAX_LEN], cmp[sizeof(int32_t)];
259 const size_t len = raw_values[n].len >= sizeof(int32_t)
260 ? sizeof(int32_t) : raw_values[n].len;
261 OSSL_PARAM param = OSSL_PARAM_int32("a", NULL);
263 memset(buf, 0, sizeof(buf));
264 le_copy(buf, raw_values[n].value, sizeof(in));
265 memcpy(&in, buf, sizeof(in));
267 if (!TEST_true(OSSL_PARAM_set_int32(¶m, in)))
269 le_copy(cmp, &out, sizeof(out));
270 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
273 if (!TEST_true(OSSL_PARAM_get_int32(¶m, &in)))
275 le_copy(cmp, &in, sizeof(in));
276 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
279 return test_param_type_extra(¶m, raw_values[n].value, sizeof(int32_t));
282 static int test_param_uint32(int n)
285 unsigned char buf[MAX_LEN], cmp[sizeof(uint32_t)];
286 const size_t len = raw_values[n].len >= sizeof(uint32_t)
287 ? sizeof(uint32_t) : raw_values[n].len;
288 OSSL_PARAM param = OSSL_PARAM_uint32("a", NULL);
290 memset(buf, 0, sizeof(buf));
291 le_copy(buf, raw_values[n].value, sizeof(in));
292 memcpy(&in, buf, sizeof(in));
294 if (!TEST_true(OSSL_PARAM_set_uint32(¶m, in)))
296 le_copy(cmp, &out, sizeof(out));
297 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
300 if (!TEST_true(OSSL_PARAM_get_uint32(¶m, &in)))
302 le_copy(cmp, &in, sizeof(in));
303 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
306 return test_param_type_extra(¶m, raw_values[n].value, sizeof(uint32_t));
309 static int test_param_int64(int n)
312 unsigned char buf[MAX_LEN], cmp[sizeof(int64_t)];
313 const size_t len = raw_values[n].len >= sizeof(int64_t)
314 ? sizeof(int64_t) : raw_values[n].len;
315 OSSL_PARAM param = OSSL_PARAM_int64("a", NULL);
317 memset(buf, 0, sizeof(buf));
318 le_copy(buf, raw_values[n].value, sizeof(in));
319 memcpy(&in, buf, sizeof(in));
321 if (!TEST_true(OSSL_PARAM_set_int64(¶m, in)))
323 le_copy(cmp, &out, sizeof(out));
324 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
327 if (!TEST_true(OSSL_PARAM_get_int64(¶m, &in)))
329 le_copy(cmp, &in, sizeof(in));
330 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
333 return test_param_type_extra(¶m, raw_values[n].value, sizeof(int64_t));
336 static int test_param_uint64(int n)
339 unsigned char buf[MAX_LEN], cmp[sizeof(uint64_t)];
340 const size_t len = raw_values[n].len >= sizeof(uint64_t)
341 ? sizeof(uint64_t) : raw_values[n].len;
342 OSSL_PARAM param = OSSL_PARAM_uint64("a", NULL);
344 memset(buf, 0, sizeof(buf));
345 le_copy(buf, raw_values[n].value, sizeof(in));
346 memcpy(&in, buf, sizeof(in));
348 if (!TEST_true(OSSL_PARAM_set_uint64(¶m, in)))
350 le_copy(cmp, &out, sizeof(out));
351 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
354 if (!TEST_true(OSSL_PARAM_get_uint64(¶m, &in)))
356 le_copy(cmp, &in, sizeof(in));
357 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
360 return test_param_type_extra(¶m, raw_values[n].value, sizeof(uint64_t));
363 static int test_param_size_t(int n)
366 unsigned char buf[MAX_LEN], cmp[sizeof(size_t)];
367 const size_t len = raw_values[n].len >= sizeof(size_t)
368 ? sizeof(size_t) : raw_values[n].len;
369 OSSL_PARAM param = OSSL_PARAM_size_t("a", NULL);
371 memset(buf, 0, sizeof(buf));
372 le_copy(buf, raw_values[n].value, sizeof(in));
373 memcpy(&in, buf, sizeof(in));
375 if (!TEST_true(OSSL_PARAM_set_size_t(¶m, in)))
377 le_copy(cmp, &out, sizeof(out));
378 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
381 if (!TEST_true(OSSL_PARAM_get_size_t(¶m, &in)))
383 le_copy(cmp, &in, sizeof(in));
384 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
387 return test_param_type_extra(¶m, raw_values[n].value, sizeof(size_t));
390 static int test_param_time_t(int n)
393 unsigned char buf[MAX_LEN], cmp[sizeof(size_t)];
394 const size_t len = raw_values[n].len >= sizeof(size_t)
395 ? sizeof(time_t) : raw_values[n].len;
396 OSSL_PARAM param = OSSL_PARAM_time_t("a", NULL);
398 memset(buf, 0, sizeof(buf));
399 le_copy(buf, raw_values[n].value, sizeof(in));
400 memcpy(&in, buf, sizeof(in));
402 if (!TEST_true(OSSL_PARAM_set_time_t(¶m, in)))
404 le_copy(cmp, &out, sizeof(out));
405 if (!TEST_mem_eq(cmp, len, raw_values[n].value, len))
408 if (!TEST_true(OSSL_PARAM_get_time_t(¶m, &in)))
410 le_copy(cmp, &in, sizeof(in));
411 if (!TEST_mem_eq(cmp, sizeof(in), raw_values[n].value, sizeof(in)))
414 return test_param_type_extra(¶m, raw_values[n].value, sizeof(size_t));
417 static int test_param_bignum(int n)
419 unsigned char buf[MAX_LEN], bnbuf[MAX_LEN];
420 const size_t len = raw_values[n].len;
421 BIGNUM *b = NULL, *c = NULL;
422 OSSL_PARAM param = OSSL_PARAM_DEFN("bn", OSSL_PARAM_UNSIGNED_INTEGER,
427 param.data_size = len;
429 le_copy(buf, raw_values[n].value, len);
430 if (!TEST_ptr(b = BN_lebin2bn(raw_values[n].value, (int)len, NULL)))
433 if (!TEST_true(OSSL_PARAM_set_BN(¶m, b))
434 || !TEST_mem_eq(bnbuf, param.return_size, buf, param.return_size))
436 param.data_size = param.return_size;
437 if (!TEST_true(OSSL_PARAM_get_BN(¶m, &c))
438 || !TEST_BN_eq(b, c))
448 static int test_param_real(void)
451 OSSL_PARAM param = OSSL_PARAM_double("r", NULL);
454 return TEST_true(OSSL_PARAM_set_double(¶m, 3.14159))
455 && TEST_double_eq(p, 3.14159);
458 static int test_param_construct(void)
460 static const char *int_names[] = {
461 "int", "long", "int32", "int64"
463 static const char *uint_names[] = {
464 "uint", "ulong", "uint32", "uint64", "size_t"
466 static const unsigned char bn_val[16] = {
467 0xac, 0x75, 0x22, 0x7d, 0x81, 0x06, 0x7a, 0x23,
468 0xa6, 0xed, 0x87, 0xc7, 0xab, 0xf4, 0x73, 0x22
470 OSSL_PARAM params[20];
471 char buf[100], buf2[100], *bufp, *bufp2;
472 unsigned char ubuf[100];
473 void *vp, *vpn = NULL, *vp2;
475 int i, n = 0, ret = 0;
478 unsigned long int ul;
485 BIGNUM *bn = NULL, *bn2 = NULL;
487 params[n++] = OSSL_PARAM_construct_int("int", &i);
488 params[n++] = OSSL_PARAM_construct_uint("uint", &u);
489 params[n++] = OSSL_PARAM_construct_long("long", &l);
490 params[n++] = OSSL_PARAM_construct_ulong("ulong", &ul);
491 params[n++] = OSSL_PARAM_construct_int32("int32", &i32);
492 params[n++] = OSSL_PARAM_construct_int64("int64", &i64);
493 params[n++] = OSSL_PARAM_construct_uint32("uint32", &u32);
494 params[n++] = OSSL_PARAM_construct_uint64("uint64", &u64);
495 params[n++] = OSSL_PARAM_construct_size_t("size_t", &s);
496 params[n++] = OSSL_PARAM_construct_double("double", &d);
497 params[n++] = OSSL_PARAM_construct_BN("bignum", ubuf, sizeof(ubuf));
498 params[n++] = OSSL_PARAM_construct_utf8_string("utf8str", buf, sizeof(buf));
499 params[n++] = OSSL_PARAM_construct_octet_string("octstr", buf, sizeof(buf));
500 params[n++] = OSSL_PARAM_construct_utf8_ptr("utf8ptr", &bufp, 0);
501 params[n++] = OSSL_PARAM_construct_octet_ptr("octptr", &vp, 0);
502 params[n] = OSSL_PARAM_construct_end();
505 if (!TEST_ptr_null(OSSL_PARAM_locate(params, "fnord")))
508 /* All signed integral types */
509 for (j = 0; j < OSSL_NELEM(int_names); j++) {
510 if (!TEST_ptr(cp = OSSL_PARAM_locate(params, int_names[j]))
511 || !TEST_true(OSSL_PARAM_set_int32(cp, (int32_t)(3 + j)))
512 || !TEST_true(OSSL_PARAM_get_int64(cp, &i64))
513 || !TEST_size_t_eq(cp->data_size, cp->return_size)
514 || !TEST_size_t_eq((size_t)i64, 3 + j)) {
515 TEST_note("iteration %zu var %s", j + 1, int_names[j]);
519 /* All unsigned integral types */
520 for (j = 0; j < OSSL_NELEM(uint_names); j++) {
521 if (!TEST_ptr(cp = OSSL_PARAM_locate(params, uint_names[j]))
522 || !TEST_true(OSSL_PARAM_set_uint32(cp, (uint32_t)(3 + j)))
523 || !TEST_true(OSSL_PARAM_get_uint64(cp, &u64))
524 || !TEST_size_t_eq(cp->data_size, cp->return_size)
525 || !TEST_size_t_eq((size_t)u64, 3 + j)) {
526 TEST_note("iteration %zu var %s", j + 1, uint_names[j]);
531 if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "double"))
532 || !TEST_true(OSSL_PARAM_set_double(cp, 3.14))
533 || !TEST_true(OSSL_PARAM_get_double(cp, &d2))
534 || !TEST_size_t_eq(cp->return_size, sizeof(double))
535 || !TEST_double_eq(d, d2))
539 if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8str"))
540 || !TEST_true(OSSL_PARAM_set_utf8_string(cp, "abcdef"))
541 || !TEST_size_t_eq(cp->return_size, sizeof("abcdef") - 1)
542 || !TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, 0))
543 || !TEST_str_eq(bufp, "abcdef"))
547 if (!TEST_true(OSSL_PARAM_get_utf8_string(cp, &bufp, sizeof(buf2)))
548 || !TEST_str_eq(buf2, "abcdef"))
551 /* Note that the size of a UTF8 string does *NOT* include the NUL byte */
553 if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "utf8ptr"))
554 || !TEST_true(OSSL_PARAM_set_utf8_ptr(cp, "tuvwxyz"))
555 || !TEST_size_t_eq(cp->return_size, sizeof("tuvwxyz") - 1)
556 || !TEST_str_eq(bufp, "tuvwxyz")
557 || !TEST_true(OSSL_PARAM_get_utf8_ptr(cp, (const char **)&bufp2))
558 || !TEST_ptr_eq(bufp2, bufp))
561 if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octstr"))
562 || !TEST_true(OSSL_PARAM_set_octet_string(cp, "abcdefghi",
563 sizeof("abcdefghi")))
564 || !TEST_size_t_eq(cp->return_size, sizeof("abcdefghi")))
566 /* Match the return size to avoid trailing garbage bytes */
567 cp->data_size = cp->return_size;
568 if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vpn, 0, &s))
569 || !TEST_size_t_eq(s, sizeof("abcdefghi"))
570 || !TEST_mem_eq(vpn, sizeof("abcdefghi"),
571 "abcdefghi", sizeof("abcdefghi")))
574 if (!TEST_true(OSSL_PARAM_get_octet_string(cp, &vp, sizeof(buf2), &s))
575 || !TEST_size_t_eq(s, sizeof("abcdefghi"))
576 || !TEST_mem_eq(vp, sizeof("abcdefghi"),
577 "abcdefghi", sizeof("abcdefghi")))
581 if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "octptr"))
582 || !TEST_true(OSSL_PARAM_set_octet_ptr(cp, &ul, sizeof(ul)))
583 || !TEST_size_t_eq(cp->return_size, sizeof(ul))
584 || !TEST_ptr_eq(vp, &ul))
586 /* Match the return size to avoid trailing garbage bytes */
587 cp->data_size = cp->return_size;
588 if (!TEST_true(OSSL_PARAM_get_octet_ptr(cp, (const void **)&vp2, &k))
589 || !TEST_size_t_eq(k, sizeof(ul))
590 || !TEST_ptr_eq(vp2, vp))
593 if (!TEST_ptr(cp = OSSL_PARAM_locate(params, "bignum"))
594 || !TEST_ptr(bn = BN_lebin2bn(bn_val, (int)sizeof(bn_val), NULL))
595 || !TEST_true(OSSL_PARAM_set_BN(cp, bn))
596 || !TEST_size_t_eq(cp->data_size, cp->return_size))
598 /* Match the return size to avoid trailing garbage bytes */
599 cp->data_size = cp->return_size;
600 if(!TEST_true(OSSL_PARAM_get_BN(cp, &bn2))
601 || !TEST_BN_eq(bn, bn2))
611 static int test_param_modified(void)
613 OSSL_PARAM param[3] = { OSSL_PARAM_int("a", NULL),
614 OSSL_PARAM_int("b", NULL),
620 if (!TEST_false(OSSL_PARAM_modified(param))
621 && !TEST_true(OSSL_PARAM_set_int32(param, 1234))
622 && !TEST_true(OSSL_PARAM_modified(param))
623 && !TEST_false(OSSL_PARAM_modified(param + 1))
624 && !TEST_true(OSSL_PARAM_set_int32(param + 1, 1))
625 && !TEST_true(OSSL_PARAM_modified(param + 1)))
627 OSSL_PARAM_set_all_unmodified(param);
628 if (!TEST_false(OSSL_PARAM_modified(param))
629 && !TEST_true(OSSL_PARAM_set_int32(param, 4321))
630 && !TEST_true(OSSL_PARAM_modified(param))
631 && !TEST_false(OSSL_PARAM_modified(param + 1))
632 && !TEST_true(OSSL_PARAM_set_int32(param + 1, 2))
633 && !TEST_true(OSSL_PARAM_modified(param + 1)))
638 int setup_tests(void)
640 ADD_ALL_TESTS(test_param_int, OSSL_NELEM(raw_values));
641 ADD_ALL_TESTS(test_param_long, OSSL_NELEM(raw_values));
642 ADD_ALL_TESTS(test_param_uint, OSSL_NELEM(raw_values));
643 ADD_ALL_TESTS(test_param_ulong, OSSL_NELEM(raw_values));
644 ADD_ALL_TESTS(test_param_int32, OSSL_NELEM(raw_values));
645 ADD_ALL_TESTS(test_param_uint32, OSSL_NELEM(raw_values));
646 ADD_ALL_TESTS(test_param_size_t, OSSL_NELEM(raw_values));
647 ADD_ALL_TESTS(test_param_time_t, OSSL_NELEM(raw_values));
648 ADD_ALL_TESTS(test_param_int64, OSSL_NELEM(raw_values));
649 ADD_ALL_TESTS(test_param_uint64, OSSL_NELEM(raw_values));
650 ADD_ALL_TESTS(test_param_bignum, OSSL_NELEM(raw_values));
651 ADD_TEST(test_param_real);
652 ADD_TEST(test_param_construct);
653 ADD_TEST(test_param_modified);