diff options
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3_ocsp.c')
-rw-r--r-- | src/lib/libcrypto/x509v3/v3_ocsp.c | 62 |
1 files changed, 24 insertions, 38 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_ocsp.c b/src/lib/libcrypto/x509v3/v3_ocsp.c index 0c165af314..e426ea930c 100644 --- a/src/lib/libcrypto/x509v3/v3_ocsp.c +++ b/src/lib/libcrypto/x509v3/v3_ocsp.c | |||
@@ -68,26 +68,19 @@ | |||
68 | /* OCSP extensions and a couple of CRL entry extensions | 68 | /* OCSP extensions and a couple of CRL entry extensions |
69 | */ | 69 | */ |
70 | 70 | ||
71 | static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *nonce, | 71 | static int i2r_ocsp_crlid(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent); |
72 | BIO *out, int indent); | 72 | static int i2r_ocsp_acutoff(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent); |
73 | static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *nonce, | 73 | static int i2r_object(X509V3_EXT_METHOD *method, void *obj, BIO *out, int indent); |
74 | BIO *out, int indent); | ||
75 | static int i2r_object(const X509V3_EXT_METHOD *method, void *obj, BIO *out, | ||
76 | int indent); | ||
77 | 74 | ||
78 | static void *ocsp_nonce_new(void); | 75 | static void *ocsp_nonce_new(void); |
79 | static int i2d_ocsp_nonce(void *a, unsigned char **pp); | 76 | static int i2d_ocsp_nonce(void *a, unsigned char **pp); |
80 | static void *d2i_ocsp_nonce(void *a, const unsigned char **pp, long length); | 77 | static void *d2i_ocsp_nonce(void *a, const unsigned char **pp, long length); |
81 | static void ocsp_nonce_free(void *a); | 78 | static void ocsp_nonce_free(void *a); |
82 | static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce, | 79 | static int i2r_ocsp_nonce(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent); |
83 | BIO *out, int indent); | ||
84 | 80 | ||
85 | static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method, | 81 | static int i2r_ocsp_nocheck(X509V3_EXT_METHOD *method, void *nocheck, BIO *out, int indent); |
86 | void *nocheck, BIO *out, int indent); | 82 | static void *s2i_ocsp_nocheck(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, const char *str); |
87 | static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | 83 | static int i2r_ocsp_serviceloc(X509V3_EXT_METHOD *method, void *in, BIO *bp, int ind); |
88 | const char *str); | ||
89 | static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in, | ||
90 | BIO *bp, int ind); | ||
91 | 84 | ||
92 | const X509V3_EXT_METHOD v3_ocsp_crlid = { | 85 | const X509V3_EXT_METHOD v3_ocsp_crlid = { |
93 | NID_id_pkix_OCSP_CrlID, 0, ASN1_ITEM_ref(OCSP_CRLID), | 86 | NID_id_pkix_OCSP_CrlID, 0, ASN1_ITEM_ref(OCSP_CRLID), |
@@ -155,47 +148,44 @@ const X509V3_EXT_METHOD v3_ocsp_serviceloc = { | |||
155 | NULL | 148 | NULL |
156 | }; | 149 | }; |
157 | 150 | ||
158 | static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *in, BIO *bp, | 151 | static int i2r_ocsp_crlid(X509V3_EXT_METHOD *method, void *in, BIO *bp, int ind) |
159 | int ind) | ||
160 | { | 152 | { |
161 | OCSP_CRLID *a = in; | 153 | OCSP_CRLID *a = in; |
162 | if (a->crlUrl) | 154 | if (a->crlUrl) |
163 | { | 155 | { |
164 | if (BIO_printf(bp, "%*scrlUrl: ", ind, "") <= 0) goto err; | 156 | if (!BIO_printf(bp, "%*scrlUrl: ", ind, "")) goto err; |
165 | if (!ASN1_STRING_print(bp, (ASN1_STRING*)a->crlUrl)) goto err; | 157 | if (!ASN1_STRING_print(bp, (ASN1_STRING*)a->crlUrl)) goto err; |
166 | if (BIO_write(bp, "\n", 1) <= 0) goto err; | 158 | if (!BIO_write(bp, "\n", 1)) goto err; |
167 | } | 159 | } |
168 | if (a->crlNum) | 160 | if (a->crlNum) |
169 | { | 161 | { |
170 | if (BIO_printf(bp, "%*scrlNum: ", ind, "") <= 0) goto err; | 162 | if (!BIO_printf(bp, "%*scrlNum: ", ind, "")) goto err; |
171 | if (i2a_ASN1_INTEGER(bp, a->crlNum) <= 0) goto err; | 163 | if (!i2a_ASN1_INTEGER(bp, a->crlNum)) goto err; |
172 | if (BIO_write(bp, "\n", 1) <= 0) goto err; | 164 | if (!BIO_write(bp, "\n", 1)) goto err; |
173 | } | 165 | } |
174 | if (a->crlTime) | 166 | if (a->crlTime) |
175 | { | 167 | { |
176 | if (BIO_printf(bp, "%*scrlTime: ", ind, "") <= 0) goto err; | 168 | if (!BIO_printf(bp, "%*scrlTime: ", ind, "")) goto err; |
177 | if (!ASN1_GENERALIZEDTIME_print(bp, a->crlTime)) goto err; | 169 | if (!ASN1_GENERALIZEDTIME_print(bp, a->crlTime)) goto err; |
178 | if (BIO_write(bp, "\n", 1) <= 0) goto err; | 170 | if (!BIO_write(bp, "\n", 1)) goto err; |
179 | } | 171 | } |
180 | return 1; | 172 | return 1; |
181 | err: | 173 | err: |
182 | return 0; | 174 | return 0; |
183 | } | 175 | } |
184 | 176 | ||
185 | static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *cutoff, | 177 | static int i2r_ocsp_acutoff(X509V3_EXT_METHOD *method, void *cutoff, BIO *bp, int ind) |
186 | BIO *bp, int ind) | ||
187 | { | 178 | { |
188 | if (BIO_printf(bp, "%*s", ind, "") <= 0) return 0; | 179 | if (!BIO_printf(bp, "%*s", ind, "")) return 0; |
189 | if(!ASN1_GENERALIZEDTIME_print(bp, cutoff)) return 0; | 180 | if(!ASN1_GENERALIZEDTIME_print(bp, cutoff)) return 0; |
190 | return 1; | 181 | return 1; |
191 | } | 182 | } |
192 | 183 | ||
193 | 184 | ||
194 | static int i2r_object(const X509V3_EXT_METHOD *method, void *oid, BIO *bp, | 185 | static int i2r_object(X509V3_EXT_METHOD *method, void *oid, BIO *bp, int ind) |
195 | int ind) | ||
196 | { | 186 | { |
197 | if (BIO_printf(bp, "%*s", ind, "") <= 0) return 0; | 187 | if (!BIO_printf(bp, "%*s", ind, "")) return 0; |
198 | if(i2a_ASN1_OBJECT(bp, oid) <= 0) return 0; | 188 | if(!i2a_ASN1_OBJECT(bp, oid)) return 0; |
199 | return 1; | 189 | return 1; |
200 | } | 190 | } |
201 | 191 | ||
@@ -242,8 +232,7 @@ static void ocsp_nonce_free(void *a) | |||
242 | M_ASN1_OCTET_STRING_free(a); | 232 | M_ASN1_OCTET_STRING_free(a); |
243 | } | 233 | } |
244 | 234 | ||
245 | static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce, | 235 | static int i2r_ocsp_nonce(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent) |
246 | BIO *out, int indent) | ||
247 | { | 236 | { |
248 | if(BIO_printf(out, "%*s", indent, "") <= 0) return 0; | 237 | if(BIO_printf(out, "%*s", indent, "") <= 0) return 0; |
249 | if(i2a_ASN1_STRING(out, nonce, V_ASN1_OCTET_STRING) <= 0) return 0; | 238 | if(i2a_ASN1_STRING(out, nonce, V_ASN1_OCTET_STRING) <= 0) return 0; |
@@ -252,20 +241,17 @@ static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce, | |||
252 | 241 | ||
253 | /* Nocheck is just a single NULL. Don't print anything and always set it */ | 242 | /* Nocheck is just a single NULL. Don't print anything and always set it */ |
254 | 243 | ||
255 | static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method, void *nocheck, | 244 | static int i2r_ocsp_nocheck(X509V3_EXT_METHOD *method, void *nocheck, BIO *out, int indent) |
256 | BIO *out, int indent) | ||
257 | { | 245 | { |
258 | return 1; | 246 | return 1; |
259 | } | 247 | } |
260 | 248 | ||
261 | static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | 249 | static void *s2i_ocsp_nocheck(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, const char *str) |
262 | const char *str) | ||
263 | { | 250 | { |
264 | return ASN1_NULL_new(); | 251 | return ASN1_NULL_new(); |
265 | } | 252 | } |
266 | 253 | ||
267 | static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in, | 254 | static int i2r_ocsp_serviceloc(X509V3_EXT_METHOD *method, void *in, BIO *bp, int ind) |
268 | BIO *bp, int ind) | ||
269 | { | 255 | { |
270 | int i; | 256 | int i; |
271 | OCSP_SERVICELOC *a = in; | 257 | OCSP_SERVICELOC *a = in; |