diff options
author | beck <> | 2002-05-15 02:29:21 +0000 |
---|---|---|
committer | beck <> | 2002-05-15 02:29:21 +0000 |
commit | b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch) | |
tree | fa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/asn1/t_req.c | |
parent | e471e1ea98d673597b182ea85f29e30c97cd08b5 (diff) | |
download | openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2 openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip |
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/asn1/t_req.c')
-rw-r--r-- | src/lib/libcrypto/asn1/t_req.c | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c index ea1af092db..848c29a2dd 100644 --- a/src/lib/libcrypto/asn1/t_req.c +++ b/src/lib/libcrypto/asn1/t_req.c | |||
@@ -64,7 +64,7 @@ | |||
64 | #include <openssl/x509.h> | 64 | #include <openssl/x509.h> |
65 | #include <openssl/x509v3.h> | 65 | #include <openssl/x509v3.h> |
66 | 66 | ||
67 | #ifndef NO_FP_API | 67 | #ifndef OPENSSL_NO_FP_API |
68 | int X509_REQ_print_fp(FILE *fp, X509_REQ *x) | 68 | int X509_REQ_print_fp(FILE *fp, X509_REQ *x) |
69 | { | 69 | { |
70 | BIO *b; | 70 | BIO *b; |
@@ -85,8 +85,7 @@ int X509_REQ_print_fp(FILE *fp, X509_REQ *x) | |||
85 | int X509_REQ_print(BIO *bp, X509_REQ *x) | 85 | int X509_REQ_print(BIO *bp, X509_REQ *x) |
86 | { | 86 | { |
87 | unsigned long l; | 87 | unsigned long l; |
88 | int i,n; | 88 | int i; |
89 | char *s; | ||
90 | const char *neg; | 89 | const char *neg; |
91 | X509_REQ_INFO *ri; | 90 | X509_REQ_INFO *ri; |
92 | EVP_PKEY *pkey; | 91 | EVP_PKEY *pkey; |
@@ -118,7 +117,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) | |||
118 | if (BIO_puts(bp,str) <= 0) goto err; | 117 | if (BIO_puts(bp,str) <= 0) goto err; |
119 | 118 | ||
120 | pkey=X509_REQ_get_pubkey(x); | 119 | pkey=X509_REQ_get_pubkey(x); |
121 | #ifndef NO_RSA | 120 | #ifndef OPENSSL_NO_RSA |
122 | if (pkey != NULL && pkey->type == EVP_PKEY_RSA) | 121 | if (pkey != NULL && pkey->type == EVP_PKEY_RSA) |
123 | { | 122 | { |
124 | BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","", | 123 | BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","", |
@@ -127,7 +126,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) | |||
127 | } | 126 | } |
128 | else | 127 | else |
129 | #endif | 128 | #endif |
130 | #ifndef NO_DSA | 129 | #ifndef OPENSSL_NO_DSA |
131 | if (pkey != NULL && pkey->type == EVP_PKEY_DSA) | 130 | if (pkey != NULL && pkey->type == EVP_PKEY_DSA) |
132 | { | 131 | { |
133 | BIO_printf(bp,"%12sDSA Public Key:\n",""); | 132 | BIO_printf(bp,"%12sDSA Public Key:\n",""); |
@@ -145,13 +144,10 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) | |||
145 | if (BIO_puts(bp,str) <= 0) goto err; | 144 | if (BIO_puts(bp,str) <= 0) goto err; |
146 | 145 | ||
147 | sk=x->req_info->attributes; | 146 | sk=x->req_info->attributes; |
148 | if ((sk == NULL) || (sk_X509_ATTRIBUTE_num(sk) == 0)) | 147 | if (sk_X509_ATTRIBUTE_num(sk) == 0) |
149 | { | 148 | { |
150 | if (!x->req_info->req_kludge) | 149 | sprintf(str,"%12sa0:00\n",""); |
151 | { | 150 | if (BIO_puts(bp,str) <= 0) goto err; |
152 | sprintf(str,"%12sa0:00\n",""); | ||
153 | if (BIO_puts(bp,str) <= 0) goto err; | ||
154 | } | ||
155 | } | 151 | } |
156 | else | 152 | else |
157 | { | 153 | { |
@@ -170,7 +166,13 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) | |||
170 | if (BIO_puts(bp,str) <= 0) goto err; | 166 | if (BIO_puts(bp,str) <= 0) goto err; |
171 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) | 167 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) |
172 | { | 168 | { |
173 | if (a->set) | 169 | if (a->single) |
170 | { | ||
171 | t=a->value.single; | ||
172 | type=t->type; | ||
173 | bs=t->value.bit_string; | ||
174 | } | ||
175 | else | ||
174 | { | 176 | { |
175 | ii=0; | 177 | ii=0; |
176 | count=sk_ASN1_TYPE_num(a->value.set); | 178 | count=sk_ASN1_TYPE_num(a->value.set); |
@@ -179,12 +181,6 @@ get_next: | |||
179 | type=at->type; | 181 | type=at->type; |
180 | bs=at->value.asn1_string; | 182 | bs=at->value.asn1_string; |
181 | } | 183 | } |
182 | else | ||
183 | { | ||
184 | t=a->value.single; | ||
185 | type=t->type; | ||
186 | bs=t->value.bit_string; | ||
187 | } | ||
188 | } | 184 | } |
189 | for (j=25-j; j>0; j--) | 185 | for (j=25-j; j>0; j--) |
190 | if (BIO_write(bp," ",1) != 1) goto err; | 186 | if (BIO_write(bp," ",1) != 1) goto err; |
@@ -229,24 +225,8 @@ get_next: | |||
229 | sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); | 225 | sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); |
230 | } | 226 | } |
231 | 227 | ||
232 | i=OBJ_obj2nid(x->sig_alg->algorithm); | 228 | if(!X509_signature_print(bp, x->sig_alg, x->signature)) goto err; |
233 | sprintf(str,"%4sSignature Algorithm: %s","", | ||
234 | (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)); | ||
235 | if (BIO_puts(bp,str) <= 0) goto err; | ||
236 | 229 | ||
237 | n=x->signature->length; | ||
238 | s=(char *)x->signature->data; | ||
239 | for (i=0; i<n; i++) | ||
240 | { | ||
241 | if ((i%18) == 0) | ||
242 | { | ||
243 | sprintf(str,"\n%8s",""); | ||
244 | if (BIO_puts(bp,str) <= 0) goto err; | ||
245 | } | ||
246 | sprintf(str,"%02x%s",(unsigned char)s[i],((i+1) == n)?"":":"); | ||
247 | if (BIO_puts(bp,str) <= 0) goto err; | ||
248 | } | ||
249 | if (BIO_puts(bp,"\n") <= 0) goto err; | ||
250 | return(1); | 230 | return(1); |
251 | err: | 231 | err: |
252 | X509err(X509_F_X509_REQ_PRINT,ERR_R_BUF_LIB); | 232 | X509err(X509_F_X509_REQ_PRINT,ERR_R_BUF_LIB); |