Rename OPENSSL_CTX prefix to OSSL_LIB_CTX
[openssl.git] / doc / internal / man3 / ossl_lib_ctx_get_data.pod
similarity index 62%
rename from doc/internal/man3/openssl_ctx_get_data.pod
rename to doc/internal/man3/ossl_lib_ctx_get_data.pod
index 6fd7c6336e4f9da7b3544ebef651f46dc5df18d6..a6684635c662dfd10b501044e0fe30e45b4edb32 100644 (file)
@@ -2,29 +2,29 @@
 
 =head1 NAME
 
-openssl_ctx_get_data, openssl_ctx_run_once, openssl_ctx_onfree
-- internal OPENSSL_CTX routines
+ossl_lib_ctx_get_data, ossl_lib_ctx_run_once, ossl_lib_ctx_onfree
+- internal OSSL_LIB_CTX routines
 
 =head1 SYNOPSIS
 
  #include <openssl/types.h>
  #include "internal/cryptlib.h"
 
- typedef struct openssl_ctx_method {
-     void *(*new_func)(OPENSSL_CTX *ctx);
+ typedef struct ossl_lib_ctx_method {
+     void *(*new_func)(OSSL_LIB_CTX *ctx);
      void (*free_func)(void *);
- } OPENSSL_CTX_METHOD;
+ } OSSL_LIB_CTX_METHOD;
 
- void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
-                            const OPENSSL_CTX_METHOD *meth);
+ void *ossl_lib_ctx_get_data(OSSL_LIB_CTX *ctx, int index,
+                             const OSSL_LIB_CTX_METHOD *meth);
 
- int openssl_ctx_run_once(OPENSSL_CTX *ctx, unsigned int idx,
-                          openssl_ctx_run_once_fn run_once_fn);
- int openssl_ctx_onfree(OPENSSL_CTX *ctx, openssl_ctx_onfree_fn onfreefn);
+ int ossl_lib_ctx_run_once(OSSL_LIB_CTX *ctx, unsigned int idx,
+                           ossl_lib_ctx_run_once_fn run_once_fn);
+ int ossl_lib_ctx_onfree(OSSL_LIB_CTX *ctx, ossl_lib_ctx_onfree_fn onfreefn);
 
 =head1 DESCRIPTION
 
-Internally, the OpenSSL library context B<OPENSSL_CTX> is implemented
+Internally, the OpenSSL library context B<OSSL_LIB_CTX> is implemented
 as a B<CRYPTO_EX_DATA>, which allows data from diverse parts of the
 library to be added and removed dynamically.
 Each such data item must have a corresponding CRYPTO_EX_DATA index
@@ -33,9 +33,9 @@ to identify data items. These are mapped transparently to CRYPTO_EX_DATA dynamic
 indexes internally to the implementation.
 See the example further down to see how that's done.
 
-openssl_ctx_get_data() is used to retrieve a pointer to the data in
+ossl_lib_ctx_get_data() is used to retrieve a pointer to the data in
 the library context I<ctx> associated with the given I<index>. An
-OPENSSL_CTX_METHOD must be defined and given in the I<meth> parameter. The index
+OSSL_LIB_CTX_METHOD must be defined and given in the I<meth> parameter. The index
 for it should be defined in cryptlib.h. The functions through the method are
 used to create or free items that are stored at that index whenever a library
 context is created or freed, meaning that the code that use a data item of that
@@ -44,18 +44,18 @@ index doesn't have to worry about that, just use the data available.
 Deallocation of an index happens automatically when the library
 context is freed.
 
-openssl_ctx_run_once is used to run some initialisation routine I<run_once_fn>
+ossl_lib_ctx_run_once is used to run some initialisation routine I<run_once_fn>
 exactly once per library context I<ctx> object. Each initialisation routine
 should be allocate a unique run once index in cryptlib.h.
 
 Any resources allocated via a run once initialisation routine can be cleaned up
-using openssl_ctx_onfree. This associates an "on free" routine I<onfreefn> with
+using ossl_lib_ctx_onfree. This associates an "on free" routine I<onfreefn> with
 the library context I<ctx>. When I<ctx> is freed all associated "on free"
 routines are called.
 
 =head1 RETURN VALUES
 
-openssl_ctx_get_data() returns a pointer on success, or NULL on
+ossl_lib_ctx_get_data() returns a pointer on success, or NULL on
 failure.
 
 =head1 EXAMPLES
@@ -71,7 +71,7 @@ and a destructor to an index.
      void *data;
  } FOO;
 
- static void *foo_new(OPENSSL_CTX *ctx)
+ static void *foo_new(OSSL_LIB_CTX *ctx)
  {
      FOO *ptr = OPENSSL_zalloc(sizeof(*foo));
      if (ptr != NULL)
@@ -85,9 +85,9 @@ and a destructor to an index.
 
  /*
   * Include a reference to this in the methods table in context.c 
-  * OPENSSL_CTX_FOO_INDEX should be added to internal/cryptlib.h
+  * OSSL_LIB_CTX_FOO_INDEX should be added to internal/cryptlib.h
   */
- const OPENSSL_CTX_METHOD foo_method = {
+ const OSSL_LIB_CTX_METHOD foo_method = {
      foo_new,
      foo_free
  };
@@ -99,27 +99,27 @@ To get and use the data stored in the library context, simply do this:
  /*
   * ctx is received from a caller,
   */
- FOO *data = openssl_ctx_get_data(ctx, OPENSSL_CTX_FOO_INDEX, &foo_method);
+ FOO *data = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_FOO_INDEX, &foo_method);
 
 =head2 Run Once
 
- void foo_cleanup(OPENSSL_CTX *ctx)
+ void foo_cleanup(OSSL_LIB_CTX *ctx)
  {
      /* Free foo resources associated with ctx */
  }
 
- static openssl_ctx_run_once_fn do_foo_init;
- static int do_foo_init(OPENSSL_CTX *ctx)
+ static ossl_lib_ctx_run_once_fn do_foo_init;
+ static int do_foo_init(OSSL_LIB_CTX *ctx)
  {
      /* Allocate and initialise some foo resources and associated with ctx */
-     return openssl_ctx_onfree(ctx, &foo_cleanup)
+     return ossl_lib_ctx_onfree(ctx, &foo_cleanup)
  }
 
- int foo_some_function(OPENSSL_CTX *ctx)
+ int foo_some_function(OSSL_LIB_CTX *ctx)
  {
-    if (!openssl_ctx_run_once(ctx,
-                              OPENSSL_CTX_FOO_RUN_ONCE_INDEX,
-                              do_foo_init))
+    if (!ossl_lib_ctx_run_once(ctx,
+                               OSSL_LIB_CTX_FOO_RUN_ONCE_INDEX,
+                               do_foo_init))
         return 0;
 
     /* Do some work using foo resources in ctx */
@@ -128,7 +128,7 @@ To get and use the data stored in the library context, simply do this:
 
 =head1 SEE ALSO
 
-L<OPENSSL_CTX(3)>
+L<OSSL_LIB_CTX(3)>
 
 =head1 COPYRIGHT