diff options
author | jsing <> | 2021-12-03 16:46:50 +0000 |
---|---|---|
committer | jsing <> | 2021-12-03 16:46:50 +0000 |
commit | bd56135d9ad11bc1eb15ab9e1a278d7cdc43e626 (patch) | |
tree | 83b9735206e772a25a55c5db205cb59e19ab92c9 /src/lib/libcrypto/x509 | |
parent | 40cbc758c79bfc275f06d4fb3761a882fe316ebf (diff) | |
download | openbsd-bd56135d9ad11bc1eb15ab9e1a278d7cdc43e626.tar.gz openbsd-bd56135d9ad11bc1eb15ab9e1a278d7cdc43e626.tar.bz2 openbsd-bd56135d9ad11bc1eb15ab9e1a278d7cdc43e626.zip |
Convert {i2d,d2i}_{,EC_,DSA_,RSA_}PUBKEY{,_bio,_fp}() to templated ASN1
These functions previously used the old ASN1_{d2i,i2d}_{bio,fp}()
interfaces.
ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libcrypto/x509')
-rw-r--r-- | src/lib/libcrypto/x509/x_all.c | 98 |
1 files changed, 1 insertions, 97 deletions
diff --git a/src/lib/libcrypto/x509/x_all.c b/src/lib/libcrypto/x509/x_all.c index c06e74c915..9bcb0c3bbe 100644 --- a/src/lib/libcrypto/x509/x_all.c +++ b/src/lib/libcrypto/x509/x_all.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x_all.c,v 1.24 2021/11/01 20:53:08 tb Exp $ */ | 1 | /* $OpenBSD: x_all.c,v 1.25 2021/12/03 16:46:50 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -219,31 +219,6 @@ i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa) | |||
219 | { | 219 | { |
220 | return ASN1_item_i2d_fp(&RSAPublicKey_it, fp, rsa); | 220 | return ASN1_item_i2d_fp(&RSAPublicKey_it, fp, rsa); |
221 | } | 221 | } |
222 | |||
223 | RSA * | ||
224 | d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa) | ||
225 | { | ||
226 | return ASN1_d2i_bio_of(RSA, RSA_new, d2i_RSA_PUBKEY, bp, rsa); | ||
227 | } | ||
228 | |||
229 | int | ||
230 | i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa) | ||
231 | { | ||
232 | return ASN1_i2d_bio_of(RSA, i2d_RSA_PUBKEY, bp, rsa); | ||
233 | } | ||
234 | |||
235 | int | ||
236 | i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa) | ||
237 | { | ||
238 | return ASN1_i2d_fp((I2D_OF(void))i2d_RSA_PUBKEY, fp, rsa); | ||
239 | } | ||
240 | |||
241 | RSA * | ||
242 | d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa) | ||
243 | { | ||
244 | return ASN1_d2i_fp((void *(*)(void))RSA_new, | ||
245 | (D2I_OF(void))d2i_RSA_PUBKEY, fp, (void **)rsa); | ||
246 | } | ||
247 | #endif | 222 | #endif |
248 | 223 | ||
249 | #ifndef OPENSSL_NO_DSA | 224 | #ifndef OPENSSL_NO_DSA |
@@ -270,30 +245,6 @@ i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa) | |||
270 | { | 245 | { |
271 | return ASN1_item_i2d_fp(&DSAPrivateKey_it, fp, dsa); | 246 | return ASN1_item_i2d_fp(&DSAPrivateKey_it, fp, dsa); |
272 | } | 247 | } |
273 | |||
274 | DSA * | ||
275 | d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa) | ||
276 | { | ||
277 | return ASN1_d2i_bio_of(DSA, DSA_new, d2i_DSA_PUBKEY, bp, dsa); | ||
278 | } | ||
279 | |||
280 | int | ||
281 | i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa) | ||
282 | { | ||
283 | return ASN1_i2d_bio_of(DSA, i2d_DSA_PUBKEY, bp, dsa); | ||
284 | } | ||
285 | |||
286 | DSA * | ||
287 | d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa) | ||
288 | { | ||
289 | return ASN1_d2i_fp_of(DSA, DSA_new, d2i_DSA_PUBKEY, fp, dsa); | ||
290 | } | ||
291 | |||
292 | int | ||
293 | i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa) | ||
294 | { | ||
295 | return ASN1_i2d_fp_of(DSA, i2d_DSA_PUBKEY, fp, dsa); | ||
296 | } | ||
297 | #endif | 248 | #endif |
298 | 249 | ||
299 | #ifndef OPENSSL_NO_EC | 250 | #ifndef OPENSSL_NO_EC |
@@ -320,29 +271,6 @@ i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey) | |||
320 | { | 271 | { |
321 | return ASN1_i2d_fp_of(EC_KEY, i2d_ECPrivateKey, fp, eckey); | 272 | return ASN1_i2d_fp_of(EC_KEY, i2d_ECPrivateKey, fp, eckey); |
322 | } | 273 | } |
323 | |||
324 | EC_KEY * | ||
325 | d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey) | ||
326 | { | ||
327 | return ASN1_d2i_bio_of(EC_KEY, EC_KEY_new, d2i_EC_PUBKEY, bp, eckey); | ||
328 | } | ||
329 | |||
330 | int | ||
331 | i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *ecdsa) | ||
332 | { | ||
333 | return ASN1_i2d_bio_of(EC_KEY, i2d_EC_PUBKEY, bp, ecdsa); | ||
334 | } | ||
335 | EC_KEY * | ||
336 | d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey) | ||
337 | { | ||
338 | return ASN1_d2i_fp_of(EC_KEY, EC_KEY_new, d2i_EC_PUBKEY, fp, eckey); | ||
339 | } | ||
340 | |||
341 | int | ||
342 | i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey) | ||
343 | { | ||
344 | return ASN1_i2d_fp_of(EC_KEY, i2d_EC_PUBKEY, fp, eckey); | ||
345 | } | ||
346 | #endif | 274 | #endif |
347 | 275 | ||
348 | X509_SIG * | 276 | X509_SIG * |
@@ -423,30 +351,6 @@ i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey) | |||
423 | return ASN1_i2d_fp_of(EVP_PKEY, i2d_PrivateKey, fp, pkey); | 351 | return ASN1_i2d_fp_of(EVP_PKEY, i2d_PrivateKey, fp, pkey); |
424 | } | 352 | } |
425 | 353 | ||
426 | EVP_PKEY * | ||
427 | d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a) | ||
428 | { | ||
429 | return ASN1_d2i_bio_of(EVP_PKEY, EVP_PKEY_new, d2i_PUBKEY, bp, a); | ||
430 | } | ||
431 | |||
432 | int | ||
433 | i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey) | ||
434 | { | ||
435 | return ASN1_i2d_bio_of(EVP_PKEY, i2d_PUBKEY, bp, pkey); | ||
436 | } | ||
437 | |||
438 | int | ||
439 | i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey) | ||
440 | { | ||
441 | return ASN1_i2d_fp_of(EVP_PKEY, i2d_PUBKEY, fp, pkey); | ||
442 | } | ||
443 | |||
444 | EVP_PKEY * | ||
445 | d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a) | ||
446 | { | ||
447 | return ASN1_d2i_fp_of(EVP_PKEY, EVP_PKEY_new, d2i_PUBKEY, fp, a); | ||
448 | } | ||
449 | |||
450 | int | 354 | int |
451 | i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key) | 355 | i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key) |
452 | { | 356 | { |