RSA_set_ex_data (3)
Leading comments
Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) Standard preamble: ========================================================================
NAME
RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data - add application specific data to RSA structuresSYNOPSIS
#include <openssl/rsa.h> int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int RSA_set_ex_data(RSA *r, int idx, void *arg); void *RSA_get_ex_data(RSA *r, int idx); typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, long argl, void *argp); typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int idx, long argl, void *argp); typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, int idx, long argl, void *argp);
DESCRIPTION
Several OpenSSL structures can have application specific data attached to them. This has several potential uses, it can be used to cache data associated with a structure (for example the hash of some part of the structure) or some additional data (for example a handle to the data in an external library).Since the application data can be anything at all it is passed and retrieved as a void * type.
The RSA_get_ex_new_index() function is initially called to ``register'' some new application specific data. It takes three optional function pointers which are called when the parent structure (in this case an
RSA_set_ex_data() is used to set application specific data, the data is supplied in the arg parameter and its precise meaning is up to the application.
RSA_get_ex_data() is used to retrieve application specific data. The data is returned to the application, this will be the same value as supplied to a previous RSA_set_ex_data() call.
new_func() is called when a structure is initially allocated (for example with RSA_new(). The parent structure members will not have any meaningful values at this point. This function will typically be used to allocate any application specific structure.
free_func() is called when a structure is being freed up. The dynamic parent structure members should not be accessed because they will be freed up when this function is called.
new_func() and free_func() take the same parameters. parent is a pointer to the parent
dup_func() is called when a structure is being copied. Pointers to the destination and source
RETURN VALUES
RSA_get_ex_new_index() returns a new index or -1 on failure (note 0 is a valid index value).RSA_set_ex_data() returns 1 on success or 0 on failure.
RSA_get_ex_data() returns the application data or 0 on failure. 0 may also be valid application data but currently it can only fail if given an invalid idx parameter.
new_func() and dup_func() should return 0 for failure and 1 for success.
On failure an error code can be obtained from ERR_get_error(3).
BUGS
dup_func() is currently never called.The return value of new_func() is ignored.
The new_func() function isn't very useful because no meaningful values are present in the parent