version 1.18, 2022/03/24 11:27:45 |
version 1.19, 2022/03/24 11:40:07 |
|
|
|
|
/* Query related functions. */ |
/* Query related functions. */ |
static int query_command(const char *data, char *digest, |
static int query_command(const char *data, char *digest, |
const EVP_MD * md, const char *policy, int no_nonce, |
const EVP_MD *md, const char *policy, int no_nonce, |
int cert, const char *in, const char *out, int text); |
int cert, const char *in, const char *out, int text); |
static BIO *BIO_open_with_default(const char *file, const char *mode, |
static BIO *BIO_open_with_default(const char *file, const char *mode, |
FILE * default_fp); |
FILE *default_fp); |
static TS_REQ *create_query(BIO * data_bio, char *digest, const EVP_MD * md, |
static TS_REQ *create_query(BIO *data_bio, char *digest, const EVP_MD *md, |
const char *policy, int no_nonce, int cert); |
const char *policy, int no_nonce, int cert); |
static int create_digest(BIO * input, char *digest, |
static int create_digest(BIO *input, char *digest, |
const EVP_MD * md, unsigned char **md_value); |
const EVP_MD *md, unsigned char **md_value); |
static ASN1_INTEGER *create_nonce(int bits); |
static ASN1_INTEGER *create_nonce(int bits); |
|
|
/* Reply related functions. */ |
/* Reply related functions. */ |
static int reply_command(CONF * conf, char *section, |
static int reply_command(CONF *conf, char *section, |
char *queryfile, char *passin, char *inkey, |
char *queryfile, char *passin, char *inkey, |
char *signer, char *chain, const char *policy, |
char *signer, char *chain, const char *policy, |
char *in, int token_in, char *out, int token_out, |
char *in, int token_in, char *out, int token_out, |
int text); |
int text); |
static TS_RESP *read_PKCS7(BIO * in_bio); |
static TS_RESP *read_PKCS7(BIO *in_bio); |
static TS_RESP *create_response(CONF * conf, const char *section, |
static TS_RESP *create_response(CONF *conf, const char *section, |
char *queryfile, char *passin, char *inkey, |
char *queryfile, char *passin, char *inkey, |
char *signer, char *chain, const char *policy); |
char *signer, char *chain, const char *policy); |
static ASN1_INTEGER *serial_cb(TS_RESP_CTX * ctx, void *data); |
static ASN1_INTEGER *serial_cb(TS_RESP_CTX *ctx, void *data); |
static ASN1_INTEGER *next_serial(const char *serialfile); |
static ASN1_INTEGER *next_serial(const char *serialfile); |
static int save_ts_serial(const char *serialfile, ASN1_INTEGER * serial); |
static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial); |
|
|
/* Verify related functions. */ |
/* Verify related functions. */ |
static int verify_command(char *data, char *digest, char *queryfile, |
static int verify_command(char *data, char *digest, char *queryfile, |
|
|
char *ca_path, char *ca_file, |
char *ca_path, char *ca_file, |
char *untrusted); |
char *untrusted); |
static X509_STORE *create_cert_store(char *ca_path, char *ca_file); |
static X509_STORE *create_cert_store(char *ca_path, char *ca_file); |
static int verify_cb(int ok, X509_STORE_CTX * ctx); |
static int verify_cb(int ok, X509_STORE_CTX *ctx); |
|
|
enum mode { |
enum mode { |
CMD_NONE, CMD_QUERY, CMD_REPLY, CMD_VERIFY |
CMD_NONE, CMD_QUERY, CMD_REPLY, CMD_VERIFY |
|
|
*/ |
*/ |
|
|
static int |
static int |
query_command(const char *data, char *digest, const EVP_MD * md, |
query_command(const char *data, char *digest, const EVP_MD *md, |
const char *policy, int no_nonce, int cert, const char *in, |
const char *policy, int no_nonce, int cert, const char *in, |
const char *out, int text) |
const char *out, int text) |
{ |
{ |
|
|
} |
} |
|
|
static BIO * |
static BIO * |
BIO_open_with_default(const char *file, const char *mode, FILE * default_fp) |
BIO_open_with_default(const char *file, const char *mode, FILE *default_fp) |
{ |
{ |
return file == NULL ? BIO_new_fp(default_fp, BIO_NOCLOSE) : |
return file == NULL ? BIO_new_fp(default_fp, BIO_NOCLOSE) : |
BIO_new_file(file, mode); |
BIO_new_file(file, mode); |
} |
} |
|
|
static TS_REQ * |
static TS_REQ * |
create_query(BIO * data_bio, char *digest, const EVP_MD * md, |
create_query(BIO *data_bio, char *digest, const EVP_MD *md, |
const char *policy, int no_nonce, int cert) |
const char *policy, int no_nonce, int cert) |
{ |
{ |
int ret = 0; |
int ret = 0; |
|
|
} |
} |
|
|
static int |
static int |
create_digest(BIO * input, char *digest, const EVP_MD * md, |
create_digest(BIO *input, char *digest, const EVP_MD *md, |
unsigned char **md_value) |
unsigned char **md_value) |
{ |
{ |
int md_value_len; |
int md_value_len; |
|
|
*/ |
*/ |
|
|
static int |
static int |
reply_command(CONF * conf, char *section, char *queryfile, |
reply_command(CONF *conf, char *section, char *queryfile, |
char *passin, char *inkey, char *signer, char *chain, const char *policy, |
char *passin, char *inkey, char *signer, char *chain, const char *policy, |
char *in, int token_in, char *out, int token_out, int text) |
char *in, int token_in, char *out, int token_out, int text) |
{ |
{ |
|
|
|
|
/* Reads a PKCS7 token and adds default 'granted' status info to it. */ |
/* Reads a PKCS7 token and adds default 'granted' status info to it. */ |
static TS_RESP * |
static TS_RESP * |
read_PKCS7(BIO * in_bio) |
read_PKCS7(BIO *in_bio) |
{ |
{ |
int ret = 0; |
int ret = 0; |
PKCS7 *token = NULL; |
PKCS7 *token = NULL; |
|
|
} |
} |
|
|
static TS_RESP * |
static TS_RESP * |
create_response(CONF * conf, const char *section, |
create_response(CONF *conf, const char *section, |
char *queryfile, char *passin, char *inkey, |
char *queryfile, char *passin, char *inkey, |
char *signer, char *chain, const char *policy) |
char *signer, char *chain, const char *policy) |
{ |
{ |
|
|
} |
} |
|
|
static ASN1_INTEGER * |
static ASN1_INTEGER * |
serial_cb(TS_RESP_CTX * ctx, void *data) |
serial_cb(TS_RESP_CTX *ctx, void *data) |
{ |
{ |
const char *serial_file = (const char *) data; |
const char *serial_file = (const char *) data; |
ASN1_INTEGER *serial = next_serial(serial_file); |
ASN1_INTEGER *serial = next_serial(serial_file); |
|
|
} |
} |
|
|
static int |
static int |
save_ts_serial(const char *serialfile, ASN1_INTEGER * serial) |
save_ts_serial(const char *serialfile, ASN1_INTEGER *serial) |
{ |
{ |
int ret = 0; |
int ret = 0; |
BIO *out = NULL; |
BIO *out = NULL; |
|
|
} |
} |
|
|
static int |
static int |
verify_cb(int ok, X509_STORE_CTX * ctx) |
verify_cb(int ok, X509_STORE_CTX *ctx) |
{ |
{ |
/* |
/* |
char buf[256]; |
char buf[256]; |