diff options
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_prn.c')
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_prn.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_prn.c b/src/lib/libcrypto/rsa/rsa_prn.c index 2d7bcb62b0..89cf2b45b0 100644 --- a/src/lib/libcrypto/rsa/rsa_prn.c +++ b/src/lib/libcrypto/rsa/rsa_prn.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_prn.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */ | 1 | /* $OpenBSD: rsa_prn.c,v 1.4 2014/07/09 08:20:08 miod Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -61,31 +61,32 @@ | |||
| 61 | #include <openssl/rsa.h> | 61 | #include <openssl/rsa.h> |
| 62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 63 | 63 | ||
| 64 | int RSA_print_fp(FILE *fp, const RSA *x, int off) | 64 | int |
| 65 | { | 65 | RSA_print_fp(FILE *fp, const RSA *x, int off) |
| 66 | { | ||
| 66 | BIO *b; | 67 | BIO *b; |
| 67 | int ret; | 68 | int ret; |
| 68 | 69 | ||
| 69 | if ((b=BIO_new(BIO_s_file())) == NULL) | 70 | if ((b = BIO_new(BIO_s_file())) == NULL) { |
| 70 | { | 71 | RSAerr(RSA_F_RSA_PRINT_FP, ERR_R_BUF_LIB); |
| 71 | RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB); | 72 | return 0; |
| 72 | return(0); | ||
| 73 | } | ||
| 74 | BIO_set_fp(b,fp,BIO_NOCLOSE); | ||
| 75 | ret=RSA_print(b,x,off); | ||
| 76 | BIO_free(b); | ||
| 77 | return(ret); | ||
| 78 | } | 73 | } |
| 74 | BIO_set_fp(b, fp, BIO_NOCLOSE); | ||
| 75 | ret = RSA_print(b, x, off); | ||
| 76 | BIO_free(b); | ||
| 77 | return ret; | ||
| 78 | } | ||
| 79 | 79 | ||
| 80 | int RSA_print(BIO *bp, const RSA *x, int off) | 80 | int |
| 81 | { | 81 | RSA_print(BIO *bp, const RSA *x, int off) |
| 82 | { | ||
| 82 | EVP_PKEY *pk; | 83 | EVP_PKEY *pk; |
| 83 | int ret; | 84 | int ret; |
| 85 | |||
| 84 | pk = EVP_PKEY_new(); | 86 | pk = EVP_PKEY_new(); |
| 85 | if (!pk || !EVP_PKEY_set1_RSA(pk, (RSA *)x)) | 87 | if (!pk || !EVP_PKEY_set1_RSA(pk, (RSA *)x)) |
| 86 | return 0; | 88 | return 0; |
| 87 | ret = EVP_PKEY_print_private(bp, pk, off, NULL); | 89 | ret = EVP_PKEY_print_private(bp, pk, off, NULL); |
| 88 | EVP_PKEY_free(pk); | 90 | EVP_PKEY_free(pk); |
| 89 | return ret; | 91 | return ret; |
| 90 | } | 92 | } |
| 91 | |||
