diff options
| author | beck <> | 1999-09-29 04:37:45 +0000 |
|---|---|---|
| committer | beck <> | 1999-09-29 04:37:45 +0000 |
| commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
| tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/ex_data.c | |
| parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
| download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip | |
OpenSSL 0.9.4 merge
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ex_data.c | 57 |
1 files changed, 22 insertions, 35 deletions
diff --git a/src/lib/libcrypto/ex_data.c b/src/lib/libcrypto/ex_data.c index c858b518ff..176574766b 100644 --- a/src/lib/libcrypto/ex_data.c +++ b/src/lib/libcrypto/ex_data.c | |||
| @@ -58,34 +58,30 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include "buffer.h" | 61 | #include <openssl/buffer.h> |
| 62 | #include "bio.h" | 62 | #include <openssl/bio.h> |
| 63 | #include "lhash.h" | 63 | #include <openssl/lhash.h> |
| 64 | #include "cryptlib.h" | 64 | #include "cryptlib.h" |
| 65 | 65 | ||
| 66 | int CRYPTO_get_ex_new_index(idx,skp,argl,argp,new_func,dup_func,free_func) | 66 | int CRYPTO_get_ex_new_index(int idx, STACK **skp, long argl, char *argp, |
| 67 | int idx; | 67 | int (*new_func)(), int (*dup_func)(), void (*free_func)()) |
| 68 | STACK **skp; | ||
| 69 | long argl; | ||
| 70 | char *argp; | ||
| 71 | int (*new_func)(); | ||
| 72 | int (*dup_func)(); | ||
| 73 | void (*free_func)(); | ||
| 74 | { | 68 | { |
| 69 | int ret= -1; | ||
| 75 | CRYPTO_EX_DATA_FUNCS *a; | 70 | CRYPTO_EX_DATA_FUNCS *a; |
| 76 | 71 | ||
| 72 | MemCheck_off(); | ||
| 77 | if (*skp == NULL) | 73 | if (*skp == NULL) |
| 78 | *skp=sk_new_null(); | 74 | *skp=sk_new_null(); |
| 79 | if (*skp == NULL) | 75 | if (*skp == NULL) |
| 80 | { | 76 | { |
| 81 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,ERR_R_MALLOC_FAILURE); | 77 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,ERR_R_MALLOC_FAILURE); |
| 82 | return(-1); | 78 | goto err; |
| 83 | } | 79 | } |
| 84 | a=(CRYPTO_EX_DATA_FUNCS *)Malloc(sizeof(CRYPTO_EX_DATA_FUNCS)); | 80 | a=(CRYPTO_EX_DATA_FUNCS *)Malloc(sizeof(CRYPTO_EX_DATA_FUNCS)); |
| 85 | if (a == NULL) | 81 | if (a == NULL) |
| 86 | { | 82 | { |
| 87 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,ERR_R_MALLOC_FAILURE); | 83 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,ERR_R_MALLOC_FAILURE); |
| 88 | return(-1); | 84 | goto err; |
| 89 | } | 85 | } |
| 90 | a->argl=argl; | 86 | a->argl=argl; |
| 91 | a->argp=argp; | 87 | a->argp=argp; |
| @@ -98,17 +94,17 @@ void (*free_func)(); | |||
| 98 | { | 94 | { |
| 99 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,ERR_R_MALLOC_FAILURE); | 95 | CRYPTOerr(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,ERR_R_MALLOC_FAILURE); |
| 100 | Free(a); | 96 | Free(a); |
| 101 | return(-1); | 97 | goto err; |
| 102 | } | 98 | } |
| 103 | } | 99 | } |
| 104 | sk_value(*skp,idx)=(char *)a; | 100 | sk_set(*skp,idx, (char *)a); |
| 101 | ret=idx; | ||
| 102 | err: | ||
| 103 | MemCheck_on(); | ||
| 105 | return(idx); | 104 | return(idx); |
| 106 | } | 105 | } |
| 107 | 106 | ||
| 108 | int CRYPTO_set_ex_data(ad,idx,val) | 107 | int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, char *val) |
| 109 | CRYPTO_EX_DATA *ad; | ||
| 110 | int idx; | ||
| 111 | char *val; | ||
| 112 | { | 108 | { |
| 113 | int i; | 109 | int i; |
| 114 | 110 | ||
| @@ -131,13 +127,11 @@ char *val; | |||
| 131 | } | 127 | } |
| 132 | i++; | 128 | i++; |
| 133 | } | 129 | } |
| 134 | sk_value(ad->sk,idx)=val; | 130 | sk_set(ad->sk,idx,val); |
| 135 | return(1); | 131 | return(1); |
| 136 | } | 132 | } |
| 137 | 133 | ||
| 138 | char *CRYPTO_get_ex_data(ad,idx) | 134 | char *CRYPTO_get_ex_data(CRYPTO_EX_DATA *ad, int idx) |
| 139 | CRYPTO_EX_DATA *ad; | ||
| 140 | int idx; | ||
| 141 | { | 135 | { |
| 142 | if (ad->sk == NULL) | 136 | if (ad->sk == NULL) |
| 143 | return(0); | 137 | return(0); |
| @@ -147,13 +141,12 @@ int idx; | |||
| 147 | return(sk_value(ad->sk,idx)); | 141 | return(sk_value(ad->sk,idx)); |
| 148 | } | 142 | } |
| 149 | 143 | ||
| 150 | /* The callback is called with the 'object', which is the origional data object | 144 | /* The callback is called with the 'object', which is the original data object |
| 151 | * being duplicated, a pointer to the | 145 | * being duplicated, a pointer to the |
| 152 | * 'new' object to be inserted, the index, and the argi/argp | 146 | * 'new' object to be inserted, the index, and the argi/argp |
| 153 | */ | 147 | */ |
| 154 | int CRYPTO_dup_ex_data(meth,to,from) | 148 | int CRYPTO_dup_ex_data(STACK *meth, CRYPTO_EX_DATA *to, |
| 155 | STACK *meth; | 149 | CRYPTO_EX_DATA *from) |
| 156 | CRYPTO_EX_DATA *to,*from; | ||
| 157 | { | 150 | { |
| 158 | int i,j,m,r; | 151 | int i,j,m,r; |
| 159 | CRYPTO_EX_DATA_FUNCS *mm; | 152 | CRYPTO_EX_DATA_FUNCS *mm; |
| @@ -179,10 +172,7 @@ CRYPTO_EX_DATA *to,*from; | |||
| 179 | } | 172 | } |
| 180 | 173 | ||
| 181 | /* Call each free callback */ | 174 | /* Call each free callback */ |
| 182 | void CRYPTO_free_ex_data(meth,obj,ad) | 175 | void CRYPTO_free_ex_data(STACK *meth, char *obj, CRYPTO_EX_DATA *ad) |
| 183 | STACK *meth; | ||
| 184 | char *obj; | ||
| 185 | CRYPTO_EX_DATA *ad; | ||
| 186 | { | 176 | { |
| 187 | CRYPTO_EX_DATA_FUNCS *m; | 177 | CRYPTO_EX_DATA_FUNCS *m; |
| 188 | char *ptr; | 178 | char *ptr; |
| @@ -208,10 +198,7 @@ CRYPTO_EX_DATA *ad; | |||
| 208 | } | 198 | } |
| 209 | } | 199 | } |
| 210 | 200 | ||
| 211 | void CRYPTO_new_ex_data(meth,obj,ad) | 201 | void CRYPTO_new_ex_data(STACK *meth, char *obj, CRYPTO_EX_DATA *ad) |
| 212 | STACK *meth; | ||
| 213 | char *obj; | ||
| 214 | CRYPTO_EX_DATA *ad; | ||
| 215 | { | 202 | { |
| 216 | CRYPTO_EX_DATA_FUNCS *m; | 203 | CRYPTO_EX_DATA_FUNCS *m; |
| 217 | char *ptr; | 204 | char *ptr; |
