2016-08-24 22:13:11 +02:00
|
|
|
#include <openssl/opensslconf.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <sys/syslog.h>
|
|
|
|
#include <openssl/bio.h>
|
|
|
|
#include <openssl/err.h>
|
|
|
|
#include <openssl/pem.h>
|
|
|
|
#include <openssl/rand.h>
|
|
|
|
#include <openssl/ts.h>
|
|
|
|
#include <openssl/bn.h>
|
2016-08-26 20:39:45 +02:00
|
|
|
#include "context.h"
|
2016-08-24 22:13:11 +02:00
|
|
|
|
|
|
|
/* Name of config entry that defines the OID file. */
|
|
|
|
#define ENV_OID_FILE "oid_file"
|
|
|
|
|
2016-08-26 01:28:34 +02:00
|
|
|
#define B_FORMAT_TEXT 0x8000
|
|
|
|
#define FORMAT_UNDEF 0
|
|
|
|
#define FORMAT_TEXT (1 | B_FORMAT_TEXT) /* Generic text */
|
|
|
|
#define FORMAT_ASN1 4 /* ASN.1/DER */
|
|
|
|
|
2016-08-24 22:13:11 +02:00
|
|
|
static ASN1_OBJECT *txt2obj(const char *oid);
|
|
|
|
|
|
|
|
/* Reply related functions. */
|
|
|
|
static int reply_command(CONF *conf, char *section, char *engine, char *query,
|
|
|
|
char *passin, char *inkey, const EVP_MD *md,
|
|
|
|
char *signer, char *chain, const char *policy,
|
|
|
|
char *in, int token_in, char *out, int token_out,
|
|
|
|
int text);
|
|
|
|
static TS_RESP *read_PKCS7(BIO *in_bio);
|
2016-08-30 22:55:25 +02:00
|
|
|
int create_response(rfc3161_context *ct, char *query, int query_len,
|
2016-08-31 00:09:17 +02:00
|
|
|
TS_RESP_CTX *resp_ctx, size_t *resp_size,
|
2016-09-02 00:36:25 +02:00
|
|
|
unsigned char **resp, char **serial_id);
|
2016-08-24 22:13:11 +02:00
|
|
|
static ASN1_INTEGER *serial_cb(TS_RESP_CTX *ctx, void *data);
|
|
|
|
static ASN1_INTEGER *next_serial(const char *serialfile);
|
|
|
|
static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial);
|
2016-08-26 20:39:45 +02:00
|
|
|
TS_RESP_CTX *create_tsctx(rfc3161_context *ct, CONF *conf, const char *section,
|
|
|
|
const char *policy);
|
2016-08-27 11:39:53 +02:00
|
|
|
int add_oid_section(rfc3161_context *ct, CONF *conf);
|
2016-09-08 23:21:53 +02:00
|
|
|
ts_resp_ctx_wrapper *get_ctxw(rfc3161_context *ct);
|
2016-09-02 07:42:23 +02:00
|
|
|
void init_ssl();
|
2016-09-02 08:00:04 +02:00
|
|
|
void free_ssl();
|