diff options
author | Pauli <paul.dale@oracle.com> | 2020-02-11 09:19:19 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-02-12 19:45:42 +1000 |
commit | 903f582016cdc31b3f3557c168883ccd8a4debf5 (patch) | |
tree | 9eb0f50c9c5f80fb2f5748afc9f3265bbdf0adf0 /test | |
parent | 99b9aa95c435058bd35fb3b83b885894e2247c82 (diff) | |
download | openssl-new-903f582016cdc31b3f3557c168883ccd8a4debf5.tar.gz |
Remove unused ossl_param_bld_to_param_ex() function.
The recently introduced ossl_param_bld_to_param_ex() function is only
called by the unit tests.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11053)
Diffstat (limited to 'test')
-rw-r--r-- | test/param_build_test.c | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/test/param_build_test.c b/test/param_build_test.c index 6d54946cb9..9ac76d0115 100644 --- a/test/param_build_test.c +++ b/test/param_build_test.c @@ -190,128 +190,9 @@ err: return res; } -static int template_static_params_test(int n) -{ - unsigned char data[1000], secure[500]; - OSSL_PARAM_BLD bld; - OSSL_PARAM params[20], *p; - BIGNUM *bn = NULL, *bn_r = NULL; - BIGNUM *bn0 = NULL, *bn0_r = NULL; - const size_t bn_bytes = 200; - unsigned int i; - char *utf = NULL; - int res = 0; - - ossl_param_bld_init(&bld); - if (!TEST_true(ossl_param_bld_push_uint(&bld, "i", 6)) - || !TEST_ptr(bn = (n & 1) == 0 ? BN_new() : BN_secure_new()) - || !TEST_true(BN_set_word(bn, 1337)) - || !TEST_false(ossl_param_bld_push_BN_pad(&bld, "bn", bn, 0)) - || !TEST_false(ossl_param_bld_push_BN_pad(&bld, "bn", bn, 1)) - || !TEST_true(ossl_param_bld_push_BN_pad(&bld, "bn", bn, bn_bytes)) - || !TEST_ptr(bn0 = BN_new()) - || !TEST_true(ossl_param_bld_push_BN_pad(&bld, "bn0", bn0, 0)) - || !TEST_true(ossl_param_bld_push_utf8_string(&bld, "utf8_s", "bar", - 0)) - || !TEST_ptr(ossl_param_bld_to_param_ex(&bld, params, - OSSL_NELEM(params), - data, sizeof(data), - secure, sizeof(secure))) - /* Check unsigned int */ - || !TEST_ptr(p = OSSL_PARAM_locate(params, "i")) - || !TEST_true(OSSL_PARAM_get_uint(p, &i)) - || !TEST_str_eq(p->key, "i") - || !TEST_uint_eq(p->data_type, OSSL_PARAM_UNSIGNED_INTEGER) - || !TEST_size_t_eq(p->data_size, sizeof(int)) - || !TEST_uint_eq(i, 6) - /* Check BIGNUM */ - || !TEST_ptr(p = OSSL_PARAM_locate(params, "bn")) - || !TEST_true(OSSL_PARAM_get_BN(p, &bn_r)) - || !TEST_str_eq(p->key, "bn") - || !TEST_uint_eq(p->data_type, OSSL_PARAM_UNSIGNED_INTEGER) - || !TEST_size_t_eq(p->data_size, bn_bytes) - || !TEST_uint_eq((unsigned int)BN_get_word(bn_r), 1337) - /* Check BIGNUM zero */ - || !TEST_ptr(p = OSSL_PARAM_locate(params, "bn0")) - || !TEST_true(OSSL_PARAM_get_BN(p, &bn0_r)) - || !TEST_str_eq(p->key, "bn0") - || !TEST_uint_eq(p->data_type, OSSL_PARAM_UNSIGNED_INTEGER) - || !TEST_size_t_eq(p->data_size, 0) - || !TEST_uint_eq((unsigned int)BN_get_word(bn0_r), 0) - /* Check UTF8 string */ - || !TEST_ptr(p = OSSL_PARAM_locate(params, "utf8_s")) - || !TEST_str_eq(p->data, "bar") - || !TEST_true(OSSL_PARAM_get_utf8_string(p, &utf, 0)) - || !TEST_str_eq(utf, "bar")) - goto err; - res = 1; -err: - OPENSSL_free(utf); - BN_free(bn); - BN_free(bn_r); - BN_free(bn0); - BN_free(bn0_r); - return res; -} - -static int template_static_fail_test(int n) -{ - unsigned char data[10000], secure[500]; - OSSL_PARAM_BLD bld; - OSSL_PARAM prms[20]; - BIGNUM *bn = NULL; - int res = 0; - - ossl_param_bld_init(&bld); - if (!TEST_true(ossl_param_bld_push_uint(&bld, "i", 6)) - || !TEST_ptr(bn = (n & 1) == 0 ? BN_new() : BN_secure_new()) - || !TEST_true(BN_hex2bn(&bn, "ABCDEF78901234567890ABCDEF0987987654321")) - || !TEST_true(ossl_param_bld_push_BN(&bld, "bn", bn)) - || !TEST_true(ossl_param_bld_push_utf8_string(&bld, "utf8_s", "abc", - 1000)) - /* No OSSL_PARAMS */ - || !TEST_ptr_null(ossl_param_bld_to_param_ex(&bld, NULL, 0, data, - sizeof(data), secure, - sizeof(secure))) - /* Short OSSL_PARAMS */ - || !TEST_ptr_null(ossl_param_bld_to_param_ex(&bld, prms, 2, - data, sizeof(data), - secure, sizeof(secure))) - /* No normal data */ - || !TEST_ptr_null(ossl_param_bld_to_param_ex(&bld, prms, - OSSL_NELEM(prms), - NULL, 0, secure, - sizeof(secure))) - /* Not enough normal data */ - || !TEST_ptr_null(ossl_param_bld_to_param_ex(&bld, prms, - OSSL_NELEM(prms), - data, 50, secure, - sizeof(secure)))) - goto err; - if ((n & 1) == 1) { - /* No secure data */ - if (!TEST_ptr_null(ossl_param_bld_to_param_ex(&bld, prms, - OSSL_NELEM(prms), - data, sizeof(data), - NULL, 0)) - /* Not enough secure data */ - || !TEST_ptr_null(ossl_param_bld_to_param_ex(&bld, prms, - OSSL_NELEM(prms), - data, sizeof(data), - secure, 4))) - goto err; - } - res = 1; -err: - BN_free(bn); - return res; -} - int setup_tests(void) { ADD_TEST(template_public_test); ADD_TEST(template_private_test); - ADD_ALL_TESTS(template_static_params_test, 2); - ADD_ALL_TESTS(template_static_fail_test, 2); return 1; } |