diff options
author | tedu <> | 2014-04-18 00:58:49 +0000 |
---|---|---|
committer | tedu <> | 2014-04-18 00:58:49 +0000 |
commit | a1df5b66c7ad477a535e56a504d8da47e1998cfa (patch) | |
tree | b216ca6fba673789f2c494699c4cf41d23337bfa /src/lib/libcrypto/asn1/a_i2d_fp.c | |
parent | 07f5c09b19f56c323fa22ebd5efb5a4df9f5dc4d (diff) | |
download | openbsd-a1df5b66c7ad477a535e56a504d8da47e1998cfa.tar.gz openbsd-a1df5b66c7ad477a535e56a504d8da47e1998cfa.tar.bz2 openbsd-a1df5b66c7ad477a535e56a504d8da47e1998cfa.zip |
lob a few more knf grenades in here to soften things up.
Diffstat (limited to 'src/lib/libcrypto/asn1/a_i2d_fp.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_i2d_fp.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/lib/libcrypto/asn1/a_i2d_fp.c b/src/lib/libcrypto/asn1/a_i2d_fp.c index 52bedb3f73..93e6d8351b 100644 --- a/src/lib/libcrypto/asn1/a_i2d_fp.c +++ b/src/lib/libcrypto/asn1/a_i2d_fp.c | |||
@@ -69,8 +69,7 @@ int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x) | |||
69 | BIO *b; | 69 | BIO *b; |
70 | int ret; | 70 | int ret; |
71 | 71 | ||
72 | if ((b=BIO_new(BIO_s_file())) == NULL) | 72 | if ((b=BIO_new(BIO_s_file())) == NULL) { |
73 | { | ||
74 | ASN1err(ASN1_F_ASN1_I2D_FP,ERR_R_BUF_LIB); | 73 | ASN1err(ASN1_F_ASN1_I2D_FP,ERR_R_BUF_LIB); |
75 | return(0); | 74 | return(0); |
76 | } | 75 | } |
@@ -89,8 +88,7 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x) | |||
89 | 88 | ||
90 | n=i2d(x,NULL); | 89 | n=i2d(x,NULL); |
91 | b=(char *)malloc(n); | 90 | b=(char *)malloc(n); |
92 | if (b == NULL) | 91 | if (b == NULL) { |
93 | { | ||
94 | ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE); | 92 | ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE); |
95 | return(0); | 93 | return(0); |
96 | } | 94 | } |
@@ -98,12 +96,10 @@ int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x) | |||
98 | p=(unsigned char *)b; | 96 | p=(unsigned char *)b; |
99 | i2d(x,&p); | 97 | i2d(x,&p); |
100 | 98 | ||
101 | for (;;) | 99 | for (;;) { |
102 | { | ||
103 | i=BIO_write(out,&(b[j]),n); | 100 | i=BIO_write(out,&(b[j]),n); |
104 | if (i == n) break; | 101 | if (i == n) break; |
105 | if (i <= 0) | 102 | if (i <= 0) { |
106 | { | ||
107 | ret=0; | 103 | ret=0; |
108 | break; | 104 | break; |
109 | } | 105 | } |
@@ -122,8 +118,7 @@ int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x) | |||
122 | BIO *b; | 118 | BIO *b; |
123 | int ret; | 119 | int ret; |
124 | 120 | ||
125 | if ((b=BIO_new(BIO_s_file())) == NULL) | 121 | if ((b=BIO_new(BIO_s_file())) == NULL) { |
126 | { | ||
127 | ASN1err(ASN1_F_ASN1_ITEM_I2D_FP,ERR_R_BUF_LIB); | 122 | ASN1err(ASN1_F_ASN1_ITEM_I2D_FP,ERR_R_BUF_LIB); |
128 | return(0); | 123 | return(0); |
129 | } | 124 | } |
@@ -140,18 +135,15 @@ int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x) | |||
140 | int i,j=0,n,ret=1; | 135 | int i,j=0,n,ret=1; |
141 | 136 | ||
142 | n = ASN1_item_i2d(x, &b, it); | 137 | n = ASN1_item_i2d(x, &b, it); |
143 | if (b == NULL) | 138 | if (b == NULL) { |
144 | { | ||
145 | ASN1err(ASN1_F_ASN1_ITEM_I2D_BIO,ERR_R_MALLOC_FAILURE); | 139 | ASN1err(ASN1_F_ASN1_ITEM_I2D_BIO,ERR_R_MALLOC_FAILURE); |
146 | return(0); | 140 | return(0); |
147 | } | 141 | } |
148 | 142 | ||
149 | for (;;) | 143 | for (;;) { |
150 | { | ||
151 | i=BIO_write(out,&(b[j]),n); | 144 | i=BIO_write(out,&(b[j]),n); |
152 | if (i == n) break; | 145 | if (i == n) break; |
153 | if (i <= 0) | 146 | if (i <= 0) { |
154 | { | ||
155 | ret=0; | 147 | ret=0; |
156 | break; | 148 | break; |
157 | } | 149 | } |