Revision a87820e16bbbbb1f8a68ddaf3aa1159da886acca authored by Richard Levitte on 12 May 2020, 13:27:32 UTC, committed by Richard Levitte on 14 May 2020, 08:05:29 UTC
Verifies that #11671 is fixed Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11674)
1 parent bcb018e
provider_test.c
/*
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <stddef.h>
#include <openssl/provider.h>
#include "testutil.h"
extern OSSL_provider_init_fn PROVIDER_INIT_FUNCTION_NAME;
static char buf[256];
static OSSL_PARAM greeting_request[] = {
{ "greeting", OSSL_PARAM_UTF8_STRING, buf, sizeof(buf) },
{ NULL, 0, NULL, 0, 0 }
};
static int test_provider(const char *name)
{
OSSL_PROVIDER *prov = NULL;
const char *greeting = NULL;
char expected_greeting[256];
BIO_snprintf(expected_greeting, sizeof(expected_greeting),
"Hello OpenSSL %.20s, greetings from %s!",
OPENSSL_VERSION_STR, name);
return
TEST_ptr(prov = OSSL_PROVIDER_load(NULL, name))
&& TEST_true(OSSL_PROVIDER_get_params(prov, greeting_request))
&& TEST_ptr(greeting = greeting_request[0].data)
&& TEST_size_t_gt(greeting_request[0].data_size, 0)
&& TEST_str_eq(greeting, expected_greeting)
&& TEST_true(OSSL_PROVIDER_unload(prov));
}
static int test_builtin_provider(void)
{
const char *name = "p_test_builtin";
return
TEST_true(OSSL_PROVIDER_add_builtin(NULL, name,
PROVIDER_INIT_FUNCTION_NAME))
&& test_provider(name);
}
#ifndef NO_PROVIDER_MODULE
static int test_loaded_provider(void)
{
const char *name = "p_test";
return test_provider(name);
}
#endif
int setup_tests(void)
{
ADD_TEST(test_builtin_provider);
#ifndef NO_PROVIDER_MODULE
ADD_TEST(test_loaded_provider);
#endif
return 1;
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...