summaryrefslogtreecommitdiffstats
path: root/test/p_test.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-03-30 22:10:39 +0100
committerRichard Levitte <levitte@openssl.org>2019-04-03 11:42:48 +0200
commit6d872a838df78518508b5661d98da62a097317b1 (patch)
tree07f3bdedd8890c2b36393f80af98baabfa7a6c34 /test/p_test.c
parentabbc2c408385326d9c9cd60b92a6c92b945c1d96 (diff)
Add test for the provider configuration module
We reuse test/provider_internal_test.c and test/p_test.c, and get it loaded one more time via the configuration file test/provider_internal_test.conf To support different platform standards regarding module extensions, we generate test/provider_internal_test.conf Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8549)
Diffstat (limited to 'test/p_test.c')
-rw-r--r--test/p_test.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/test/p_test.c b/test/p_test.c
index 9e1ba8edb3..bf13a0a070 100644
--- a/test/p_test.c
+++ b/test/p_test.c
@@ -52,21 +52,33 @@ static int p_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[])
if (strcmp(p->key, "greeting") == 0) {
static char *opensslv = NULL;
static char *provname = NULL;
+ static char *greeting = NULL;
static OSSL_PARAM counter_request[] = {
+ /* Known libcrypto provided parameters */
{ "openssl-version", OSSL_PARAM_UTF8_PTR,
&opensslv, sizeof(&opensslv), NULL },
{ "provider-name", OSSL_PARAM_UTF8_PTR,
&provname, sizeof(&provname), NULL},
+
+ /* This might be present, if there's such a configuration */
+ { "greeting", OSSL_PARAM_UTF8_PTR,
+ &greeting, sizeof(&greeting), NULL },
+
{ NULL, 0, NULL, 0, NULL }
};
char buf[256];
size_t buf_l;
if (c_get_params(prov, counter_request)) {
- const char *versionp = *(void **)counter_request[0].data;
- const char *namep = *(void **)counter_request[1].data;
- sprintf(buf, "Hello OpenSSL %.20s, greetings from %s!",
- versionp, namep);
+ if (greeting) {
+ strcpy(buf, greeting);
+ } else {
+ const char *versionp = *(void **)counter_request[0].data;
+ const char *namep = *(void **)counter_request[1].data;
+
+ sprintf(buf, "Hello OpenSSL %.20s, greetings from %s!",
+ versionp, namep);
+ }
} else {
sprintf(buf, "Howdy stranger...");
}