RSA_get_ex_new_index.3 revision 279265
Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is turned on, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "RSA_get_ex_new_index 3"
RSA_get_ex_new_index 3 "2015-01-08" "0.9.8zd" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data - add application specific data to RSA structures
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #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); .Ve
"DESCRIPTION"
Header "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 \f(BIRSA_get_ex_new_index() function is initially called to \*(L"register\*(R" some new application specific data. It takes three optional function pointers which are called when the parent structure (in this case an \s-1RSA\s0 structure) is initially created, when it is copied and when it is freed up. If any or all of these function pointer arguments are not used they should be set to \s-1NULL.\s0 The precise manner in which these function pointers are called is described in more detail below. \f(BIRSA_get_ex_new_index() also takes additional long and pointer parameters which will be passed to the supplied functions but which otherwise have no special meaning. It returns an index which should be stored (typically in a static variable) and passed used in the idx parameter in the remaining functions. Each successful call to \f(BIRSA_get_ex_new_index() will return an index greater than any previously returned, this is important because the optional functions are called in order of increasing index value.

\fB\f(BIRSA_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.

\fB\f(BIRSA_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 \f(BIRSA_set_ex_data() call.

\fB\f(BInew_func() is called when a structure is initially allocated (for example with \f(BIRSA_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.

\fB\f(BIfree_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.

\fB\f(BInew_func() and \f(BIfree_func() take the same parameters. parent is a pointer to the parent \s-1RSA\s0 structure. ptr is a the application specific data (this wont be of much use in \f(BInew_func(). ad is a pointer to the \fB\s-1CRYPTO_EX_DATA\s0 structure from the parent \s-1RSA\s0 structure: the functions \fB\f(BICRYPTO_get_ex_data() and \f(BICRYPTO_set_ex_data() can be called to manipulate it. The idx parameter is the index: this will be the same value returned by \fB\f(BIRSA_get_ex_new_index() when the functions were initially registered. Finally the argl and argp parameters are the values originally passed to the same corresponding parameters when \f(BIRSA_get_ex_new_index() was called.

\fB\f(BIdup_func() is called when a structure is being copied. Pointers to the destination and source \s-1CRYPTO_EX_DATA\s0 structures are passed in the to and \fBfrom parameters respectively. The from_d parameter is passed a pointer to the source application data when the function is called, when the function returns the value is copied to the destination: the application can thus modify the data pointed to by from_d and have different values in the source and destination. The idx, argl and argp parameters are the same as those in \f(BInew_func() and \f(BIfree_func().

"RETURN VALUES"
Header "RETURN VALUES" \fB\f(BIRSA_get_ex_new_index() returns a new index or -1 on failure (note 0 is a valid index value).

\fB\f(BIRSA_set_ex_data() returns 1 on success or 0 on failure.

\fB\f(BIRSA_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.

\fB\f(BInew_func() and \f(BIdup_func() should return 0 for failure and 1 for success.

On failure an error code can be obtained from ERR_get_error\|(3).

"BUGS"
Header "BUGS" \fB\f(BIdup_func() is currently never called.

The return value of \f(BInew_func() is ignored.

The \f(BInew_func() function isn't very useful because no meaningful values are present in the parent \s-1RSA\s0 structure when it is called.

"SEE ALSO"
Header "SEE ALSO" \fIrsa\|(3), CRYPTO_set_ex_data\|(3)
"HISTORY"
Header "HISTORY" \fIRSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() are available since SSLeay 0.9.0.