summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_prn.c
diff options
context:
space:
mode:
authormiod <>2014-07-09 08:20:08 +0000
committermiod <>2014-07-09 08:20:08 +0000
commit8cbe58f0d357b14b0ce292d336469d0554a567bc (patch)
tree07872a7ef59da8cea3b3b4a101fa3580e4d658c0 /src/lib/libcrypto/rsa/rsa_prn.c
parentbc1209e388500a20f5e75cab35d1b543ce0bbe74 (diff)
downloadopenbsd-8cbe58f0d357b14b0ce292d336469d0554a567bc.tar.gz
openbsd-8cbe58f0d357b14b0ce292d336469d0554a567bc.tar.bz2
openbsd-8cbe58f0d357b14b0ce292d336469d0554a567bc.zip
KNF
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_prn.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_prn.c33
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
64int RSA_print_fp(FILE *fp, const RSA *x, int off) 64int
65 { 65RSA_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
80int RSA_print(BIO *bp, const RSA *x, int off) 80int
81 { 81RSA_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