]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
STORE: Add missing function OSSL_STORE_LOADER_set_open_with_libctx()
authorRichard Levitte <levitte@openssl.org>
Sun, 26 Jul 2020 07:21:29 +0000 (09:21 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 24 Aug 2020 08:02:25 +0000 (10:02 +0200)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12512)

crypto/store/store_register.c
doc/man3/OSSL_STORE_LOADER.pod
doc/man3/OSSL_STORE_open.pod
include/openssl/store.h
util/libcrypto.num
util/other.syms

index 4fbf459afa565e56aa7fb7060d09fbc9e065619c..f5106f00772cc2a10e7543797a3ad43b66c83500 100644 (file)
@@ -71,6 +71,14 @@ int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader,
     return 1;
 }
 
+int OSSL_STORE_LOADER_set_open_with_libctx
+    (OSSL_STORE_LOADER *loader,
+     OSSL_STORE_open_with_libctx_fn open_with_libctx_function)
+{
+    loader->open_with_libctx = open_with_libctx_function;
+    return 1;
+}
+
 int OSSL_STORE_LOADER_set_attach(OSSL_STORE_LOADER *loader,
                                  OSSL_STORE_attach_fn attach_function)
 {
index 64b15c18c80c86d3f8325f7a02cbba733730325b..3b6c178a9b562acd10de48aa5f5ab005e31747d1 100644 (file)
@@ -4,14 +4,15 @@
 
 OSSL_STORE_LOADER, OSSL_STORE_LOADER_CTX, OSSL_STORE_LOADER_new,
 OSSL_STORE_LOADER_get0_engine, OSSL_STORE_LOADER_get0_scheme,
-OSSL_STORE_LOADER_set_open, OSSL_STORE_LOADER_set_attach,
-OSSL_STORE_LOADER_set_ctrl, OSSL_STORE_LOADER_set_expect,
-OSSL_STORE_LOADER_set_find, OSSL_STORE_LOADER_set_load,
-OSSL_STORE_LOADER_set_eof, OSSL_STORE_LOADER_set_error,
-OSSL_STORE_LOADER_set_close,
+OSSL_STORE_LOADER_set_open, OSSL_STORE_LOADER_set_open_with_libctx,
+OSSL_STORE_LOADER_set_attach, OSSL_STORE_LOADER_set_ctrl,
+OSSL_STORE_LOADER_set_expect, OSSL_STORE_LOADER_set_find,
+OSSL_STORE_LOADER_set_load, OSSL_STORE_LOADER_set_eof,
+OSSL_STORE_LOADER_set_error, OSSL_STORE_LOADER_set_close,
 OSSL_STORE_LOADER_free, OSSL_STORE_register_loader,
 OSSL_STORE_unregister_loader,
-OSSL_STORE_open_fn, OSSL_STORE_attach_fn, OSSL_STORE_ctrl_fn,
+OSSL_STORE_open_fn, OSSL_STORE_open_with_libctx_fn,
+OSSL_STORE_attach_fn, OSSL_STORE_ctrl_fn,
 OSSL_STORE_expect_fn, OSSL_STORE_find_fn,
 OSSL_STORE_load_fn, OSSL_STORE_eof_fn, OSSL_STORE_error_fn,
 OSSL_STORE_close_fn - Types and functions to manipulate, register and
@@ -36,6 +37,11 @@ unregister STORE loaders for different URI schemes
      const char *uri, const UI_METHOD *ui_method, void *ui_data);
  int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *store_loader,
                                 OSSL_STORE_open_fn store_open_function);
+ typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_with_libctx_fn)(
+     const char *uri, const UI_METHOD *ui_method, void *ui_data);
+ int OSSL_STORE_LOADER_set_open_with_libctx
+     (OSSL_STORE_LOADER *store_loader,
+      OSSL_STORE_open_with_libctx_fn store_open_with_libctx_function);
  typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_attach_fn)
      (const OSSL_STORE_LOADER *loader, BIO *bio,
       OPENSSL_CTX *libctx, const char *propq,
@@ -81,34 +87,42 @@ schemes they support.
 
 B<OSSL_STORE_LOADER> is the type to hold a loader.
 It contains a scheme and the functions needed to implement
-OSSL_STORE_open(), OSSL_STORE_load(), OSSL_STORE_eof(), OSSL_STORE_error() and
-OSSL_STORE_close() for this scheme.
+OSSL_STORE_open(), OSSL_STORE_open_with_libctx(), OSSL_STORE_load(),
+OSSL_STORE_eof(), OSSL_STORE_error() and OSSL_STORE_close() for this
+scheme.
 
 B<OSSL_STORE_LOADER_CTX> is a type template, to be defined by each loader
 using B<struct ossl_store_loader_ctx_st { ... }>.
 
-B<OSSL_STORE_open_fn>, B<OSSL_STORE_ctrl_fn>, B<OSSL_STORE_expect_fn>,
-B<OSSL_STORE_find_fn>, B<OSSL_STORE_load_fn>, B<OSSL_STORE_eof_fn>,
-and B<OSSL_STORE_close_fn>
+B<OSSL_STORE_open_fn>, B<OSSL_STORE_open_with_libctx_fn>,
+B<OSSL_STORE_ctrl_fn>, B<OSSL_STORE_expect_fn>, B<OSSL_STORE_find_fn>,
+B<OSSL_STORE_load_fn>, B<OSSL_STORE_eof_fn>, and B<OSSL_STORE_close_fn>
 are the function pointer types used within a STORE loader.
 The functions pointed at define the functionality of the given loader.
 
 =over 4
 
-=item B<OSSL_STORE_open_fn>
+=item B<OSSL_STORE_open_fn> and B<OSSL_STORE_open_with_libctx_fn>
 
-This function takes a URI and is expected to interpret it in the best
-manner possible according to the scheme the loader implements, it also
-takes a B<UI_METHOD> and associated data, to be used any time
-something needs to be prompted for.
+B<OSSL_STORE_open_with_libctx_fn> takes a URI and is expected to
+interpret it in the best manner possible according to the scheme the
+loader implements.  It also takes a B<UI_METHOD> and associated data,
+to be used any time something needs to be prompted for, as well as a
+library context I<libctx> with an associated property query I<propq>,
+to be used when fetching necessary algorithms to perform the loads.
 Furthermore, this function is expected to initialize what needs to be
-initialized, to create a private data store (B<OSSL_STORE_LOADER_CTX>, see
-above), and to return it.
+initialized, to create a private data store (B<OSSL_STORE_LOADER_CTX>,
+see above), and to return it.
 If something goes wrong, this function is expected to return NULL.
 
-=item B<OSSL_STORE_open_fn>
+B<OSSL_STORE_open_fn> does the same thing as
+B<OSSL_STORE_open_with_libctx_fn> but uses NULL for the library
+context I<libctx> and property query I<propq>.
+
+=item B<OSSL_STORE_attach_fn>
 
-This function takes a B<BIO>, otherwise works like B<OSSL_STORE_open_fn>.
+This function takes a B<BIO>, otherwise works like
+B<OSSL_STORE_open_with_libctx_fn>.
 
 =item B<OSSL_STORE_ctrl_fn>
 
@@ -200,6 +214,9 @@ OSSL_STORE_LOADER_get0_scheme() returns the scheme of the B<store_loader>.
 OSSL_STORE_LOADER_set_open() sets the opener function for the
 B<store_loader>.
 
+OSSL_STORE_LOADER_set_open_with_libctx() sets the opener with library context
+function for the I<store_loader>.
+
 OSSL_STORE_LOADER_set_attach() sets the attacher function for the
 B<store_loader>.
 
@@ -220,9 +237,10 @@ B<store_loader>.
 
 OSSL_STORE_LOADER_free() frees the given B<store_loader>.
 
-OSSL_STORE_register_loader() register the given B<store_loader> and thereby
-makes it available for use with OSSL_STORE_open(), OSSL_STORE_load(),
-OSSL_STORE_eof() and OSSL_STORE_close().
+OSSL_STORE_register_loader() register the given B<store_loader> and
+thereby makes it available for use with OSSL_STORE_open(),
+OSSL_STORE_open_with_libctx(), OSSL_STORE_load(), OSSL_STORE_eof()
+and OSSL_STORE_close().
 
 OSSL_STORE_unregister_loader() unregister the store loader for the given
 B<scheme>.
@@ -233,18 +251,20 @@ The B<file:> scheme has built in support.
 
 =head1 RETURN VALUES
 
-The functions with the types B<OSSL_STORE_open_fn>, B<OSSL_STORE_ctrl_fn>,
-B<OSSL_STORE_expect_fn>,
-B<OSSL_STORE_load_fn>, B<OSSL_STORE_eof_fn> and B<OSSL_STORE_close_fn> have the
-same return values as OSSL_STORE_open(), OSSL_STORE_ctrl(), OSSL_STORE_expect(),
+The functions with the types B<OSSL_STORE_open_fn>,
+B<OSSL_STORE_open_with_libctx_fn>, B<OSSL_STORE_ctrl_fn>,
+B<OSSL_STORE_expect_fn>, B<OSSL_STORE_load_fn>, B<OSSL_STORE_eof_fn>
+and B<OSSL_STORE_close_fn> have the same return values as OSSL_STORE_open(),
+OSSL_STORE_open_with_libctx(), OSSL_STORE_ctrl(), OSSL_STORE_expect(),
 OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close(), respectively.
 
 OSSL_STORE_LOADER_new() returns a pointer to a B<OSSL_STORE_LOADER> on success,
 or B<NULL> on failure.
 
-OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_ctrl(),
-OSSL_STORE_LOADER_set_load(), OSSL_STORE_LOADER_set_eof() and
-OSSL_STORE_LOADER_set_close() return 1 on success, or 0 on failure.
+OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_open_with_libctx(),
+OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_load(),
+OSSL_STORE_LOADER_set_eof() and OSSL_STORE_LOADER_set_close() return 1
+on success, or 0 on failure.
 
 OSSL_STORE_register_loader() returns 1 on success, or 0 on failure.
 
@@ -253,11 +273,13 @@ or B<NULL> on failure.
 
 =head1 SEE ALSO
 
-L<ossl_store(7)>, L<OSSL_STORE_open(3)>
+L<ossl_store(7)>, L<OSSL_STORE_open(3)>, L<OPENSSL_CTX(3)>
 
 =head1 HISTORY
 
-OSSL_STORE_LOADER(), OSSL_STORE_LOADER_CTX(), OSSL_STORE_LOADER_new(),
+OSSL_STORE_open_with_libctx_fn() was added in OpenSSL 3.0.
+
+B<OSSL_STORE_LOADER>, B<OSSL_STORE_LOADER_CTX>, OSSL_STORE_LOADER_new(),
 OSSL_STORE_LOADER_set0_scheme(), OSSL_STORE_LOADER_set_open(),
 OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_load(),
 OSSL_STORE_LOADER_set_eof(), OSSL_STORE_LOADER_set_close(),
index ef1a9341946ef396251a19aa3c24d4fd2abf9d2a..ee885012f8fcfce1c4a5c4d1df8c9a642b433ac7 100644 (file)
@@ -161,7 +161,7 @@ L<passphrase-encoding(7)>
 
 OSSL_STORE_open_with_libctx() was added in OpenSSL 3.0.
 
-OSSL_STORE_CTX(), OSSL_STORE_post_process_info_fn(), OSSL_STORE_open(),
+B<OSSL_STORE_CTX>, OSSL_STORE_post_process_info_fn(), OSSL_STORE_open(),
 OSSL_STORE_ctrl(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close()
 were added in OpenSSL 1.1.1.
 
index b75c79868cb3005c1f4ce8ddf3600255cb6a252c..64a36672319a69cf5c86c0d6348d6c1504c97cfe 100644 (file)
@@ -258,6 +258,9 @@ typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_with_libctx_fn)
 
 int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader,
                                OSSL_STORE_open_fn open_function);
+int OSSL_STORE_LOADER_set_open_with_libctx
+    (OSSL_STORE_LOADER *loader,
+     OSSL_STORE_open_with_libctx_fn open_with_libctx_function);
 typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_attach_fn)
     (const OSSL_STORE_LOADER *loader, BIO *bio,
      OPENSSL_CTX *libctx, const char *propq,
index 549ab0a7c7efc90c10cb5f4d617d7cfaaa6155e1..54c28ad6886c4e957cf0e3d3ab874cafacbec335 100644 (file)
@@ -5272,3 +5272,4 @@ PEM_read_bio_PUBKEY_ex                  ? 3_0_0   EXIST::FUNCTION:
 PEM_read_PUBKEY_ex                      ?      3_0_0   EXIST::FUNCTION:STDIO
 PEM_read_bio_Parameters_ex              ?      3_0_0   EXIST::FUNCTION:
 EC_GROUP_new_from_params                ?      3_0_0   EXIST::FUNCTION:EC
+OSSL_STORE_LOADER_set_open_with_libctx  ?      3_0_0   EXIST::FUNCTION:
index 97f71906dab938ae5f42b3be4e865d3a48915f49..964e09f0bdc0e988c7c4ccb2b4ece29d9000e2f3 100644 (file)
@@ -66,6 +66,7 @@ OSSL_STORE_eof_fn                       datatype
 OSSL_STORE_error_fn                     datatype
 OSSL_STORE_load_fn                      datatype
 OSSL_STORE_open_fn                      datatype
+OSSL_STORE_open_with_libctx_fn          datatype
 OSSL_STORE_post_process_info_fn         datatype
 OSSL_trace_cb                           datatype
 PROFESSION_INFO                         datatype