Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: openssl/crypto/ocsp/ocsp_prn.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/crypto/ocsp/ocsp_lib.c ('k') | openssl/crypto/ocsp/ocsp_vfy.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* ocsp_prn.c */ 1 /* ocsp_prn.c */
2 /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL 2 /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
3 * project. */ 3 * project. */
4 4
5 /* History: 5 /* History:
6 This file was originally part of ocsp.c and was transfered to Richard 6 This file was originally part of ocsp.c and was transfered to Richard
7 Levitte from CertCo by Kathy Weinhold in mid-spring 2000 to be included 7 Levitte from CertCo by Kathy Weinhold in mid-spring 2000 to be included
8 in OpenSSL or released as a patch kit. */ 8 in OpenSSL or released as a patch kit. */
9 9
10 /* ==================================================================== 10 /* ====================================================================
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 i2a_ASN1_STRING(bp, a->issuerKeyHash, V_ASN1_OCTET_STRING); 78 i2a_ASN1_STRING(bp, a->issuerKeyHash, V_ASN1_OCTET_STRING);
79 BIO_printf(bp, "\n%*sSerial Number: ", indent, ""); 79 BIO_printf(bp, "\n%*sSerial Number: ", indent, "");
80 i2a_ASN1_INTEGER(bp, a->serialNumber); 80 i2a_ASN1_INTEGER(bp, a->serialNumber);
81 BIO_printf(bp, "\n"); 81 BIO_printf(bp, "\n");
82 return 1; 82 return 1;
83 } 83 }
84 84
85 typedef struct 85 typedef struct
86 { 86 {
87 long t; 87 long t;
88 » char *m; 88 » const char *m;
89 } OCSP_TBLSTR; 89 } OCSP_TBLSTR;
90 90
91 static char *table2string(long s, OCSP_TBLSTR *ts, int len) 91 static const char *table2string(long s, const OCSP_TBLSTR *ts, int len)
92 { 92 {
93 » OCSP_TBLSTR *p; 93 » const OCSP_TBLSTR *p;
94 for (p=ts; p < ts + len; p++) 94 for (p=ts; p < ts + len; p++)
95 if (p->t == s) 95 if (p->t == s)
96 return p->m; 96 return p->m;
97 return "(UNKNOWN)"; 97 return "(UNKNOWN)";
98 } 98 }
99 99
100 char *OCSP_response_status_str(long s) 100 const char *OCSP_response_status_str(long s)
101 { 101 {
102 » static OCSP_TBLSTR rstat_tbl[] = { 102 » static const OCSP_TBLSTR rstat_tbl[] = {
103 { OCSP_RESPONSE_STATUS_SUCCESSFUL, "successful" }, 103 { OCSP_RESPONSE_STATUS_SUCCESSFUL, "successful" },
104 { OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, "malformedrequest" }, 104 { OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, "malformedrequest" },
105 { OCSP_RESPONSE_STATUS_INTERNALERROR, "internalerror" }, 105 { OCSP_RESPONSE_STATUS_INTERNALERROR, "internalerror" },
106 { OCSP_RESPONSE_STATUS_TRYLATER, "trylater" }, 106 { OCSP_RESPONSE_STATUS_TRYLATER, "trylater" },
107 { OCSP_RESPONSE_STATUS_SIGREQUIRED, "sigrequired" }, 107 { OCSP_RESPONSE_STATUS_SIGREQUIRED, "sigrequired" },
108 { OCSP_RESPONSE_STATUS_UNAUTHORIZED, "unauthorized" } }; 108 { OCSP_RESPONSE_STATUS_UNAUTHORIZED, "unauthorized" } };
109 return table2string(s, rstat_tbl, 6); 109 return table2string(s, rstat_tbl, 6);
110 } 110 }
111 111
112 char *OCSP_cert_status_str(long s) 112 const char *OCSP_cert_status_str(long s)
113 { 113 {
114 » static OCSP_TBLSTR cstat_tbl[] = { 114 » static const OCSP_TBLSTR cstat_tbl[] = {
115 { V_OCSP_CERTSTATUS_GOOD, "good" }, 115 { V_OCSP_CERTSTATUS_GOOD, "good" },
116 { V_OCSP_CERTSTATUS_REVOKED, "revoked" }, 116 { V_OCSP_CERTSTATUS_REVOKED, "revoked" },
117 { V_OCSP_CERTSTATUS_UNKNOWN, "unknown" } }; 117 { V_OCSP_CERTSTATUS_UNKNOWN, "unknown" } };
118 return table2string(s, cstat_tbl, 3); 118 return table2string(s, cstat_tbl, 3);
119 } 119 }
120 120
121 char *OCSP_crl_reason_str(long s) 121 const char *OCSP_crl_reason_str(long s)
122 { 122 {
123 » OCSP_TBLSTR reason_tbl[] = { 123 » static const OCSP_TBLSTR reason_tbl[] = {
124 { OCSP_REVOKED_STATUS_UNSPECIFIED, "unspecified" }, 124 { OCSP_REVOKED_STATUS_UNSPECIFIED, "unspecified" },
125 { OCSP_REVOKED_STATUS_KEYCOMPROMISE, "keyCompromise" }, 125 { OCSP_REVOKED_STATUS_KEYCOMPROMISE, "keyCompromise" },
126 { OCSP_REVOKED_STATUS_CACOMPROMISE, "cACompromise" }, 126 { OCSP_REVOKED_STATUS_CACOMPROMISE, "cACompromise" },
127 { OCSP_REVOKED_STATUS_AFFILIATIONCHANGED, "affiliationChanged" }, 127 { OCSP_REVOKED_STATUS_AFFILIATIONCHANGED, "affiliationChanged" },
128 { OCSP_REVOKED_STATUS_SUPERSEDED, "superseded" }, 128 { OCSP_REVOKED_STATUS_SUPERSEDED, "superseded" },
129 { OCSP_REVOKED_STATUS_CESSATIONOFOPERATION, "cessationOfOperation" }, 129 { OCSP_REVOKED_STATUS_CESSATIONOFOPERATION, "cessationOfOperation" },
130 { OCSP_REVOKED_STATUS_CERTIFICATEHOLD, "certificateHold" }, 130 { OCSP_REVOKED_STATUS_CERTIFICATEHOLD, "certificateHold" },
131 { OCSP_REVOKED_STATUS_REMOVEFROMCRL, "removeFromCRL" } }; 131 { OCSP_REVOKED_STATUS_REMOVEFROMCRL, "removeFromCRL" } };
132 return table2string(s, reason_tbl, 8); 132 return table2string(s, reason_tbl, 8);
133 } 133 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 return 1; 176 return 1;
177 err: 177 err:
178 return 0; 178 return 0;
179 } 179 }
180 180
181 int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags) 181 int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags)
182 { 182 {
183 int i, ret = 0; 183 int i, ret = 0;
184 long l; 184 long l;
185 unsigned char *p;
186 OCSP_CERTID *cid = NULL; 185 OCSP_CERTID *cid = NULL;
187 OCSP_BASICRESP *br = NULL; 186 OCSP_BASICRESP *br = NULL;
188 OCSP_RESPID *rid = NULL; 187 OCSP_RESPID *rid = NULL;
189 OCSP_RESPDATA *rd = NULL; 188 OCSP_RESPDATA *rd = NULL;
190 OCSP_CERTSTATUS *cst = NULL; 189 OCSP_CERTSTATUS *cst = NULL;
191 OCSP_REVOKEDINFO *rev = NULL; 190 OCSP_REVOKEDINFO *rev = NULL;
192 OCSP_SINGLERESP *single = NULL; 191 OCSP_SINGLERESP *single = NULL;
193 OCSP_RESPBYTES *rb = o->responseBytes; 192 OCSP_RESPBYTES *rb = o->responseBytes;
194 193
195 if (BIO_puts(bp,"OCSP Response Data:\n") <= 0) goto err; 194 if (BIO_puts(bp,"OCSP Response Data:\n") <= 0) goto err;
196 l=ASN1_ENUMERATED_get(o->responseStatus); 195 l=ASN1_ENUMERATED_get(o->responseStatus);
197 if (BIO_printf(bp," OCSP Response Status: %s (0x%lx)\n", 196 if (BIO_printf(bp," OCSP Response Status: %s (0x%lx)\n",
198 OCSP_response_status_str(l), l) <= 0) goto err; 197 OCSP_response_status_str(l), l) <= 0) goto err;
199 if (rb == NULL) return 1; 198 if (rb == NULL) return 1;
200 if (BIO_puts(bp," Response Type: ") <= 0) 199 if (BIO_puts(bp," Response Type: ") <= 0)
201 goto err; 200 goto err;
202 if(i2a_ASN1_OBJECT(bp, rb->responseType) <= 0) 201 if(i2a_ASN1_OBJECT(bp, rb->responseType) <= 0)
203 goto err; 202 goto err;
204 if (OBJ_obj2nid(rb->responseType) != NID_id_pkix_OCSP_basic) 203 if (OBJ_obj2nid(rb->responseType) != NID_id_pkix_OCSP_basic)
205 { 204 {
206 BIO_puts(bp," (unknown response type)\n"); 205 BIO_puts(bp," (unknown response type)\n");
207 return 1; 206 return 1;
208 } 207 }
209 208
210 p = ASN1_STRING_data(rb->response);
211 i = ASN1_STRING_length(rb->response); 209 i = ASN1_STRING_length(rb->response);
212 if (!(br = OCSP_response_get1_basic(o))) goto err; 210 if (!(br = OCSP_response_get1_basic(o))) goto err;
213 rd = br->tbsResponseData; 211 rd = br->tbsResponseData;
214 l=ASN1_INTEGER_get(rd->version); 212 l=ASN1_INTEGER_get(rd->version);
215 if (BIO_printf(bp,"\n Version: %lu (0x%lx)\n", 213 if (BIO_printf(bp,"\n Version: %lu (0x%lx)\n",
216 l+1,l) <= 0) goto err; 214 l+1,l) <= 0) goto err;
217 if (BIO_puts(bp," Responder Id: ") <= 0) goto err; 215 if (BIO_puts(bp," Responder Id: ") <= 0) goto err;
218 216
219 rid = rd->responderId; 217 rid = rd->responderId;
220 switch (rid->type) 218 switch (rid->type)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 { 281 {
284 X509_print(bp, sk_X509_value(br->certs,i)); 282 X509_print(bp, sk_X509_value(br->certs,i));
285 PEM_write_bio_X509(bp,sk_X509_value(br->certs,i)); 283 PEM_write_bio_X509(bp,sk_X509_value(br->certs,i));
286 } 284 }
287 285
288 ret = 1; 286 ret = 1;
289 err: 287 err:
290 OCSP_BASICRESP_free(br); 288 OCSP_BASICRESP_free(br);
291 return ret; 289 return ret;
292 } 290 }
OLDNEW
« no previous file with comments | « openssl/crypto/ocsp/ocsp_lib.c ('k') | openssl/crypto/ocsp/ocsp_vfy.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698