summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509v3/v3_ocsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3_ocsp.c')
-rw-r--r--src/lib/libcrypto/x509v3/v3_ocsp.c62
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
71static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *nonce, 71static int i2r_ocsp_crlid(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent);
72 BIO *out, int indent); 72static int i2r_ocsp_acutoff(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent);
73static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *nonce, 73static int i2r_object(X509V3_EXT_METHOD *method, void *obj, BIO *out, int indent);
74 BIO *out, int indent);
75static int i2r_object(const X509V3_EXT_METHOD *method, void *obj, BIO *out,
76 int indent);
77 74
78static void *ocsp_nonce_new(void); 75static void *ocsp_nonce_new(void);
79static int i2d_ocsp_nonce(void *a, unsigned char **pp); 76static int i2d_ocsp_nonce(void *a, unsigned char **pp);
80static void *d2i_ocsp_nonce(void *a, const unsigned char **pp, long length); 77static void *d2i_ocsp_nonce(void *a, const unsigned char **pp, long length);
81static void ocsp_nonce_free(void *a); 78static void ocsp_nonce_free(void *a);
82static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce, 79static int i2r_ocsp_nonce(X509V3_EXT_METHOD *method, void *nonce, BIO *out, int indent);
83 BIO *out, int indent);
84 80
85static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method, 81static int i2r_ocsp_nocheck(X509V3_EXT_METHOD *method, void *nocheck, BIO *out, int indent);
86 void *nocheck, BIO *out, int indent); 82static void *s2i_ocsp_nocheck(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, const char *str);
87static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, 83static int i2r_ocsp_serviceloc(X509V3_EXT_METHOD *method, void *in, BIO *bp, int ind);
88 const char *str);
89static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in,
90 BIO *bp, int ind);
91 84
92const X509V3_EXT_METHOD v3_ocsp_crlid = { 85const 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
158static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *in, BIO *bp, 151static 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
185static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *cutoff, 177static 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
194static int i2r_object(const X509V3_EXT_METHOD *method, void *oid, BIO *bp, 185static 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
245static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce, 235static 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
255static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method, void *nocheck, 244static 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
261static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, 249static 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
267static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in, 254static 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;