diff options
author | Pauli <paul.dale@oracle.com> | 2020-03-24 05:58:57 +0100 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-03-28 03:27:20 +0100 |
commit | 110bff618b5bd3c700f2f0a290612ca642672ce6 (patch) | |
tree | 48a183a9f54b95c847f1e0222b82eaafec53da1a /test/param_build_test.c | |
parent | s_server: Properly indicate ALPN protocol mismatch (diff) | |
download | openssl-110bff618b5bd3c700f2f0a290612ca642672ce6.tar.xz openssl-110bff618b5bd3c700f2f0a290612ca642672ce6.zip |
Param builder: make the OSSL_PARAM_BLD APIs public.
The catalyst for this is the difficult of passing BNs through the other
OSSL_PARAM APIs.
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/11390)
Diffstat (limited to 'test/param_build_test.c')
-rw-r--r-- | test/param_build_test.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/test/param_build_test.c b/test/param_build_test.c index 9ac76d0115..cbb4456bd7 100644 --- a/test/param_build_test.c +++ b/test/param_build_test.c @@ -10,7 +10,7 @@ #include <string.h> #include <openssl/params.h> -#include "internal/param_build.h" +#include "openssl/param_build.h" #include "internal/nelem.h" #include "testutil.h" @@ -28,20 +28,20 @@ static int template_public_test(void) const char *cutf; int res = 0; - ossl_param_bld_init(&bld); - if (!TEST_true(ossl_param_bld_push_int(&bld, "i", -6)) - || !TEST_true(ossl_param_bld_push_long(&bld, "l", 42)) - || !TEST_true(ossl_param_bld_push_int32(&bld, "i32", 1532)) - || !TEST_true(ossl_param_bld_push_int64(&bld, "i64", -9999999)) - || !TEST_true(ossl_param_bld_push_double(&bld, "d", 1.61803398875)) + OSSL_PARAM_BLD_init(&bld); + if (!TEST_true(OSSL_PARAM_BLD_push_int(&bld, "i", -6)) + || !TEST_true(OSSL_PARAM_BLD_push_long(&bld, "l", 42)) + || !TEST_true(OSSL_PARAM_BLD_push_int32(&bld, "i32", 1532)) + || !TEST_true(OSSL_PARAM_BLD_push_int64(&bld, "i64", -9999999)) + || !TEST_true(OSSL_PARAM_BLD_push_double(&bld, "d", 1.61803398875)) || !TEST_ptr(bn = BN_new()) || !TEST_true(BN_set_word(bn, 1729)) - || !TEST_true(ossl_param_bld_push_BN(&bld, "bignumber", bn)) - || !TEST_true(ossl_param_bld_push_utf8_string(&bld, "utf8_s", "foo", + || !TEST_true(OSSL_PARAM_BLD_push_BN(&bld, "bignumber", bn)) + || !TEST_true(OSSL_PARAM_BLD_push_utf8_string(&bld, "utf8_s", "foo", sizeof("foo"))) - || !TEST_true(ossl_param_bld_push_utf8_ptr(&bld, "utf8_p", "bar-boom", + || !TEST_true(OSSL_PARAM_BLD_push_utf8_ptr(&bld, "utf8_p", "bar-boom", 0)) - || !TEST_ptr(params = ossl_param_bld_to_param(&bld)) + || !TEST_ptr(params = OSSL_PARAM_BLD_to_param(&bld)) /* Check int */ || !TEST_ptr(p = OSSL_PARAM_locate(params, "i")) || !TEST_true(OSSL_PARAM_get_int(p, &i)) @@ -95,7 +95,7 @@ static int template_public_test(void) goto err; res = 1; err: - ossl_param_bld_free(params); + OSSL_PARAM_BLD_free(params); OPENSSL_free(utf); BN_free(bn); BN_free(bn_res); @@ -116,20 +116,20 @@ static int template_private_test(void) BIGNUM *bn = NULL, *bn_res = NULL; int res = 0; - ossl_param_bld_init(&bld); - if (!TEST_true(ossl_param_bld_push_uint(&bld, "i", 6)) - || !TEST_true(ossl_param_bld_push_ulong(&bld, "l", 42)) - || !TEST_true(ossl_param_bld_push_uint32(&bld, "i32", 1532)) - || !TEST_true(ossl_param_bld_push_uint64(&bld, "i64", 9999999)) - || !TEST_true(ossl_param_bld_push_size_t(&bld, "st", 65537)) + OSSL_PARAM_BLD_init(&bld); + if (!TEST_true(OSSL_PARAM_BLD_push_uint(&bld, "i", 6)) + || !TEST_true(OSSL_PARAM_BLD_push_ulong(&bld, "l", 42)) + || !TEST_true(OSSL_PARAM_BLD_push_uint32(&bld, "i32", 1532)) + || !TEST_true(OSSL_PARAM_BLD_push_uint64(&bld, "i64", 9999999)) + || !TEST_true(OSSL_PARAM_BLD_push_size_t(&bld, "st", 65537)) || !TEST_ptr(bn = BN_secure_new()) || !TEST_true(BN_set_word(bn, 1729)) - || !TEST_true(ossl_param_bld_push_BN(&bld, "bignumber", bn)) - || !TEST_true(ossl_param_bld_push_octet_string(&bld, "oct_s", data1, + || !TEST_true(OSSL_PARAM_BLD_push_BN(&bld, "bignumber", bn)) + || !TEST_true(OSSL_PARAM_BLD_push_octet_string(&bld, "oct_s", data1, sizeof(data1))) - || !TEST_true(ossl_param_bld_push_octet_ptr(&bld, "oct_p", data2, + || !TEST_true(OSSL_PARAM_BLD_push_octet_ptr(&bld, "oct_p", data2, sizeof(data2))) - || !TEST_ptr(params = ossl_param_bld_to_param(&bld)) + || !TEST_ptr(params = OSSL_PARAM_BLD_to_param(&bld)) /* Check unsigned int */ || !TEST_ptr(p = OSSL_PARAM_locate(params, "i")) || !TEST_true(OSSL_PARAM_get_uint(p, &i)) @@ -184,7 +184,7 @@ static int template_private_test(void) goto err; res = 1; err: - ossl_param_bld_free(params); + OSSL_PARAM_BLD_free(params); BN_free(bn); BN_free(bn_res); return res; |