diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/ameth_lib.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/ameth_lib.c | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/src/lib/libcrypto/asn1/ameth_lib.c b/src/lib/libcrypto/asn1/ameth_lib.c index 228392f1e6..8f96e00c93 100644 --- a/src/lib/libcrypto/asn1/ameth_lib.c +++ b/src/lib/libcrypto/asn1/ameth_lib.c | |||
| @@ -73,7 +73,7 @@ extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; | |||
| 73 | 73 | ||
| 74 | /* Keep this sorted in type order !! */ | 74 | /* Keep this sorted in type order !! */ |
| 75 | static const EVP_PKEY_ASN1_METHOD *standard_methods[] = | 75 | static const EVP_PKEY_ASN1_METHOD *standard_methods[] = |
| 76 | { | 76 | { |
| 77 | #ifndef OPENSSL_NO_RSA | 77 | #ifndef OPENSSL_NO_RSA |
| 78 | &rsa_asn1_meths[0], | 78 | &rsa_asn1_meths[0], |
| 79 | &rsa_asn1_meths[1], | 79 | &rsa_asn1_meths[1], |
| @@ -93,7 +93,7 @@ static const EVP_PKEY_ASN1_METHOD *standard_methods[] = | |||
| 93 | #endif | 93 | #endif |
| 94 | &hmac_asn1_meth, | 94 | &hmac_asn1_meth, |
| 95 | &cmac_asn1_meth | 95 | &cmac_asn1_meth |
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | typedef int sk_cmp_fn_type(const char * const *a, const char * const *b); | 98 | typedef int sk_cmp_fn_type(const char * const *a, const char * const *b); |
| 99 | DECLARE_STACK_OF(EVP_PKEY_ASN1_METHOD) | 99 | DECLARE_STACK_OF(EVP_PKEY_ASN1_METHOD) |
| @@ -103,7 +103,7 @@ static STACK_OF(EVP_PKEY_ASN1_METHOD) *app_methods = NULL; | |||
| 103 | 103 | ||
| 104 | #ifdef TEST | 104 | #ifdef TEST |
| 105 | void main() | 105 | void main() |
| 106 | { | 106 | { |
| 107 | int i; | 107 | int i; |
| 108 | for (i = 0; | 108 | for (i = 0; |
| 109 | i < sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *); | 109 | i < sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *); |
| @@ -111,7 +111,7 @@ void main() | |||
| 111 | fprintf(stderr, "Number %d id=%d (%s)\n", i, | 111 | fprintf(stderr, "Number %d id=%d (%s)\n", i, |
| 112 | standard_methods[i]->pkey_id, | 112 | standard_methods[i]->pkey_id, |
| 113 | OBJ_nid2sn(standard_methods[i]->pkey_id)); | 113 | OBJ_nid2sn(standard_methods[i]->pkey_id)); |
| 114 | } | 114 | } |
| 115 | #endif | 115 | #endif |
| 116 | 116 | ||
| 117 | DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *, | 117 | DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *, |
| @@ -119,23 +119,23 @@ DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *, | |||
| 119 | 119 | ||
| 120 | static int ameth_cmp(const EVP_PKEY_ASN1_METHOD * const *a, | 120 | static int ameth_cmp(const EVP_PKEY_ASN1_METHOD * const *a, |
| 121 | const EVP_PKEY_ASN1_METHOD * const *b) | 121 | const EVP_PKEY_ASN1_METHOD * const *b) |
| 122 | { | 122 | { |
| 123 | return ((*a)->pkey_id - (*b)->pkey_id); | 123 | return ((*a)->pkey_id - (*b)->pkey_id); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *, | 126 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_ASN1_METHOD *, |
| 127 | const EVP_PKEY_ASN1_METHOD *, ameth); | 127 | const EVP_PKEY_ASN1_METHOD *, ameth); |
| 128 | 128 | ||
| 129 | int EVP_PKEY_asn1_get_count(void) | 129 | int EVP_PKEY_asn1_get_count(void) |
| 130 | { | 130 | { |
| 131 | int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *); | 131 | int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *); |
| 132 | if (app_methods) | 132 | if (app_methods) |
| 133 | num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods); | 133 | num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods); |
| 134 | return num; | 134 | return num; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx) | 137 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx) |
| 138 | { | 138 | { |
| 139 | int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *); | 139 | int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *); |
| 140 | if (idx < 0) | 140 | if (idx < 0) |
| 141 | return NULL; | 141 | return NULL; |
| @@ -143,27 +143,27 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx) | |||
| 143 | return standard_methods[idx]; | 143 | return standard_methods[idx]; |
| 144 | idx -= num; | 144 | idx -= num; |
| 145 | return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); | 145 | return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type) | 148 | static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type) |
| 149 | { | 149 | { |
| 150 | EVP_PKEY_ASN1_METHOD tmp; | 150 | EVP_PKEY_ASN1_METHOD tmp; |
| 151 | const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret; | 151 | const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret; |
| 152 | tmp.pkey_id = type; | 152 | tmp.pkey_id = type; |
| 153 | if (app_methods) | 153 | if (app_methods) |
| 154 | { | 154 | { |
| 155 | int idx; | 155 | int idx; |
| 156 | idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp); | 156 | idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp); |
| 157 | if (idx >= 0) | 157 | if (idx >= 0) |
| 158 | return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); | 158 | return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); |
| 159 | } | 159 | } |
| 160 | ret = OBJ_bsearch_ameth(&t, standard_methods, | 160 | ret = OBJ_bsearch_ameth(&t, standard_methods, |
| 161 | sizeof(standard_methods) | 161 | sizeof(standard_methods) |
| 162 | /sizeof(EVP_PKEY_ASN1_METHOD *)); | 162 | /sizeof(EVP_PKEY_ASN1_METHOD *)); |
| 163 | if (!ret || !*ret) | 163 | if (!ret || !*ret) |
| 164 | return NULL; | 164 | return NULL; |
| 165 | return *ret; | 165 | return *ret; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | /* Find an implementation of an ASN1 algorithm. If 'pe' is not NULL | 168 | /* Find an implementation of an ASN1 algorithm. If 'pe' is not NULL |
| 169 | * also search through engines and set *pe to a functional reference | 169 | * also search through engines and set *pe to a functional reference |
| @@ -172,47 +172,47 @@ static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type) | |||
| 172 | */ | 172 | */ |
| 173 | 173 | ||
| 174 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type) | 174 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type) |
| 175 | { | 175 | { |
| 176 | const EVP_PKEY_ASN1_METHOD *t; | 176 | const EVP_PKEY_ASN1_METHOD *t; |
| 177 | 177 | ||
| 178 | for (;;) | 178 | for (;;) |
| 179 | { | 179 | { |
| 180 | t = pkey_asn1_find(type); | 180 | t = pkey_asn1_find(type); |
| 181 | if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS)) | 181 | if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS)) |
| 182 | break; | 182 | break; |
| 183 | type = t->pkey_base_id; | 183 | type = t->pkey_base_id; |
| 184 | } | 184 | } |
| 185 | if (pe) | 185 | if (pe) |
| 186 | { | 186 | { |
| 187 | #ifndef OPENSSL_NO_ENGINE | 187 | #ifndef OPENSSL_NO_ENGINE |
| 188 | ENGINE *e; | 188 | ENGINE *e; |
| 189 | /* type will contain the final unaliased type */ | 189 | /* type will contain the final unaliased type */ |
| 190 | e = ENGINE_get_pkey_asn1_meth_engine(type); | 190 | e = ENGINE_get_pkey_asn1_meth_engine(type); |
| 191 | if (e) | 191 | if (e) |
| 192 | { | 192 | { |
| 193 | *pe = e; | 193 | *pe = e; |
| 194 | return ENGINE_get_pkey_asn1_meth(e, type); | 194 | return ENGINE_get_pkey_asn1_meth(e, type); |
| 195 | } | 195 | } |
| 196 | #endif | 196 | #endif |
| 197 | *pe = NULL; | 197 | *pe = NULL; |
| 198 | } | ||
| 199 | return t; | ||
| 200 | } | 198 | } |
| 199 | return t; | ||
| 200 | } | ||
| 201 | 201 | ||
| 202 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, | 202 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, |
| 203 | const char *str, int len) | 203 | const char *str, int len) |
| 204 | { | 204 | { |
| 205 | int i; | 205 | int i; |
| 206 | const EVP_PKEY_ASN1_METHOD *ameth; | 206 | const EVP_PKEY_ASN1_METHOD *ameth; |
| 207 | if (len == -1) | 207 | if (len == -1) |
| 208 | len = strlen(str); | 208 | len = strlen(str); |
| 209 | if (pe) | 209 | if (pe) |
| 210 | { | 210 | { |
| 211 | #ifndef OPENSSL_NO_ENGINE | 211 | #ifndef OPENSSL_NO_ENGINE |
| 212 | ENGINE *e; | 212 | ENGINE *e; |
| 213 | ameth = ENGINE_pkey_asn1_find_str(&e, str, len); | 213 | ameth = ENGINE_pkey_asn1_find_str(&e, str, len); |
| 214 | if (ameth) | 214 | if (ameth) |
| 215 | { | 215 | { |
| 216 | /* Convert structural into | 216 | /* Convert structural into |
| 217 | * functional reference | 217 | * functional reference |
| 218 | */ | 218 | */ |
| @@ -221,50 +221,50 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, | |||
| 221 | ENGINE_free(e); | 221 | ENGINE_free(e); |
| 222 | *pe = e; | 222 | *pe = e; |
| 223 | return ameth; | 223 | return ameth; |
| 224 | } | 224 | } |
| 225 | #endif | 225 | #endif |
| 226 | *pe = NULL; | 226 | *pe = NULL; |
| 227 | } | 227 | } |
| 228 | for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) | 228 | for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) |
| 229 | { | 229 | { |
| 230 | ameth = EVP_PKEY_asn1_get0(i); | 230 | ameth = EVP_PKEY_asn1_get0(i); |
| 231 | if (ameth->pkey_flags & ASN1_PKEY_ALIAS) | 231 | if (ameth->pkey_flags & ASN1_PKEY_ALIAS) |
| 232 | continue; | 232 | continue; |
| 233 | if (((int)strlen(ameth->pem_str) == len) && | 233 | if (((int)strlen(ameth->pem_str) == len) && |
| 234 | !strncasecmp(ameth->pem_str, str, len)) | 234 | !strncasecmp(ameth->pem_str, str, len)) |
| 235 | return ameth; | 235 | return ameth; |
| 236 | } | ||
| 237 | return NULL; | ||
| 238 | } | 236 | } |
| 237 | return NULL; | ||
| 238 | } | ||
| 239 | 239 | ||
| 240 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth) | 240 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth) |
| 241 | { | 241 | { |
| 242 | if (app_methods == NULL) | 242 | if (app_methods == NULL) |
| 243 | { | 243 | { |
| 244 | app_methods = sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp); | 244 | app_methods = sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp); |
| 245 | if (!app_methods) | 245 | if (!app_methods) |
| 246 | return 0; | 246 | return 0; |
| 247 | } | 247 | } |
| 248 | if (!sk_EVP_PKEY_ASN1_METHOD_push(app_methods, ameth)) | 248 | if (!sk_EVP_PKEY_ASN1_METHOD_push(app_methods, ameth)) |
| 249 | return 0; | 249 | return 0; |
| 250 | sk_EVP_PKEY_ASN1_METHOD_sort(app_methods); | 250 | sk_EVP_PKEY_ASN1_METHOD_sort(app_methods); |
| 251 | return 1; | 251 | return 1; |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | int EVP_PKEY_asn1_add_alias(int to, int from) | 254 | int EVP_PKEY_asn1_add_alias(int to, int from) |
| 255 | { | 255 | { |
| 256 | EVP_PKEY_ASN1_METHOD *ameth; | 256 | EVP_PKEY_ASN1_METHOD *ameth; |
| 257 | ameth = EVP_PKEY_asn1_new(from, ASN1_PKEY_ALIAS, NULL, NULL); | 257 | ameth = EVP_PKEY_asn1_new(from, ASN1_PKEY_ALIAS, NULL, NULL); |
| 258 | if (!ameth) | 258 | if (!ameth) |
| 259 | return 0; | 259 | return 0; |
| 260 | ameth->pkey_base_id = to; | 260 | ameth->pkey_base_id = to; |
| 261 | return EVP_PKEY_asn1_add0(ameth); | 261 | return EVP_PKEY_asn1_add0(ameth); |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags, | 264 | int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags, |
| 265 | const char **pinfo, const char **ppem_str, | 265 | const char **pinfo, const char **ppem_str, |
| 266 | const EVP_PKEY_ASN1_METHOD *ameth) | 266 | const EVP_PKEY_ASN1_METHOD *ameth) |
| 267 | { | 267 | { |
| 268 | if (!ameth) | 268 | if (!ameth) |
| 269 | return 0; | 269 | return 0; |
| 270 | if (ppkey_id) | 270 | if (ppkey_id) |
| @@ -278,16 +278,16 @@ int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags, | |||
| 278 | if (ppem_str) | 278 | if (ppem_str) |
| 279 | *ppem_str = ameth->pem_str; | 279 | *ppem_str = ameth->pem_str; |
| 280 | return 1; | 280 | return 1; |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey) | 283 | const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey) |
| 284 | { | 284 | { |
| 285 | return pkey->ameth; | 285 | return pkey->ameth; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | 288 | EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, |
| 289 | const char *pem_str, const char *info) | 289 | const char *pem_str, const char *info) |
| 290 | { | 290 | { |
| 291 | EVP_PKEY_ASN1_METHOD *ameth; | 291 | EVP_PKEY_ASN1_METHOD *ameth; |
| 292 | ameth = malloc(sizeof(EVP_PKEY_ASN1_METHOD)); | 292 | ameth = malloc(sizeof(EVP_PKEY_ASN1_METHOD)); |
| 293 | if (!ameth) | 293 | if (!ameth) |
| @@ -300,20 +300,20 @@ EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | |||
| 300 | ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC; | 300 | ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC; |
| 301 | 301 | ||
| 302 | if (info) | 302 | if (info) |
| 303 | { | 303 | { |
| 304 | ameth->info = BUF_strdup(info); | 304 | ameth->info = BUF_strdup(info); |
| 305 | if (!ameth->info) | 305 | if (!ameth->info) |
| 306 | goto err; | 306 | goto err; |
| 307 | } | 307 | } |
| 308 | else | 308 | else |
| 309 | ameth->info = NULL; | 309 | ameth->info = NULL; |
| 310 | 310 | ||
| 311 | if (pem_str) | 311 | if (pem_str) |
| 312 | { | 312 | { |
| 313 | ameth->pem_str = BUF_strdup(pem_str); | 313 | ameth->pem_str = BUF_strdup(pem_str); |
| 314 | if (!ameth->pem_str) | 314 | if (!ameth->pem_str) |
| 315 | goto err; | 315 | goto err; |
| 316 | } | 316 | } |
| 317 | else | 317 | else |
| 318 | ameth->pem_str = NULL; | 318 | ameth->pem_str = NULL; |
| 319 | 319 | ||
| @@ -352,11 +352,11 @@ EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | |||
| 352 | EVP_PKEY_asn1_free(ameth); | 352 | EVP_PKEY_asn1_free(ameth); |
| 353 | return NULL; | 353 | return NULL; |
| 354 | 354 | ||
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, | 357 | void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, |
| 358 | const EVP_PKEY_ASN1_METHOD *src) | 358 | const EVP_PKEY_ASN1_METHOD *src) |
| 359 | { | 359 | { |
| 360 | 360 | ||
| 361 | dst->pub_decode = src->pub_decode; | 361 | dst->pub_decode = src->pub_decode; |
| 362 | dst->pub_encode = src->pub_encode; | 362 | dst->pub_encode = src->pub_encode; |
| @@ -386,19 +386,19 @@ void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, | |||
| 386 | dst->item_sign = src->item_sign; | 386 | dst->item_sign = src->item_sign; |
| 387 | dst->item_verify = src->item_verify; | 387 | dst->item_verify = src->item_verify; |
| 388 | 388 | ||
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) | 391 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) |
| 392 | { | 392 | { |
| 393 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) | 393 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) |
| 394 | { | 394 | { |
| 395 | if (ameth->pem_str) | 395 | if (ameth->pem_str) |
| 396 | free(ameth->pem_str); | 396 | free(ameth->pem_str); |
| 397 | if (ameth->info) | 397 | if (ameth->info) |
| 398 | free(ameth->info); | 398 | free(ameth->info); |
| 399 | free(ameth); | 399 | free(ameth); |
| 400 | } | ||
| 401 | } | 400 | } |
| 401 | } | ||
| 402 | 402 | ||
| 403 | void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, | 403 | void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, |
| 404 | int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub), | 404 | int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub), |
| @@ -408,25 +408,25 @@ void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, | |||
| 408 | ASN1_PCTX *pctx), | 408 | ASN1_PCTX *pctx), |
| 409 | int (*pkey_size)(const EVP_PKEY *pk), | 409 | int (*pkey_size)(const EVP_PKEY *pk), |
| 410 | int (*pkey_bits)(const EVP_PKEY *pk)) | 410 | int (*pkey_bits)(const EVP_PKEY *pk)) |
| 411 | { | 411 | { |
| 412 | ameth->pub_decode = pub_decode; | 412 | ameth->pub_decode = pub_decode; |
| 413 | ameth->pub_encode = pub_encode; | 413 | ameth->pub_encode = pub_encode; |
| 414 | ameth->pub_cmp = pub_cmp; | 414 | ameth->pub_cmp = pub_cmp; |
| 415 | ameth->pub_print = pub_print; | 415 | ameth->pub_print = pub_print; |
| 416 | ameth->pkey_size = pkey_size; | 416 | ameth->pkey_size = pkey_size; |
| 417 | ameth->pkey_bits = pkey_bits; | 417 | ameth->pkey_bits = pkey_bits; |
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, | 420 | void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, |
| 421 | int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf), | 421 | int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf), |
| 422 | int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk), | 422 | int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk), |
| 423 | int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, | 423 | int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, |
| 424 | ASN1_PCTX *pctx)) | 424 | ASN1_PCTX *pctx)) |
| 425 | { | 425 | { |
| 426 | ameth->priv_decode = priv_decode; | 426 | ameth->priv_decode = priv_decode; |
| 427 | ameth->priv_encode = priv_encode; | 427 | ameth->priv_encode = priv_encode; |
| 428 | ameth->priv_print = priv_print; | 428 | ameth->priv_print = priv_print; |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, | 431 | void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, |
| 432 | int (*param_decode)(EVP_PKEY *pkey, | 432 | int (*param_decode)(EVP_PKEY *pkey, |
| @@ -437,24 +437,24 @@ void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, | |||
| 437 | int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), | 437 | int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), |
| 438 | int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, | 438 | int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, |
| 439 | ASN1_PCTX *pctx)) | 439 | ASN1_PCTX *pctx)) |
| 440 | { | 440 | { |
| 441 | ameth->param_decode = param_decode; | 441 | ameth->param_decode = param_decode; |
| 442 | ameth->param_encode = param_encode; | 442 | ameth->param_encode = param_encode; |
| 443 | ameth->param_missing = param_missing; | 443 | ameth->param_missing = param_missing; |
| 444 | ameth->param_copy = param_copy; | 444 | ameth->param_copy = param_copy; |
| 445 | ameth->param_cmp = param_cmp; | 445 | ameth->param_cmp = param_cmp; |
| 446 | ameth->param_print = param_print; | 446 | ameth->param_print = param_print; |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, | 449 | void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, |
| 450 | void (*pkey_free)(EVP_PKEY *pkey)) | 450 | void (*pkey_free)(EVP_PKEY *pkey)) |
| 451 | { | 451 | { |
| 452 | ameth->pkey_free = pkey_free; | 452 | ameth->pkey_free = pkey_free; |
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, | 455 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, |
| 456 | int (*pkey_ctrl)(EVP_PKEY *pkey, int op, | 456 | int (*pkey_ctrl)(EVP_PKEY *pkey, int op, |
| 457 | long arg1, void *arg2)) | 457 | long arg1, void *arg2)) |
| 458 | { | 458 | { |
| 459 | ameth->pkey_ctrl = pkey_ctrl; | 459 | ameth->pkey_ctrl = pkey_ctrl; |
| 460 | } | 460 | } |
