summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dsa/dsa_prn.c
diff options
context:
space:
mode:
authormiod <>2014-07-09 10:16:24 +0000
committermiod <>2014-07-09 10:16:24 +0000
commit30a9e395f6ab6a5767151ca9805a33262b3acbe0 (patch)
tree9316d73cdc8c916f7b3c4bf0de6c3ad956b5f6da /src/lib/libcrypto/dsa/dsa_prn.c
parent962b62471b32ccf7900a7f2658ec172fc691e25a (diff)
downloadopenbsd-30a9e395f6ab6a5767151ca9805a33262b3acbe0.tar.gz
openbsd-30a9e395f6ab6a5767151ca9805a33262b3acbe0.tar.bz2
openbsd-30a9e395f6ab6a5767151ca9805a33262b3acbe0.zip
KNF
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_prn.c')
-rw-r--r--src/lib/libcrypto/dsa/dsa_prn.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_prn.c b/src/lib/libcrypto/dsa/dsa_prn.c
index e730c1a092..5a7423c831 100644
--- a/src/lib/libcrypto/dsa/dsa_prn.c
+++ b/src/lib/libcrypto/dsa/dsa_prn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_prn.c,v 1.3 2014/06/12 15:49:28 deraadt Exp $ */ 1/* $OpenBSD: dsa_prn.c,v 1.4 2014/07/09 10:16:24 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,59 +61,62 @@
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/dsa.h> 62#include <openssl/dsa.h>
63 63
64int DSA_print_fp(FILE *fp, const DSA *x, int off) 64int
65 { 65DSA_print_fp(FILE *fp, const DSA *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 DSAerr(DSA_F_DSA_PRINT_FP, ERR_R_BUF_LIB);
71 DSAerr(DSA_F_DSA_PRINT_FP,ERR_R_BUF_LIB); 72 return 0;
72 return(0);
73 }
74 BIO_set_fp(b,fp,BIO_NOCLOSE);
75 ret=DSA_print(b,x,off);
76 BIO_free(b);
77 return(ret);
78 } 73 }
74 BIO_set_fp(b, fp, BIO_NOCLOSE);
75 ret = DSA_print(b, x, off);
76 BIO_free(b);
77 return ret;
78}
79 79
80int DSAparams_print_fp(FILE *fp, const DSA *x) 80int
81 { 81DSAparams_print_fp(FILE *fp, const DSA *x)
82{
82 BIO *b; 83 BIO *b;
83 int ret; 84 int ret;
84 85
85 if ((b=BIO_new(BIO_s_file())) == NULL) 86 if ((b = BIO_new(BIO_s_file())) == NULL) {
86 { 87 DSAerr(DSA_F_DSAPARAMS_PRINT_FP, ERR_R_BUF_LIB);
87 DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB); 88 return 0;
88 return(0);
89 }
90 BIO_set_fp(b,fp,BIO_NOCLOSE);
91 ret=DSAparams_print(b, x);
92 BIO_free(b);
93 return(ret);
94 } 89 }
90 BIO_set_fp(b, fp, BIO_NOCLOSE);
91 ret = DSAparams_print(b, x);
92 BIO_free(b);
93 return ret;
94}
95 95
96int DSA_print(BIO *bp, const DSA *x, int off) 96int
97 { 97DSA_print(BIO *bp, const DSA *x, int off)
98{
98 EVP_PKEY *pk; 99 EVP_PKEY *pk;
99 int ret; 100 int ret;
101
100 pk = EVP_PKEY_new(); 102 pk = EVP_PKEY_new();
101 if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x)) 103 if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
102 return 0; 104 return 0;
103 ret = EVP_PKEY_print_private(bp, pk, off, NULL); 105 ret = EVP_PKEY_print_private(bp, pk, off, NULL);
104 EVP_PKEY_free(pk); 106 EVP_PKEY_free(pk);
105 return ret; 107 return ret;
106 } 108}
107 109
108int DSAparams_print(BIO *bp, const DSA *x) 110int
109 { 111DSAparams_print(BIO *bp, const DSA *x)
112{
110 EVP_PKEY *pk; 113 EVP_PKEY *pk;
111 int ret; 114 int ret;
115
112 pk = EVP_PKEY_new(); 116 pk = EVP_PKEY_new();
113 if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x)) 117 if (!pk || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
114 return 0; 118 return 0;
115 ret = EVP_PKEY_print_params(bp, pk, 4, NULL); 119 ret = EVP_PKEY_print_params(bp, pk, 4, NULL);
116 EVP_PKEY_free(pk); 120 EVP_PKEY_free(pk);
117 return ret; 121 return ret;
118 } 122}
119