diff options
author | tedu <> | 2014-04-18 00:10:08 +0000 |
---|---|---|
committer | tedu <> | 2014-04-18 00:10:08 +0000 |
commit | 07f5c09b19f56c323fa22ebd5efb5a4df9f5dc4d (patch) | |
tree | 6327d50d69a1982f840dc68fe928ea459e2c41e0 /src/lib/libcrypto/asn1/t_req.c | |
parent | 288a9e368d9d4a72792b12a00ad69e3592d94073 (diff) | |
download | openbsd-07f5c09b19f56c323fa22ebd5efb5a4df9f5dc4d.tar.gz openbsd-07f5c09b19f56c323fa22ebd5efb5a4df9f5dc4d.tar.bz2 openbsd-07f5c09b19f56c323fa22ebd5efb5a4df9f5dc4d.zip |
putting most of the braces in the right column is the very least we can do.
Diffstat (limited to 'src/lib/libcrypto/asn1/t_req.c')
-rw-r--r-- | src/lib/libcrypto/asn1/t_req.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c index ea1794e3e0..a863543898 100644 --- a/src/lib/libcrypto/asn1/t_req.c +++ b/src/lib/libcrypto/asn1/t_req.c | |||
@@ -72,24 +72,24 @@ | |||
72 | 72 | ||
73 | #ifndef OPENSSL_NO_FP_API | 73 | #ifndef OPENSSL_NO_FP_API |
74 | int X509_REQ_print_fp(FILE *fp, X509_REQ *x) | 74 | int X509_REQ_print_fp(FILE *fp, X509_REQ *x) |
75 | { | 75 | { |
76 | BIO *b; | 76 | BIO *b; |
77 | int ret; | 77 | int ret; |
78 | 78 | ||
79 | if ((b=BIO_new(BIO_s_file())) == NULL) | 79 | if ((b=BIO_new(BIO_s_file())) == NULL) |
80 | { | 80 | { |
81 | X509err(X509_F_X509_REQ_PRINT_FP,ERR_R_BUF_LIB); | 81 | X509err(X509_F_X509_REQ_PRINT_FP,ERR_R_BUF_LIB); |
82 | return(0); | 82 | return(0); |
83 | } | 83 | } |
84 | BIO_set_fp(b,fp,BIO_NOCLOSE); | 84 | BIO_set_fp(b,fp,BIO_NOCLOSE); |
85 | ret=X509_REQ_print(b, x); | 85 | ret=X509_REQ_print(b, x); |
86 | BIO_free(b); | 86 | BIO_free(b); |
87 | return(ret); | 87 | return(ret); |
88 | } | 88 | } |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long cflag) | 91 | int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long cflag) |
92 | { | 92 | { |
93 | unsigned long l; | 93 | unsigned long l; |
94 | int i; | 94 | int i; |
95 | const char *neg; | 95 | const char *neg; |
@@ -111,20 +111,20 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
111 | 111 | ||
112 | ri=x->req_info; | 112 | ri=x->req_info; |
113 | if(!(cflag & X509_FLAG_NO_HEADER)) | 113 | if(!(cflag & X509_FLAG_NO_HEADER)) |
114 | { | 114 | { |
115 | if (BIO_write(bp,"Certificate Request:\n",21) <= 0) goto err; | 115 | if (BIO_write(bp,"Certificate Request:\n",21) <= 0) goto err; |
116 | if (BIO_write(bp," Data:\n",10) <= 0) goto err; | 116 | if (BIO_write(bp," Data:\n",10) <= 0) goto err; |
117 | } | 117 | } |
118 | if(!(cflag & X509_FLAG_NO_VERSION)) | 118 | if(!(cflag & X509_FLAG_NO_VERSION)) |
119 | { | 119 | { |
120 | neg=(ri->version->type == V_ASN1_NEG_INTEGER)?"-":""; | 120 | neg=(ri->version->type == V_ASN1_NEG_INTEGER)?"-":""; |
121 | l=0; | 121 | l=0; |
122 | for (i=0; i<ri->version->length; i++) | 122 | for (i=0; i<ri->version->length; i++) |
123 | { l<<=8; l+=ri->version->data[i]; } | 123 | { l<<=8; l+=ri->version->data[i]; } |
124 | if(BIO_printf(bp,"%8sVersion: %s%lu (%s0x%lx)\n","",neg,l,neg, | 124 | if(BIO_printf(bp,"%8sVersion: %s%lu (%s0x%lx)\n","",neg,l,neg, |
125 | l) <= 0) | 125 | l) <= 0) |
126 | goto err; | 126 | goto err; |
127 | } | 127 | } |
128 | if(!(cflag & X509_FLAG_NO_SUBJECT)) | 128 | if(!(cflag & X509_FLAG_NO_SUBJECT)) |
129 | { | 129 | { |
130 | if (BIO_printf(bp," Subject:%c",mlch) <= 0) goto err; | 130 | if (BIO_printf(bp," Subject:%c",mlch) <= 0) goto err; |
@@ -132,7 +132,7 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
132 | if (BIO_write(bp,"\n",1) <= 0) goto err; | 132 | if (BIO_write(bp,"\n",1) <= 0) goto err; |
133 | } | 133 | } |
134 | if(!(cflag & X509_FLAG_NO_PUBKEY)) | 134 | if(!(cflag & X509_FLAG_NO_PUBKEY)) |
135 | { | 135 | { |
136 | if (BIO_write(bp," Subject Public Key Info:\n",33) <= 0) | 136 | if (BIO_write(bp," Subject Public Key Info:\n",33) <= 0) |
137 | goto err; | 137 | goto err; |
138 | if (BIO_printf(bp,"%12sPublic Key Algorithm: ","") <= 0) | 138 | if (BIO_printf(bp,"%12sPublic Key Algorithm: ","") <= 0) |
@@ -144,33 +144,33 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
144 | 144 | ||
145 | pkey=X509_REQ_get_pubkey(x); | 145 | pkey=X509_REQ_get_pubkey(x); |
146 | if (pkey == NULL) | 146 | if (pkey == NULL) |
147 | { | 147 | { |
148 | BIO_printf(bp,"%12sUnable to load Public Key\n",""); | 148 | BIO_printf(bp,"%12sUnable to load Public Key\n",""); |
149 | ERR_print_errors(bp); | 149 | ERR_print_errors(bp); |
150 | } | 150 | } |
151 | else | 151 | else |
152 | { | 152 | { |
153 | EVP_PKEY_print_public(bp, pkey, 16, NULL); | 153 | EVP_PKEY_print_public(bp, pkey, 16, NULL); |
154 | EVP_PKEY_free(pkey); | 154 | EVP_PKEY_free(pkey); |
155 | } | ||
156 | } | 155 | } |
156 | } | ||
157 | 157 | ||
158 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) | 158 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) |
159 | { | 159 | { |
160 | /* may not be */ | 160 | /* may not be */ |
161 | if(BIO_printf(bp,"%8sAttributes:\n","") <= 0) | 161 | if(BIO_printf(bp,"%8sAttributes:\n","") <= 0) |
162 | goto err; | 162 | goto err; |
163 | 163 | ||
164 | sk=x->req_info->attributes; | 164 | sk=x->req_info->attributes; |
165 | if (sk_X509_ATTRIBUTE_num(sk) == 0) | 165 | if (sk_X509_ATTRIBUTE_num(sk) == 0) |
166 | { | 166 | { |
167 | if(BIO_printf(bp,"%12sa0:00\n","") <= 0) | 167 | if(BIO_printf(bp,"%12sa0:00\n","") <= 0) |
168 | goto err; | 168 | goto err; |
169 | } | 169 | } |
170 | else | 170 | else |
171 | { | 171 | { |
172 | for (i=0; i<sk_X509_ATTRIBUTE_num(sk); i++) | 172 | for (i=0; i<sk_X509_ATTRIBUTE_num(sk); i++) |
173 | { | 173 | { |
174 | ASN1_TYPE *at; | 174 | ASN1_TYPE *at; |
175 | X509_ATTRIBUTE *a; | 175 | X509_ATTRIBUTE *a; |
176 | ASN1_BIT_STRING *bs=NULL; | 176 | ASN1_BIT_STRING *bs=NULL; |
@@ -183,51 +183,51 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
183 | if(BIO_printf(bp,"%12s","") <= 0) | 183 | if(BIO_printf(bp,"%12s","") <= 0) |
184 | goto err; | 184 | goto err; |
185 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) | 185 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) |
186 | { | 186 | { |
187 | if (a->single) | 187 | if (a->single) |
188 | { | 188 | { |
189 | t=a->value.single; | 189 | t=a->value.single; |
190 | type=t->type; | 190 | type=t->type; |
191 | bs=t->value.bit_string; | 191 | bs=t->value.bit_string; |
192 | } | 192 | } |
193 | else | 193 | else |
194 | { | 194 | { |
195 | ii=0; | 195 | ii=0; |
196 | count=sk_ASN1_TYPE_num(a->value.set); | 196 | count=sk_ASN1_TYPE_num(a->value.set); |
197 | get_next: | 197 | get_next: |
198 | at=sk_ASN1_TYPE_value(a->value.set,ii); | 198 | at=sk_ASN1_TYPE_value(a->value.set,ii); |
199 | type=at->type; | 199 | type=at->type; |
200 | bs=at->value.asn1_string; | 200 | bs=at->value.asn1_string; |
201 | } | ||
202 | } | 201 | } |
202 | } | ||
203 | for (j=25-j; j>0; j--) | 203 | for (j=25-j; j>0; j--) |
204 | if (BIO_write(bp," ",1) != 1) goto err; | 204 | if (BIO_write(bp," ",1) != 1) goto err; |
205 | if (BIO_puts(bp,":") <= 0) goto err; | 205 | if (BIO_puts(bp,":") <= 0) goto err; |
206 | if ( (type == V_ASN1_PRINTABLESTRING) || | 206 | if ( (type == V_ASN1_PRINTABLESTRING) || |
207 | (type == V_ASN1_T61STRING) || | 207 | (type == V_ASN1_T61STRING) || |
208 | (type == V_ASN1_IA5STRING)) | 208 | (type == V_ASN1_IA5STRING)) |
209 | { | 209 | { |
210 | if (BIO_write(bp,(char *)bs->data,bs->length) | 210 | if (BIO_write(bp,(char *)bs->data,bs->length) |
211 | != bs->length) | 211 | != bs->length) |
212 | goto err; | 212 | goto err; |
213 | BIO_puts(bp,"\n"); | 213 | BIO_puts(bp,"\n"); |
214 | } | 214 | } |
215 | else | 215 | else |
216 | { | 216 | { |
217 | BIO_puts(bp,"unable to print attribute\n"); | 217 | BIO_puts(bp,"unable to print attribute\n"); |
218 | } | ||
219 | if (++ii < count) goto get_next; | ||
220 | } | 218 | } |
219 | if (++ii < count) goto get_next; | ||
221 | } | 220 | } |
222 | } | 221 | } |
222 | } | ||
223 | if(!(cflag & X509_FLAG_NO_EXTENSIONS)) | 223 | if(!(cflag & X509_FLAG_NO_EXTENSIONS)) |
224 | { | 224 | { |
225 | exts = X509_REQ_get_extensions(x); | 225 | exts = X509_REQ_get_extensions(x); |
226 | if(exts) | 226 | if(exts) |
227 | { | 227 | { |
228 | BIO_printf(bp,"%8sRequested Extensions:\n",""); | 228 | BIO_printf(bp,"%8sRequested Extensions:\n",""); |
229 | for (i=0; i<sk_X509_EXTENSION_num(exts); i++) | 229 | for (i=0; i<sk_X509_EXTENSION_num(exts); i++) |
230 | { | 230 | { |
231 | ASN1_OBJECT *obj; | 231 | ASN1_OBJECT *obj; |
232 | X509_EXTENSION *ex; | 232 | X509_EXTENSION *ex; |
233 | int j; | 233 | int j; |
@@ -239,28 +239,28 @@ get_next: | |||
239 | if (BIO_printf(bp,": %s\n",j?"critical":"") <= 0) | 239 | if (BIO_printf(bp,": %s\n",j?"critical":"") <= 0) |
240 | goto err; | 240 | goto err; |
241 | if(!X509V3_EXT_print(bp, ex, cflag, 16)) | 241 | if(!X509V3_EXT_print(bp, ex, cflag, 16)) |
242 | { | 242 | { |
243 | BIO_printf(bp, "%16s", ""); | 243 | BIO_printf(bp, "%16s", ""); |
244 | M_ASN1_OCTET_STRING_print(bp,ex->value); | 244 | M_ASN1_OCTET_STRING_print(bp,ex->value); |
245 | } | ||
246 | if (BIO_write(bp,"\n",1) <= 0) goto err; | ||
247 | } | 245 | } |
248 | sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); | 246 | if (BIO_write(bp,"\n",1) <= 0) goto err; |
249 | } | 247 | } |
248 | sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); | ||
250 | } | 249 | } |
250 | } | ||
251 | 251 | ||
252 | if(!(cflag & X509_FLAG_NO_SIGDUMP)) | 252 | if(!(cflag & X509_FLAG_NO_SIGDUMP)) |
253 | { | 253 | { |
254 | if(!X509_signature_print(bp, x->sig_alg, x->signature)) goto err; | 254 | if(!X509_signature_print(bp, x->sig_alg, x->signature)) goto err; |
255 | } | 255 | } |
256 | 256 | ||
257 | return(1); | 257 | return(1); |
258 | err: | 258 | err: |
259 | X509err(X509_F_X509_REQ_PRINT_EX,ERR_R_BUF_LIB); | 259 | X509err(X509_F_X509_REQ_PRINT_EX,ERR_R_BUF_LIB); |
260 | return(0); | 260 | return(0); |
261 | } | 261 | } |
262 | 262 | ||
263 | int X509_REQ_print(BIO *bp, X509_REQ *x) | 263 | int X509_REQ_print(BIO *bp, X509_REQ *x) |
264 | { | 264 | { |
265 | return X509_REQ_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT); | 265 | return X509_REQ_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT); |
266 | } | 266 | } |