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