Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 08:37:40

0001 /*
0002  * Copyright 2006-2024 The OpenSSL Project Authors. All Rights Reserved.
0003  *
0004  * Licensed under the Apache License 2.0 (the "License").  You may not use
0005  * this file except in compliance with the License.  You can obtain a copy
0006  * in the file LICENSE in the source distribution or at
0007  * https://www.openssl.org/source/license.html
0008  */
0009 
0010 #ifndef OPENSSL_TS_H
0011 #define OPENSSL_TS_H
0012 #pragma once
0013 
0014 #include <openssl/macros.h>
0015 #ifndef OPENSSL_NO_DEPRECATED_3_0
0016 #define HEADER_TS_H
0017 #endif
0018 
0019 #include <openssl/opensslconf.h>
0020 
0021 #ifndef OPENSSL_NO_TS
0022 #include <openssl/symhacks.h>
0023 #include <openssl/buffer.h>
0024 #include <openssl/evp.h>
0025 #include <openssl/bio.h>
0026 #include <openssl/asn1.h>
0027 #include <openssl/safestack.h>
0028 #include <openssl/rsa.h>
0029 #include <openssl/dsa.h>
0030 #include <openssl/dh.h>
0031 #include <openssl/tserr.h>
0032 #include <openssl/ess.h>
0033 #include <openssl/x509.h>
0034 #include <openssl/x509v3.h>
0035 #ifndef OPENSSL_NO_STDIO
0036 #include <stdio.h>
0037 #endif
0038 #ifdef __cplusplus
0039 extern "C" {
0040 #endif
0041 
0042 typedef struct TS_msg_imprint_st TS_MSG_IMPRINT;
0043 typedef struct TS_req_st TS_REQ;
0044 typedef struct TS_accuracy_st TS_ACCURACY;
0045 typedef struct TS_tst_info_st TS_TST_INFO;
0046 
0047 /* Possible values for status. */
0048 #define TS_STATUS_GRANTED 0
0049 #define TS_STATUS_GRANTED_WITH_MODS 1
0050 #define TS_STATUS_REJECTION 2
0051 #define TS_STATUS_WAITING 3
0052 #define TS_STATUS_REVOCATION_WARNING 4
0053 #define TS_STATUS_REVOCATION_NOTIFICATION 5
0054 
0055 /* Possible values for failure_info. */
0056 #define TS_INFO_BAD_ALG 0
0057 #define TS_INFO_BAD_REQUEST 2
0058 #define TS_INFO_BAD_DATA_FORMAT 5
0059 #define TS_INFO_TIME_NOT_AVAILABLE 14
0060 #define TS_INFO_UNACCEPTED_POLICY 15
0061 #define TS_INFO_UNACCEPTED_EXTENSION 16
0062 #define TS_INFO_ADD_INFO_NOT_AVAILABLE 17
0063 #define TS_INFO_SYSTEM_FAILURE 25
0064 
0065 typedef struct TS_status_info_st TS_STATUS_INFO;
0066 
0067 typedef struct TS_resp_st TS_RESP;
0068 
0069 DECLARE_ASN1_ALLOC_FUNCTIONS(TS_REQ)
0070 DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_REQ, TS_REQ)
0071 DECLARE_ASN1_DUP_FUNCTION(TS_REQ)
0072 
0073 #ifndef OPENSSL_NO_STDIO
0074 TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);
0075 int i2d_TS_REQ_fp(FILE *fp, const TS_REQ *a);
0076 #endif
0077 TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);
0078 int i2d_TS_REQ_bio(BIO *fp, const TS_REQ *a);
0079 
0080 DECLARE_ASN1_ALLOC_FUNCTIONS(TS_MSG_IMPRINT)
0081 DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_MSG_IMPRINT, TS_MSG_IMPRINT)
0082 DECLARE_ASN1_DUP_FUNCTION(TS_MSG_IMPRINT)
0083 
0084 #ifndef OPENSSL_NO_STDIO
0085 TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);
0086 int i2d_TS_MSG_IMPRINT_fp(FILE *fp, const TS_MSG_IMPRINT *a);
0087 #endif
0088 TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a);
0089 int i2d_TS_MSG_IMPRINT_bio(BIO *bio, const TS_MSG_IMPRINT *a);
0090 
0091 DECLARE_ASN1_ALLOC_FUNCTIONS(TS_RESP)
0092 DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_RESP, TS_RESP)
0093 DECLARE_ASN1_DUP_FUNCTION(TS_RESP)
0094 
0095 #ifndef OPENSSL_NO_STDIO
0096 TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);
0097 int i2d_TS_RESP_fp(FILE *fp, const TS_RESP *a);
0098 #endif
0099 TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a);
0100 int i2d_TS_RESP_bio(BIO *bio, const TS_RESP *a);
0101 
0102 DECLARE_ASN1_ALLOC_FUNCTIONS(TS_STATUS_INFO)
0103 DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_STATUS_INFO, TS_STATUS_INFO)
0104 DECLARE_ASN1_DUP_FUNCTION(TS_STATUS_INFO)
0105 
0106 DECLARE_ASN1_ALLOC_FUNCTIONS(TS_TST_INFO)
0107 DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_TST_INFO, TS_TST_INFO)
0108 DECLARE_ASN1_DUP_FUNCTION(TS_TST_INFO)
0109 TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
0110 
0111 #ifndef OPENSSL_NO_STDIO
0112 TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
0113 int i2d_TS_TST_INFO_fp(FILE *fp, const TS_TST_INFO *a);
0114 #endif
0115 TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a);
0116 int i2d_TS_TST_INFO_bio(BIO *bio, const TS_TST_INFO *a);
0117 
0118 DECLARE_ASN1_ALLOC_FUNCTIONS(TS_ACCURACY)
0119 DECLARE_ASN1_ENCODE_FUNCTIONS_only(TS_ACCURACY, TS_ACCURACY)
0120 DECLARE_ASN1_DUP_FUNCTION(TS_ACCURACY)
0121 
0122 int TS_REQ_set_version(TS_REQ *a, long version);
0123 long TS_REQ_get_version(const TS_REQ *a);
0124 
0125 int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i);
0126 const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a);
0127 
0128 const STACK_OF(ASN1_UTF8STRING) *
0129 TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a);
0130 
0131 const ASN1_BIT_STRING *
0132 TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a);
0133 
0134 int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint);
0135 TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a);
0136 
0137 int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg);
0138 X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a);
0139 
0140 int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len);
0141 ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a);
0142 
0143 int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy);
0144 ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a);
0145 
0146 int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce);
0147 const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a);
0148 
0149 int TS_REQ_set_cert_req(TS_REQ *a, int cert_req);
0150 int TS_REQ_get_cert_req(const TS_REQ *a);
0151 
0152 STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a);
0153 void TS_REQ_ext_free(TS_REQ *a);
0154 int TS_REQ_get_ext_count(TS_REQ *a);
0155 int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos);
0156 int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos);
0157 int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos);
0158 X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc);
0159 X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc);
0160 int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc);
0161 void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx);
0162 
0163 /* Function declarations for TS_REQ defined in ts/ts_req_print.c */
0164 
0165 int TS_REQ_print_bio(BIO *bio, TS_REQ *a);
0166 
0167 /* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */
0168 
0169 int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info);
0170 TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a);
0171 
0172 /* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
0173 void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info);
0174 PKCS7 *TS_RESP_get_token(TS_RESP *a);
0175 TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a);
0176 
0177 int TS_TST_INFO_set_version(TS_TST_INFO *a, long version);
0178 long TS_TST_INFO_get_version(const TS_TST_INFO *a);
0179 
0180 int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id);
0181 ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a);
0182 
0183 int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint);
0184 TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a);
0185 
0186 int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial);
0187 const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a);
0188 
0189 int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime);
0190 const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a);
0191 
0192 int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy);
0193 TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a);
0194 
0195 int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds);
0196 const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a);
0197 
0198 int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis);
0199 const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a);
0200 
0201 int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros);
0202 const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a);
0203 
0204 int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering);
0205 int TS_TST_INFO_get_ordering(const TS_TST_INFO *a);
0206 
0207 int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce);
0208 const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a);
0209 
0210 int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa);
0211 GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a);
0212 
0213 STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a);
0214 void TS_TST_INFO_ext_free(TS_TST_INFO *a);
0215 int TS_TST_INFO_get_ext_count(TS_TST_INFO *a);
0216 int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos);
0217 int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj,
0218     int lastpos);
0219 int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos);
0220 X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc);
0221 X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc);
0222 int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc);
0223 void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx);
0224 
0225 /*
0226  * Declarations related to response generation, defined in ts/ts_resp_sign.c.
0227  */
0228 
0229 /* Optional flags for response generation. */
0230 
0231 /* Don't include the TSA name in response. */
0232 #define TS_TSA_NAME 0x01
0233 
0234 /* Set ordering to true in response. */
0235 #define TS_ORDERING 0x02
0236 
0237 /*
0238  * Include the signer certificate and the other specified certificates in
0239  * the ESS signing certificate attribute beside the PKCS7 signed data.
0240  * Only the signer certificates is included by default.
0241  */
0242 #define TS_ESS_CERT_ID_CHAIN 0x04
0243 
0244 /* Forward declaration. */
0245 struct TS_resp_ctx;
0246 
0247 /* This must return a unique number less than 160 bits long. */
0248 typedef ASN1_INTEGER *(*TS_serial_cb)(struct TS_resp_ctx *, void *);
0249 
0250 /*
0251  * This must return the seconds and microseconds since Jan 1, 1970 in the sec
0252  * and usec variables allocated by the caller. Return non-zero for success
0253  * and zero for failure.
0254  */
0255 typedef int (*TS_time_cb)(struct TS_resp_ctx *, void *, long *sec,
0256     long *usec);
0257 
0258 /*
0259  * This must process the given extension. It can modify the TS_TST_INFO
0260  * object of the context. Return values: !0 (processed), 0 (error, it must
0261  * set the status info/failure info of the response).
0262  */
0263 typedef int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *,
0264     void *);
0265 
0266 typedef struct TS_resp_ctx TS_RESP_CTX;
0267 
0268 /* Creates a response context that can be used for generating responses. */
0269 TS_RESP_CTX *TS_RESP_CTX_new(void);
0270 TS_RESP_CTX *TS_RESP_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
0271 void TS_RESP_CTX_free(TS_RESP_CTX *ctx);
0272 
0273 /* This parameter must be set. */
0274 int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer);
0275 
0276 /* This parameter must be set. */
0277 int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key);
0278 
0279 int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx,
0280     const EVP_MD *signer_digest);
0281 int TS_RESP_CTX_set_ess_cert_id_digest(TS_RESP_CTX *ctx, const EVP_MD *md);
0282 
0283 /* This parameter must be set. */
0284 int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy);
0285 
0286 /* No additional certs are included in the response by default. */
0287 int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs);
0288 
0289 /*
0290  * Adds a new acceptable policy, only the default policy is accepted by
0291  * default.
0292  */
0293 int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy);
0294 
0295 /*
0296  * Adds a new acceptable message digest. Note that no message digests are
0297  * accepted by default. The md argument is shared with the caller.
0298  */
0299 int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md);
0300 
0301 /* Accuracy is not included by default. */
0302 int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx,
0303     int secs, int millis, int micros);
0304 
0305 /*
0306  * Clock precision digits, i.e. the number of decimal digits: '0' means sec,
0307  * '3' msec, '6' usec, and so on. Default is 0.
0308  */
0309 int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx,
0310     unsigned clock_precision_digits);
0311 /* At most we accept usec precision. */
0312 #define TS_MAX_CLOCK_PRECISION_DIGITS 6
0313 
0314 /* Maximum status message length */
0315 #define TS_MAX_STATUS_LENGTH (1024 * 1024)
0316 
0317 /* No flags are set by default. */
0318 void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags);
0319 
0320 /* Default callback always returns a constant. */
0321 void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data);
0322 
0323 /* Default callback uses the gettimeofday() and gmtime() system calls. */
0324 void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data);
0325 
0326 /*
0327  * Default callback rejects all extensions. The extension callback is called
0328  * when the TS_TST_INFO object is already set up and not signed yet.
0329  */
0330 /* FIXME: extension handling is not tested yet. */
0331 void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx,
0332     TS_extension_cb cb, void *data);
0333 
0334 /* The following methods can be used in the callbacks. */
0335 int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx,
0336     int status, const char *text);
0337 
0338 /* Sets the status info only if it is still TS_STATUS_GRANTED. */
0339 int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx,
0340     int status, const char *text);
0341 
0342 int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure);
0343 
0344 /* The get methods below can be used in the extension callback. */
0345 TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx);
0346 
0347 TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx);
0348 
0349 /*
0350  * Creates the signed TS_TST_INFO and puts it in TS_RESP.
0351  * In case of errors it sets the status info properly.
0352  * Returns NULL only in case of memory allocation/fatal error.
0353  */
0354 TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio);
0355 
0356 /*
0357  * Declarations related to response verification,
0358  * they are defined in ts/ts_resp_verify.c.
0359  */
0360 
0361 int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs,
0362     X509_STORE *store, X509 **signer_out);
0363 
0364 /* Context structure for the generic verify method. */
0365 
0366 /* Verify the signer's certificate and the signature of the response. */
0367 #define TS_VFY_SIGNATURE (1u << 0)
0368 /* Verify the version number of the response. */
0369 #define TS_VFY_VERSION (1u << 1)
0370 /* Verify if the policy supplied by the user matches the policy of the TSA. */
0371 #define TS_VFY_POLICY (1u << 2)
0372 /*
0373  * Verify the message imprint provided by the user. This flag should not be
0374  * specified with TS_VFY_DATA.
0375  */
0376 #define TS_VFY_IMPRINT (1u << 3)
0377 /*
0378  * Verify the message imprint computed by the verify method from the user
0379  * provided data and the MD algorithm of the response. This flag should not
0380  * be specified with TS_VFY_IMPRINT.
0381  */
0382 #define TS_VFY_DATA (1u << 4)
0383 /* Verify the nonce value. */
0384 #define TS_VFY_NONCE (1u << 5)
0385 /* Verify if the TSA name field matches the signer certificate. */
0386 #define TS_VFY_SIGNER (1u << 6)
0387 /* Verify if the TSA name field equals to the user provided name. */
0388 #define TS_VFY_TSA_NAME (1u << 7)
0389 
0390 /* You can use the following convenience constants. */
0391 #define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \
0392     | TS_VFY_VERSION                         \
0393     | TS_VFY_POLICY                          \
0394     | TS_VFY_IMPRINT                         \
0395     | TS_VFY_NONCE                           \
0396     | TS_VFY_SIGNER                          \
0397     | TS_VFY_TSA_NAME)
0398 #define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \
0399     | TS_VFY_VERSION                      \
0400     | TS_VFY_POLICY                       \
0401     | TS_VFY_DATA                         \
0402     | TS_VFY_NONCE                        \
0403     | TS_VFY_SIGNER                       \
0404     | TS_VFY_TSA_NAME)
0405 
0406 typedef struct TS_verify_ctx TS_VERIFY_CTX;
0407 
0408 int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response);
0409 int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token);
0410 
0411 /*
0412  * Declarations related to response verification context,
0413  */
0414 TS_VERIFY_CTX *TS_VERIFY_CTX_new(void);
0415 void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx);
0416 void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx);
0417 void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx);
0418 int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f);
0419 int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f);
0420 #ifndef OPENSSL_NO_DEPRECATED_3_4
0421 OSSL_DEPRECATEDIN_3_4_FOR("Unclear semantics, replace with TS_VERIFY_CTX_set0_data().")
0422 BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b);
0423 #endif
0424 int TS_VERIFY_CTX_set0_data(TS_VERIFY_CTX *ctx, BIO *b);
0425 #ifndef OPENSSL_NO_DEPRECATED_3_4
0426 OSSL_DEPRECATEDIN_3_4_FOR("Unclear semantics, replace with TS_VERIFY_CTX_set0_imprint().")
0427 unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,
0428     unsigned char *hexstr, long len);
0429 #endif
0430 int TS_VERIFY_CTX_set0_imprint(TS_VERIFY_CTX *ctx,
0431     unsigned char *hexstr, long len);
0432 #ifndef OPENSSL_NO_DEPRECATED_3_4
0433 OSSL_DEPRECATEDIN_3_4_FOR("Unclear semantics, replace with TS_VERIFY_CTX_set0_store().")
0434 X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s);
0435 #endif
0436 int TS_VERIFY_CTX_set0_store(TS_VERIFY_CTX *ctx, X509_STORE *s);
0437 #ifndef OPENSSL_NO_DEPRECATED_3_0
0438 #define TS_VERIFY_CTS_set_certs(ctx, cert) TS_VERIFY_CTX_set_certs(ctx, cert)
0439 #endif
0440 #ifndef OPENSSL_NO_DEPRECATED_3_4
0441 OSSL_DEPRECATEDIN_3_4_FOR("Unclear semantics, replace with TS_VERIFY_CTX_set0_certs().")
0442 STACK_OF(X509) *TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs);
0443 #endif
0444 int TS_VERIFY_CTX_set0_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs);
0445 
0446 /*-
0447  * If ctx is NULL, it allocates and returns a new object, otherwise
0448  * it returns ctx. It initialises all the members as follows:
0449  * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE)
0450  * certs = NULL
0451  * store = NULL
0452  * policy = policy from the request or NULL if absent (in this case
0453  *      TS_VFY_POLICY is cleared from flags as well)
0454  * md_alg = MD algorithm from request
0455  * imprint, imprint_len = imprint from request
0456  * data = NULL
0457  * nonce, nonce_len = nonce from the request or NULL if absent (in this case
0458  *      TS_VFY_NONCE is cleared from flags as well)
0459  * tsa_name = NULL
0460  * Important: after calling this method TS_VFY_SIGNATURE should be added!
0461  */
0462 TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx);
0463 
0464 /* Function declarations for TS_RESP defined in ts/ts_resp_print.c */
0465 
0466 int TS_RESP_print_bio(BIO *bio, TS_RESP *a);
0467 int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a);
0468 int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a);
0469 
0470 /* Common utility functions defined in ts/ts_lib.c */
0471 
0472 int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num);
0473 int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj);
0474 int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions);
0475 int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg);
0476 int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);
0477 
0478 /*
0479  * Function declarations for handling configuration options, defined in
0480  * ts/ts_conf.c
0481  */
0482 
0483 X509 *TS_CONF_load_cert(const char *file);
0484 STACK_OF(X509) *TS_CONF_load_certs(const char *file);
0485 EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
0486 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
0487 int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
0488     TS_RESP_CTX *ctx);
0489 #ifndef OPENSSL_NO_ENGINE
0490 int TS_CONF_set_crypto_device(CONF *conf, const char *section,
0491     const char *device);
0492 int TS_CONF_set_default_engine(const char *name);
0493 #endif
0494 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
0495     const char *cert, TS_RESP_CTX *ctx);
0496 int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
0497     TS_RESP_CTX *ctx);
0498 int TS_CONF_set_signer_key(CONF *conf, const char *section,
0499     const char *key, const char *pass,
0500     TS_RESP_CTX *ctx);
0501 int TS_CONF_set_signer_digest(CONF *conf, const char *section,
0502     const char *md, TS_RESP_CTX *ctx);
0503 int TS_CONF_set_def_policy(CONF *conf, const char *section,
0504     const char *policy, TS_RESP_CTX *ctx);
0505 int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);
0506 int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx);
0507 int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx);
0508 int TS_CONF_set_clock_precision_digits(const CONF *conf, const char *section,
0509     TS_RESP_CTX *ctx);
0510 int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx);
0511 int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx);
0512 int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section,
0513     TS_RESP_CTX *ctx);
0514 int TS_CONF_set_ess_cert_id_digest(CONF *conf, const char *section,
0515     TS_RESP_CTX *ctx);
0516 
0517 #ifdef __cplusplus
0518 }
0519 #endif
0520 #endif
0521 #endif