2 * Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include <openssl/store.h>
11 #include <openssl/ui.h>
14 typedef enum OPTION_choice {
21 static const char *infile = NULL;
23 static int test_store_open(void)
26 OSSL_STORE_CTX *sctx = NULL;
27 OSSL_STORE_SEARCH *search = NULL;
28 UI_METHOD *ui_method = NULL;
30 ret = TEST_ptr(search = OSSL_STORE_SEARCH_by_alias("nothing"))
31 && TEST_ptr(ui_method= UI_create_method("DummyUI"))
32 && TEST_ptr(sctx = OSSL_STORE_open_with_libctx(infile, NULL, NULL,
35 && TEST_false(OSSL_STORE_find(sctx, NULL))
36 && TEST_true(OSSL_STORE_find(sctx, search));
37 UI_destroy_method(ui_method);
38 OSSL_STORE_SEARCH_free(search);
39 OSSL_STORE_close(sctx);
43 static int test_store_search_by_key_fingerprint_fail(void)
46 OSSL_STORE_SEARCH *search = NULL;
48 ret = TEST_ptr_null(search = OSSL_STORE_SEARCH_by_key_fingerprint(
49 EVP_sha256(), NULL, 0));
50 OSSL_STORE_SEARCH_free(search);
54 const OPTIONS *test_get_options(void)
56 static const OPTIONS test_options[] = {
57 OPT_TEST_OPTIONS_DEFAULT_USAGE,
58 { "in", OPT_INFILE, '<', },
68 while ((o = opt_next()) != OPT_EOF) {
81 ADD_TEST(test_store_open);
82 ADD_TEST(test_store_search_by_key_fingerprint_fail);