summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ts/ts.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ts/ts.h')
-rw-r--r--src/lib/libcrypto/ts/ts.h139
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
106typedef struct TS_msg_imprint_st 106typedef 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/*
113TimeStampReq ::= SEQUENCE { 112TimeStampReq ::= SEQUENCE {
@@ -121,15 +120,14 @@ TimeStampReq ::= SEQUENCE {
121 extensions [0] IMPLICIT Extensions OPTIONAL } 120 extensions [0] IMPLICIT Extensions OPTIONAL }
122*/ 121*/
123 122
124typedef struct TS_req_st 123typedef 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/*
135Accuracy ::= SEQUENCE { 133Accuracy ::= 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
141typedef struct TS_accuracy_st 139typedef 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/*
149TSTInfo ::= SEQUENCE { 146TSTInfo ::= SEQUENCE {
@@ -165,8 +162,7 @@ TSTInfo ::= SEQUENCE {
165 extensions [1] IMPLICIT Extensions OPTIONAL } 162 extensions [1] IMPLICIT Extensions OPTIONAL }
166*/ 163*/
167 164
168typedef struct TS_tst_info_st 165typedef 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/*
183PKIStatusInfo ::= SEQUENCE { 179PKIStatusInfo ::= 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
215typedef struct TS_status_info_st 211typedef 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
222DECLARE_STACK_OF(ASN1_UTF8STRING) 217DECLARE_STACK_OF(ASN1_UTF8STRING)
223DECLARE_ASN1_SET_OF(ASN1_UTF8STRING) 218DECLARE_ASN1_SET_OF(ASN1_UTF8STRING)
@@ -228,12 +223,11 @@ TimeStampResp ::= SEQUENCE {
228 timeStampToken TimeStampToken OPTIONAL } 223 timeStampToken TimeStampToken OPTIONAL }
229*/ 224*/
230 225
231typedef struct TS_resp_st 226typedef 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
247typedef struct ESS_issuer_serial 241typedef 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/*
254ESSCertID ::= SEQUENCE { 247ESSCertID ::= SEQUENCE {
@@ -257,11 +250,10 @@ ESSCertID ::= SEQUENCE {
257} 250}
258*/ 251*/
259 252
260typedef struct ESS_cert_id 253typedef 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
266DECLARE_STACK_OF(ESS_CERT_ID) 258DECLARE_STACK_OF(ESS_CERT_ID)
267DECLARE_ASN1_SET_OF(ESS_CERT_ID) 259DECLARE_ASN1_SET_OF(ESS_CERT_ID)
@@ -273,11 +265,10 @@ SigningCertificate ::= SEQUENCE {
273} 265}
274*/ 266*/
275 267
276typedef struct ESS_signing_cert 268typedef 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
283TS_REQ *TS_REQ_new(void); 274TS_REQ *TS_REQ_new(void);
@@ -296,7 +287,7 @@ TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void);
296void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); 287void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a);
297int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); 288int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp);
298TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, 289TS_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
301TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); 292TS_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);
320TS_STATUS_INFO *TS_STATUS_INFO_new(void); 311TS_STATUS_INFO *TS_STATUS_INFO_new(void);
321void TS_STATUS_INFO_free(TS_STATUS_INFO *a); 312void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
322int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); 313int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp);
323TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, 314TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a,
324 const unsigned char **pp, long length); 315 const unsigned char **pp, long length);
325TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); 316TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a);
326 317
327TS_TST_INFO *TS_TST_INFO_new(void); 318TS_TST_INFO *TS_TST_INFO_new(void);
328void TS_TST_INFO_free(TS_TST_INFO *a); 319void TS_TST_INFO_free(TS_TST_INFO *a);
329int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); 320int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp);
330TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, 321TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
331 long length); 322 long length);
332TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); 323TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
333 324
334TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); 325TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
@@ -340,30 +331,30 @@ TS_ACCURACY *TS_ACCURACY_new(void);
340void TS_ACCURACY_free(TS_ACCURACY *a); 331void TS_ACCURACY_free(TS_ACCURACY *a);
341int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); 332int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp);
342TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, 333TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp,
343 long length); 334 long length);
344TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); 335TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a);
345 336
346ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); 337ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void);
347void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); 338void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a);
348int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, 339int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a,
349 unsigned char **pp); 340 unsigned char **pp);
350ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, 341ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a,
351 const unsigned char **pp, long length); 342 const unsigned char **pp, long length);
352ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); 343ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a);
353 344
354ESS_CERT_ID *ESS_CERT_ID_new(void); 345ESS_CERT_ID *ESS_CERT_ID_new(void);
355void ESS_CERT_ID_free(ESS_CERT_ID *a); 346void ESS_CERT_ID_free(ESS_CERT_ID *a);
356int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); 347int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp);
357ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, 348ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp,
358 long length); 349 long length);
359ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); 350ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a);
360 351
361ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); 352ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void);
362void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); 353void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a);
363int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, 354int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a,
364 unsigned char **pp); 355 unsigned char **pp);
365ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, 356ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a,
366 const unsigned char **pp, long length); 357 const unsigned char **pp, long length);
367ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); 358ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a);
368 359
369void ERR_load_TS_strings(void); 360void ERR_load_TS_strings(void);
@@ -485,19 +476,18 @@ struct TS_resp_ctx;
485typedef ASN1_INTEGER *(*TS_serial_cb)(struct TS_resp_ctx *, void *); 476typedef 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. */
490typedef int (*TS_time_cb)(struct TS_resp_ctx *, void *, long *sec, long *usec); 481typedef 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 */
497typedef int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, void *); 488typedef int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, void *);
498 489
499typedef struct TS_resp_ctx 490typedef 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
530DECLARE_STACK_OF(EVP_MD) 520DECLARE_STACK_OF(EVP_MD)
531DECLARE_ASN1_SET_OF(EVP_MD) 521DECLARE_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. */
547int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); 537int 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. */
551int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy); 541int 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. */
555int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); 545int 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. */
558int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, 548int 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. */
563int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, 553int 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. */
575void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); 565void 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. */
580void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, 570void 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. */
584int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, 574int 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. */
588int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, 578int 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
591int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); 581int 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
596TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); 586TS_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
610int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, 600int 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
651typedef struct TS_verify_ctx 641typedef 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
679int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); 668int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response);
680int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); 669int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token);
@@ -690,7 +679,7 @@ void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx);
690void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); 679void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx);
691void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); 680void 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);
730EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); 719EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
731const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); 720const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
732int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, 721int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
733 TS_RESP_CTX *ctx); 722 TS_RESP_CTX *ctx);
734int TS_CONF_set_crypto_device(CONF *conf, const char *section, 723int TS_CONF_set_crypto_device(CONF *conf, const char *section,
735 const char *device); 724 const char *device);
736int TS_CONF_set_default_engine(const char *name); 725int TS_CONF_set_default_engine(const char *name);
737int TS_CONF_set_signer_cert(CONF *conf, const char *section, 726int 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);
739int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, 728int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
740 TS_RESP_CTX *ctx); 729 TS_RESP_CTX *ctx);
741int TS_CONF_set_signer_key(CONF *conf, const char *section, 730int 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);
743int TS_CONF_set_def_policy(CONF *conf, const char *section, 732int 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);
745int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); 734int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);
746int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); 735int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx);
747int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); 736int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx);
748int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, 737int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section,
749 TS_RESP_CTX *ctx); 738 TS_RESP_CTX *ctx);
750int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); 739int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx);
751int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); 740int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx);
752int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, 741int 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 */