1RSA_get_ex_new_index(3)             OpenSSL            RSA_get_ex_new_index(3)
2
3
4

NAME

6       RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data - add
7       application specific data to RSA structures
8

SYNOPSIS

10        #include <openssl/rsa.h>
11
12        int RSA_get_ex_new_index(long argl, void *argp,
13                       CRYPTO_EX_new *new_func,
14                       CRYPTO_EX_dup *dup_func,
15                       CRYPTO_EX_free *free_func);
16
17        int RSA_set_ex_data(RSA *r, int idx, void *arg);
18
19        void *RSA_get_ex_data(RSA *r, int idx);
20
21        typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
22                                  int idx, long argl, void *argp);
23        typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
24                                    int idx, long argl, void *argp);
25        typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
26                                  int idx, long argl, void *argp);
27

DESCRIPTION

29       Several OpenSSL structures can have application specific data attached
30       to them.  This has several potential uses, it can be used to cache data
31       associated with a structure (for example the hash of some part of the
32       structure) or some additional data (for example a handle to the data in
33       an external library).
34
35       Since the application data can be anything at all it is passed and
36       retrieved as a void * type.
37
38       The RSA_get_ex_new_index() function is initially called to "register"
39       some new application specific data. It takes three optional function
40       pointers which are called when the parent structure (in this case an
41       RSA structure) is initially created, when it is copied and when it is
42       freed up. If any or all of these function pointer arguments are not
43       used they should be set to NULL. The precise manner in which these
44       function pointers are called is described in more detail below.
45       RSA_get_ex_new_index() also takes additional long and pointer
46       parameters which will be passed to the supplied functions but which
47       otherwise have no special meaning. It returns an index which should be
48       stored (typically in a static variable) and passed used in the idx
49       parameter in the remaining functions. Each successful call to
50       RSA_get_ex_new_index() will return an index greater than any previously
51       returned, this is important because the optional functions are called
52       in order of increasing index value.
53
54       RSA_set_ex_data() is used to set application specific data, the data is
55       supplied in the arg parameter and its precise meaning is up to the
56       application.
57
58       RSA_get_ex_data() is used to retrieve application specific data. The
59       data is returned to the application, this will be the same value as
60       supplied to a previous RSA_set_ex_data() call.
61
62       new_func() is called when a structure is initially allocated (for
63       example with RSA_new(). The parent structure members will not have any
64       meaningful values at this point. This function will typically be used
65       to allocate any application specific structure.
66
67       free_func() is called when a structure is being freed up. The dynamic
68       parent structure members should not be accessed because they will be
69       freed up when this function is called.
70
71       new_func() and free_func() take the same parameters. parent is a
72       pointer to the parent RSA structure. ptr is a the application specific
73       data (this wont be of much use in new_func(). ad is a pointer to the
74       CRYPTO_EX_DATA structure from the parent RSA structure: the functions
75       CRYPTO_get_ex_data() and CRYPTO_set_ex_data() can be called to
76       manipulate it. The idx parameter is the index: this will be the same
77       value returned by RSA_get_ex_new_index() when the functions were
78       initially registered. Finally the argl and argp parameters are the
79       values originally passed to the same corresponding parameters when
80       RSA_get_ex_new_index() was called.
81
82       dup_func() is called when a structure is being copied. Pointers to the
83       destination and source CRYPTO_EX_DATA structures are passed in the to
84       and from parameters respectively. The from_d parameter is passed a
85       pointer to the source application data when the function is called,
86       when the function returns the value is copied to the destination: the
87       application can thus modify the data pointed to by from_d and have
88       different values in the source and destination.  The idx, argl and argp
89       parameters are the same as those in new_func() and free_func().
90

RETURN VALUES

92       RSA_get_ex_new_index() returns a new index or -1 on failure (note 0 is
93       a valid index value).
94
95       RSA_set_ex_data() returns 1 on success or 0 on failure.
96
97       RSA_get_ex_data() returns the application data or 0 on failure. 0 may
98       also be valid application data but currently it can only fail if given
99       an invalid idx parameter.
100
101       new_func() and dup_func() should return 0 for failure and 1 for
102       success.
103
104       On failure an error code can be obtained from ERR_get_error(3).
105

BUGS

107       dup_func() is currently never called.
108
109       The return value of new_func() is ignored.
110
111       The new_func() function isn't very useful because no meaningful values
112       are present in the parent RSA structure when it is called.
113

SEE ALSO

115       rsa(3), CRYPTO_set_ex_data(3)
116

HISTORY

118       RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() are
119       available since SSLeay 0.9.0.
120
121
122
1231.0.0e                            2006-12-06           RSA_get_ex_new_index(3)
Impressum