diff options
| author | jsing <> | 2014-04-21 16:32:06 +0000 |
|---|---|---|
| committer | jsing <> | 2014-04-21 16:32:06 +0000 |
| commit | d38038d391733e01f20761a13d2e7f39dd1495fa (patch) | |
| tree | be04a70e8733f1afb3ae549ad26c1c50ec666f15 /src/lib/libcrypto/ts/ts.h | |
| parent | f7f50fee471be5d0d88214715a1bc24df690120c (diff) | |
| download | openbsd-d38038d391733e01f20761a13d2e7f39dd1495fa.tar.gz openbsd-d38038d391733e01f20761a13d2e7f39dd1495fa.tar.bz2 openbsd-d38038d391733e01f20761a13d2e7f39dd1495fa.zip | |
KNF.
Diffstat (limited to 'src/lib/libcrypto/ts/ts.h')
| -rw-r--r-- | src/lib/libcrypto/ts/ts.h | 139 |
1 files changed, 64 insertions, 75 deletions
diff --git a/src/lib/libcrypto/ts/ts.h b/src/lib/libcrypto/ts/ts.h index 88e0111453..3c5ab727db 100644 --- a/src/lib/libcrypto/ts/ts.h +++ b/src/lib/libcrypto/ts/ts.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * are met: | 10 | * are met: |
| 11 | * | 11 | * |
| 12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * | 14 | * |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
| @@ -103,11 +103,10 @@ MessageImprint ::= SEQUENCE { | |||
| 103 | hashedMessage OCTET STRING } | 103 | hashedMessage OCTET STRING } |
| 104 | */ | 104 | */ |
| 105 | 105 | ||
| 106 | typedef struct TS_msg_imprint_st | 106 | typedef struct TS_msg_imprint_st { |
| 107 | { | ||
| 108 | X509_ALGOR *hash_algo; | 107 | X509_ALGOR *hash_algo; |
| 109 | ASN1_OCTET_STRING *hashed_msg; | 108 | ASN1_OCTET_STRING *hashed_msg; |
| 110 | } TS_MSG_IMPRINT; | 109 | } TS_MSG_IMPRINT; |
| 111 | 110 | ||
| 112 | /* | 111 | /* |
| 113 | TimeStampReq ::= SEQUENCE { | 112 | TimeStampReq ::= SEQUENCE { |
| @@ -121,15 +120,14 @@ TimeStampReq ::= SEQUENCE { | |||
| 121 | extensions [0] IMPLICIT Extensions OPTIONAL } | 120 | extensions [0] IMPLICIT Extensions OPTIONAL } |
| 122 | */ | 121 | */ |
| 123 | 122 | ||
| 124 | typedef struct TS_req_st | 123 | typedef struct TS_req_st { |
| 125 | { | ||
| 126 | ASN1_INTEGER *version; | 124 | ASN1_INTEGER *version; |
| 127 | TS_MSG_IMPRINT *msg_imprint; | 125 | TS_MSG_IMPRINT *msg_imprint; |
| 128 | ASN1_OBJECT *policy_id; /* OPTIONAL */ | 126 | ASN1_OBJECT *policy_id; /* OPTIONAL */ |
| 129 | ASN1_INTEGER *nonce; /* OPTIONAL */ | 127 | ASN1_INTEGER *nonce; /* OPTIONAL */ |
| 130 | ASN1_BOOLEAN cert_req; /* DEFAULT FALSE */ | 128 | ASN1_BOOLEAN cert_req; /* DEFAULT FALSE */ |
| 131 | STACK_OF(X509_EXTENSION) *extensions; /* [0] OPTIONAL */ | 129 | STACK_OF(X509_EXTENSION) *extensions; /* [0] OPTIONAL */ |
| 132 | } TS_REQ; | 130 | } TS_REQ; |
| 133 | 131 | ||
| 134 | /* | 132 | /* |
| 135 | Accuracy ::= SEQUENCE { | 133 | Accuracy ::= SEQUENCE { |
| @@ -138,12 +136,11 @@ Accuracy ::= SEQUENCE { | |||
| 138 | micros [1] INTEGER (1..999) OPTIONAL } | 136 | micros [1] INTEGER (1..999) OPTIONAL } |
| 139 | */ | 137 | */ |
| 140 | 138 | ||
| 141 | typedef struct TS_accuracy_st | 139 | typedef struct TS_accuracy_st { |
| 142 | { | ||
| 143 | ASN1_INTEGER *seconds; | 140 | ASN1_INTEGER *seconds; |
| 144 | ASN1_INTEGER *millis; | 141 | ASN1_INTEGER *millis; |
| 145 | ASN1_INTEGER *micros; | 142 | ASN1_INTEGER *micros; |
| 146 | } TS_ACCURACY; | 143 | } TS_ACCURACY; |
| 147 | 144 | ||
| 148 | /* | 145 | /* |
| 149 | TSTInfo ::= SEQUENCE { | 146 | TSTInfo ::= SEQUENCE { |
| @@ -165,8 +162,7 @@ TSTInfo ::= SEQUENCE { | |||
| 165 | extensions [1] IMPLICIT Extensions OPTIONAL } | 162 | extensions [1] IMPLICIT Extensions OPTIONAL } |
| 166 | */ | 163 | */ |
| 167 | 164 | ||
| 168 | typedef struct TS_tst_info_st | 165 | typedef struct TS_tst_info_st { |
| 169 | { | ||
| 170 | ASN1_INTEGER *version; | 166 | ASN1_INTEGER *version; |
| 171 | ASN1_OBJECT *policy_id; | 167 | ASN1_OBJECT *policy_id; |
| 172 | TS_MSG_IMPRINT *msg_imprint; | 168 | TS_MSG_IMPRINT *msg_imprint; |
| @@ -177,7 +173,7 @@ typedef struct TS_tst_info_st | |||
| 177 | ASN1_INTEGER *nonce; | 173 | ASN1_INTEGER *nonce; |
| 178 | GENERAL_NAME *tsa; | 174 | GENERAL_NAME *tsa; |
| 179 | STACK_OF(X509_EXTENSION) *extensions; | 175 | STACK_OF(X509_EXTENSION) *extensions; |
| 180 | } TS_TST_INFO; | 176 | } TS_TST_INFO; |
| 181 | 177 | ||
| 182 | /* | 178 | /* |
| 183 | PKIStatusInfo ::= SEQUENCE { | 179 | PKIStatusInfo ::= SEQUENCE { |
| @@ -212,12 +208,11 @@ PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String | |||
| 212 | #define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 | 208 | #define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 |
| 213 | #define TS_INFO_SYSTEM_FAILURE 25 | 209 | #define TS_INFO_SYSTEM_FAILURE 25 |
| 214 | 210 | ||
| 215 | typedef struct TS_status_info_st | 211 | typedef struct TS_status_info_st { |
| 216 | { | ||
| 217 | ASN1_INTEGER *status; | 212 | ASN1_INTEGER *status; |
| 218 | STACK_OF(ASN1_UTF8STRING) *text; | 213 | STACK_OF(ASN1_UTF8STRING) *text; |
| 219 | ASN1_BIT_STRING *failure_info; | 214 | ASN1_BIT_STRING *failure_info; |
| 220 | } TS_STATUS_INFO; | 215 | } TS_STATUS_INFO; |
| 221 | 216 | ||
| 222 | DECLARE_STACK_OF(ASN1_UTF8STRING) | 217 | DECLARE_STACK_OF(ASN1_UTF8STRING) |
| 223 | DECLARE_ASN1_SET_OF(ASN1_UTF8STRING) | 218 | DECLARE_ASN1_SET_OF(ASN1_UTF8STRING) |
| @@ -228,12 +223,11 @@ TimeStampResp ::= SEQUENCE { | |||
| 228 | timeStampToken TimeStampToken OPTIONAL } | 223 | timeStampToken TimeStampToken OPTIONAL } |
| 229 | */ | 224 | */ |
| 230 | 225 | ||
| 231 | typedef struct TS_resp_st | 226 | typedef struct TS_resp_st { |
| 232 | { | ||
| 233 | TS_STATUS_INFO *status_info; | 227 | TS_STATUS_INFO *status_info; |
| 234 | PKCS7 *token; | 228 | PKCS7 *token; |
| 235 | TS_TST_INFO *tst_info; | 229 | TS_TST_INFO *tst_info; |
| 236 | } TS_RESP; | 230 | } TS_RESP; |
| 237 | 231 | ||
| 238 | /* The structure below would belong to the ESS component. */ | 232 | /* The structure below would belong to the ESS component. */ |
| 239 | 233 | ||
| @@ -244,11 +238,10 @@ IssuerSerial ::= SEQUENCE { | |||
| 244 | } | 238 | } |
| 245 | */ | 239 | */ |
| 246 | 240 | ||
| 247 | typedef struct ESS_issuer_serial | 241 | typedef struct ESS_issuer_serial { |
| 248 | { | ||
| 249 | STACK_OF(GENERAL_NAME) *issuer; | 242 | STACK_OF(GENERAL_NAME) *issuer; |
| 250 | ASN1_INTEGER *serial; | 243 | ASN1_INTEGER *serial; |
| 251 | } ESS_ISSUER_SERIAL; | 244 | } ESS_ISSUER_SERIAL; |
| 252 | 245 | ||
| 253 | /* | 246 | /* |
| 254 | ESSCertID ::= SEQUENCE { | 247 | ESSCertID ::= SEQUENCE { |
| @@ -257,11 +250,10 @@ ESSCertID ::= SEQUENCE { | |||
| 257 | } | 250 | } |
| 258 | */ | 251 | */ |
| 259 | 252 | ||
| 260 | typedef struct ESS_cert_id | 253 | typedef struct ESS_cert_id { |
| 261 | { | ||
| 262 | ASN1_OCTET_STRING *hash; /* Always SHA-1 digest. */ | 254 | ASN1_OCTET_STRING *hash; /* Always SHA-1 digest. */ |
| 263 | ESS_ISSUER_SERIAL *issuer_serial; | 255 | ESS_ISSUER_SERIAL *issuer_serial; |
| 264 | } ESS_CERT_ID; | 256 | } ESS_CERT_ID; |
| 265 | 257 | ||
| 266 | DECLARE_STACK_OF(ESS_CERT_ID) | 258 | DECLARE_STACK_OF(ESS_CERT_ID) |
| 267 | DECLARE_ASN1_SET_OF(ESS_CERT_ID) | 259 | DECLARE_ASN1_SET_OF(ESS_CERT_ID) |
| @@ -273,11 +265,10 @@ SigningCertificate ::= SEQUENCE { | |||
| 273 | } | 265 | } |
| 274 | */ | 266 | */ |
| 275 | 267 | ||
| 276 | typedef struct ESS_signing_cert | 268 | typedef struct ESS_signing_cert { |
| 277 | { | ||
| 278 | STACK_OF(ESS_CERT_ID) *cert_ids; | 269 | STACK_OF(ESS_CERT_ID) *cert_ids; |
| 279 | STACK_OF(POLICYINFO) *policy_info; | 270 | STACK_OF(POLICYINFO) *policy_info; |
| 280 | } ESS_SIGNING_CERT; | 271 | } ESS_SIGNING_CERT; |
| 281 | 272 | ||
| 282 | 273 | ||
| 283 | TS_REQ *TS_REQ_new(void); | 274 | TS_REQ *TS_REQ_new(void); |
| @@ -296,7 +287,7 @@ TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); | |||
| 296 | void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); | 287 | void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); |
| 297 | int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); | 288 | int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); |
| 298 | TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, | 289 | TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, |
| 299 | const unsigned char **pp, long length); | 290 | const unsigned char **pp, long length); |
| 300 | 291 | ||
| 301 | TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); | 292 | TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); |
| 302 | 293 | ||
| @@ -320,15 +311,15 @@ int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a); | |||
| 320 | TS_STATUS_INFO *TS_STATUS_INFO_new(void); | 311 | TS_STATUS_INFO *TS_STATUS_INFO_new(void); |
| 321 | void TS_STATUS_INFO_free(TS_STATUS_INFO *a); | 312 | void TS_STATUS_INFO_free(TS_STATUS_INFO *a); |
| 322 | int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); | 313 | int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); |
| 323 | TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, | 314 | TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, |
| 324 | const unsigned char **pp, long length); | 315 | const unsigned char **pp, long length); |
| 325 | TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); | 316 | TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); |
| 326 | 317 | ||
| 327 | TS_TST_INFO *TS_TST_INFO_new(void); | 318 | TS_TST_INFO *TS_TST_INFO_new(void); |
| 328 | void TS_TST_INFO_free(TS_TST_INFO *a); | 319 | void TS_TST_INFO_free(TS_TST_INFO *a); |
| 329 | int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); | 320 | int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); |
| 330 | TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, | 321 | TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, |
| 331 | long length); | 322 | long length); |
| 332 | TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); | 323 | TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); |
| 333 | 324 | ||
| 334 | TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); | 325 | TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); |
| @@ -340,30 +331,30 @@ TS_ACCURACY *TS_ACCURACY_new(void); | |||
| 340 | void TS_ACCURACY_free(TS_ACCURACY *a); | 331 | void TS_ACCURACY_free(TS_ACCURACY *a); |
| 341 | int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); | 332 | int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); |
| 342 | TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, | 333 | TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, |
| 343 | long length); | 334 | long length); |
| 344 | TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); | 335 | TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); |
| 345 | 336 | ||
| 346 | ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); | 337 | ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); |
| 347 | void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); | 338 | void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); |
| 348 | int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, | 339 | int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, |
| 349 | unsigned char **pp); | 340 | unsigned char **pp); |
| 350 | ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, | 341 | ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, |
| 351 | const unsigned char **pp, long length); | 342 | const unsigned char **pp, long length); |
| 352 | ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); | 343 | ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); |
| 353 | 344 | ||
| 354 | ESS_CERT_ID *ESS_CERT_ID_new(void); | 345 | ESS_CERT_ID *ESS_CERT_ID_new(void); |
| 355 | void ESS_CERT_ID_free(ESS_CERT_ID *a); | 346 | void ESS_CERT_ID_free(ESS_CERT_ID *a); |
| 356 | int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); | 347 | int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); |
| 357 | ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, | 348 | ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, |
| 358 | long length); | 349 | long length); |
| 359 | ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); | 350 | ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); |
| 360 | 351 | ||
| 361 | ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); | 352 | ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); |
| 362 | void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); | 353 | void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); |
| 363 | int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, | 354 | int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, |
| 364 | unsigned char **pp); | 355 | unsigned char **pp); |
| 365 | ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, | 356 | ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, |
| 366 | const unsigned char **pp, long length); | 357 | const unsigned char **pp, long length); |
| 367 | ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); | 358 | ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); |
| 368 | 359 | ||
| 369 | void ERR_load_TS_strings(void); | 360 | void ERR_load_TS_strings(void); |
| @@ -485,19 +476,18 @@ struct TS_resp_ctx; | |||
| 485 | typedef ASN1_INTEGER *(*TS_serial_cb)(struct TS_resp_ctx *, void *); | 476 | typedef ASN1_INTEGER *(*TS_serial_cb)(struct TS_resp_ctx *, void *); |
| 486 | 477 | ||
| 487 | /* This must return the seconds and microseconds since Jan 1, 1970 in | 478 | /* This must return the seconds and microseconds since Jan 1, 1970 in |
| 488 | the sec and usec variables allocated by the caller. | 479 | the sec and usec variables allocated by the caller. |
| 489 | Return non-zero for success and zero for failure. */ | 480 | Return non-zero for success and zero for failure. */ |
| 490 | typedef int (*TS_time_cb)(struct TS_resp_ctx *, void *, long *sec, long *usec); | 481 | typedef int (*TS_time_cb)(struct TS_resp_ctx *, void *, long *sec, long *usec); |
| 491 | 482 | ||
| 492 | /* This must process the given extension. | 483 | /* This must process the given extension. |
| 493 | * It can modify the TS_TST_INFO object of the context. | 484 | * It can modify the TS_TST_INFO object of the context. |
| 494 | * Return values: !0 (processed), 0 (error, it must set the | 485 | * Return values: !0 (processed), 0 (error, it must set the |
| 495 | * status info/failure info of the response). | 486 | * status info/failure info of the response). |
| 496 | */ | 487 | */ |
| 497 | typedef int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, void *); | 488 | typedef int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, void *); |
| 498 | 489 | ||
| 499 | typedef struct TS_resp_ctx | 490 | typedef struct TS_resp_ctx { |
| 500 | { | ||
| 501 | X509 *signer_cert; | 491 | X509 *signer_cert; |
| 502 | EVP_PKEY *signer_key; | 492 | EVP_PKEY *signer_key; |
| 503 | STACK_OF(X509) *certs; /* Certs to include in signed data. */ | 493 | STACK_OF(X509) *certs; /* Certs to include in signed data. */ |
| @@ -514,10 +504,10 @@ typedef struct TS_resp_ctx | |||
| 514 | /* Callback functions. */ | 504 | /* Callback functions. */ |
| 515 | TS_serial_cb serial_cb; | 505 | TS_serial_cb serial_cb; |
| 516 | void *serial_cb_data; /* User data for serial_cb. */ | 506 | void *serial_cb_data; /* User data for serial_cb. */ |
| 517 | 507 | ||
| 518 | TS_time_cb time_cb; | 508 | TS_time_cb time_cb; |
| 519 | void *time_cb_data; /* User data for time_cb. */ | 509 | void *time_cb_data; /* User data for time_cb. */ |
| 520 | 510 | ||
| 521 | TS_extension_cb extension_cb; | 511 | TS_extension_cb extension_cb; |
| 522 | void *extension_cb_data; /* User data for extension_cb. */ | 512 | void *extension_cb_data; /* User data for extension_cb. */ |
| 523 | 513 | ||
| @@ -525,7 +515,7 @@ typedef struct TS_resp_ctx | |||
| 525 | TS_REQ *request; | 515 | TS_REQ *request; |
| 526 | TS_RESP *response; | 516 | TS_RESP *response; |
| 527 | TS_TST_INFO *tst_info; | 517 | TS_TST_INFO *tst_info; |
| 528 | } TS_RESP_CTX; | 518 | } TS_RESP_CTX; |
| 529 | 519 | ||
| 530 | DECLARE_STACK_OF(EVP_MD) | 520 | DECLARE_STACK_OF(EVP_MD) |
| 531 | DECLARE_ASN1_SET_OF(EVP_MD) | 521 | DECLARE_ASN1_SET_OF(EVP_MD) |
| @@ -546,23 +536,23 @@ int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *def_policy); | |||
| 546 | /* No additional certs are included in the response by default. */ | 536 | /* No additional certs are included in the response by default. */ |
| 547 | int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); | 537 | int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); |
| 548 | 538 | ||
| 549 | /* Adds a new acceptable policy, only the default policy | 539 | /* Adds a new acceptable policy, only the default policy |
| 550 | is accepted by default. */ | 540 | is accepted by default. */ |
| 551 | int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy); | 541 | int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy); |
| 552 | 542 | ||
| 553 | /* Adds a new acceptable message digest. Note that no message digests | 543 | /* Adds a new acceptable message digest. Note that no message digests |
| 554 | are accepted by default. The md argument is shared with the caller. */ | 544 | are accepted by default. The md argument is shared with the caller. */ |
| 555 | int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); | 545 | int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); |
| 556 | 546 | ||
| 557 | /* Accuracy is not included by default. */ | 547 | /* Accuracy is not included by default. */ |
| 558 | int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, | 548 | int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, |
| 559 | int secs, int millis, int micros); | 549 | int secs, int millis, int micros); |
| 560 | 550 | ||
| 561 | /* Clock precision digits, i.e. the number of decimal digits: | 551 | /* Clock precision digits, i.e. the number of decimal digits: |
| 562 | '0' means sec, '3' msec, '6' usec, and so on. Default is 0. */ | 552 | '0' means sec, '3' msec, '6' usec, and so on. Default is 0. */ |
| 563 | int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, | 553 | int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, |
| 564 | unsigned clock_precision_digits); | 554 | unsigned clock_precision_digits); |
| 565 | /* At most we accept usec precision. */ | 555 | /* At most we accept usec precision. */ |
| 566 | #define TS_MAX_CLOCK_PRECISION_DIGITS 6 | 556 | #define TS_MAX_CLOCK_PRECISION_DIGITS 6 |
| 567 | 557 | ||
| 568 | /* No flags are set by default. */ | 558 | /* No flags are set by default. */ |
| @@ -574,19 +564,19 @@ void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); | |||
| 574 | /* Default callback uses the gettimeofday() and gmtime() system calls. */ | 564 | /* Default callback uses the gettimeofday() and gmtime() system calls. */ |
| 575 | void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); | 565 | void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); |
| 576 | 566 | ||
| 577 | /* Default callback rejects all extensions. The extension callback is called | 567 | /* Default callback rejects all extensions. The extension callback is called |
| 578 | * when the TS_TST_INFO object is already set up and not signed yet. */ | 568 | * when the TS_TST_INFO object is already set up and not signed yet. */ |
| 579 | /* FIXME: extension handling is not tested yet. */ | 569 | /* FIXME: extension handling is not tested yet. */ |
| 580 | void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, | 570 | void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, |
| 581 | TS_extension_cb cb, void *data); | 571 | TS_extension_cb cb, void *data); |
| 582 | 572 | ||
| 583 | /* The following methods can be used in the callbacks. */ | 573 | /* The following methods can be used in the callbacks. */ |
| 584 | int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, | 574 | int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, |
| 585 | int status, const char *text); | 575 | int status, const char *text); |
| 586 | 576 | ||
| 587 | /* Sets the status info only if it is still TS_STATUS_GRANTED. */ | 577 | /* Sets the status info only if it is still TS_STATUS_GRANTED. */ |
| 588 | int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, | 578 | int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, |
| 589 | int status, const char *text); | 579 | int status, const char *text); |
| 590 | 580 | ||
| 591 | int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); | 581 | int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); |
| 592 | 582 | ||
| @@ -595,7 +585,7 @@ TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); | |||
| 595 | 585 | ||
| 596 | TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); | 586 | TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); |
| 597 | 587 | ||
| 598 | /* | 588 | /* |
| 599 | * Creates the signed TS_TST_INFO and puts it in TS_RESP. | 589 | * Creates the signed TS_TST_INFO and puts it in TS_RESP. |
| 600 | * In case of errors it sets the status info properly. | 590 | * In case of errors it sets the status info properly. |
| 601 | * Returns NULL only in case of memory allocation/fatal error. | 591 | * Returns NULL only in case of memory allocation/fatal error. |
| @@ -608,7 +598,7 @@ TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); | |||
| 608 | */ | 598 | */ |
| 609 | 599 | ||
| 610 | int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, | 600 | int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, |
| 611 | X509_STORE *store, X509 **signer_out); | 601 | X509_STORE *store, X509 **signer_out); |
| 612 | 602 | ||
| 613 | /* Context structure for the generic verify method. */ | 603 | /* Context structure for the generic verify method. */ |
| 614 | 604 | ||
| @@ -648,8 +638,7 @@ int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, | |||
| 648 | | TS_VFY_SIGNER \ | 638 | | TS_VFY_SIGNER \ |
| 649 | | TS_VFY_TSA_NAME) | 639 | | TS_VFY_TSA_NAME) |
| 650 | 640 | ||
| 651 | typedef struct TS_verify_ctx | 641 | typedef struct TS_verify_ctx { |
| 652 | { | ||
| 653 | /* Set this to the union of TS_VFY_... flags you want to carry out. */ | 642 | /* Set this to the union of TS_VFY_... flags you want to carry out. */ |
| 654 | unsigned flags; | 643 | unsigned flags; |
| 655 | 644 | ||
| @@ -660,7 +649,7 @@ typedef struct TS_verify_ctx | |||
| 660 | /* Must be set only with TS_VFY_POLICY. */ | 649 | /* Must be set only with TS_VFY_POLICY. */ |
| 661 | ASN1_OBJECT *policy; | 650 | ASN1_OBJECT *policy; |
| 662 | 651 | ||
| 663 | /* Must be set only with TS_VFY_IMPRINT. If md_alg is NULL, | 652 | /* Must be set only with TS_VFY_IMPRINT. If md_alg is NULL, |
| 664 | the algorithm from the response is used. */ | 653 | the algorithm from the response is used. */ |
| 665 | X509_ALGOR *md_alg; | 654 | X509_ALGOR *md_alg; |
| 666 | unsigned char *imprint; | 655 | unsigned char *imprint; |
| @@ -674,7 +663,7 @@ typedef struct TS_verify_ctx | |||
| 674 | 663 | ||
| 675 | /* Must be set only with TS_VFY_TSA_NAME. */ | 664 | /* Must be set only with TS_VFY_TSA_NAME. */ |
| 676 | GENERAL_NAME *tsa_name; | 665 | GENERAL_NAME *tsa_name; |
| 677 | } TS_VERIFY_CTX; | 666 | } TS_VERIFY_CTX; |
| 678 | 667 | ||
| 679 | int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); | 668 | int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); |
| 680 | int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); | 669 | int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); |
| @@ -690,7 +679,7 @@ void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); | |||
| 690 | void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); | 679 | void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); |
| 691 | void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); | 680 | void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); |
| 692 | 681 | ||
| 693 | /* | 682 | /* |
| 694 | * If ctx is NULL, it allocates and returns a new object, otherwise | 683 | * If ctx is NULL, it allocates and returns a new object, otherwise |
| 695 | * it returns ctx. It initialises all the members as follows: | 684 | * it returns ctx. It initialises all the members as follows: |
| 696 | * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) | 685 | * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) |
| @@ -730,27 +719,27 @@ STACK_OF(X509) *TS_CONF_load_certs(const char *file); | |||
| 730 | EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); | 719 | EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); |
| 731 | const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); | 720 | const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); |
| 732 | int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, | 721 | int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, |
| 733 | TS_RESP_CTX *ctx); | 722 | TS_RESP_CTX *ctx); |
| 734 | int TS_CONF_set_crypto_device(CONF *conf, const char *section, | 723 | int TS_CONF_set_crypto_device(CONF *conf, const char *section, |
| 735 | const char *device); | 724 | const char *device); |
| 736 | int TS_CONF_set_default_engine(const char *name); | 725 | int TS_CONF_set_default_engine(const char *name); |
| 737 | int TS_CONF_set_signer_cert(CONF *conf, const char *section, | 726 | int TS_CONF_set_signer_cert(CONF *conf, const char *section, |
| 738 | const char *cert, TS_RESP_CTX *ctx); | 727 | const char *cert, TS_RESP_CTX *ctx); |
| 739 | int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, | 728 | int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, |
| 740 | TS_RESP_CTX *ctx); | 729 | TS_RESP_CTX *ctx); |
| 741 | int TS_CONF_set_signer_key(CONF *conf, const char *section, | 730 | int TS_CONF_set_signer_key(CONF *conf, const char *section, |
| 742 | const char *key, const char *pass, TS_RESP_CTX *ctx); | 731 | const char *key, const char *pass, TS_RESP_CTX *ctx); |
| 743 | int TS_CONF_set_def_policy(CONF *conf, const char *section, | 732 | int TS_CONF_set_def_policy(CONF *conf, const char *section, |
| 744 | const char *policy, TS_RESP_CTX *ctx); | 733 | const char *policy, TS_RESP_CTX *ctx); |
| 745 | int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); | 734 | int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); |
| 746 | int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); | 735 | int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); |
| 747 | int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); | 736 | int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); |
| 748 | int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, | 737 | int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, |
| 749 | TS_RESP_CTX *ctx); | 738 | TS_RESP_CTX *ctx); |
| 750 | int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); | 739 | int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); |
| 751 | int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); | 740 | int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); |
| 752 | int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, | 741 | int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, |
| 753 | TS_RESP_CTX *ctx); | 742 | TS_RESP_CTX *ctx); |
| 754 | 743 | ||
| 755 | /* -------------------------------------------------- */ | 744 | /* -------------------------------------------------- */ |
| 756 | /* BEGIN ERROR CODES */ | 745 | /* BEGIN ERROR CODES */ |
