2015-01-22 03:40:55 +00:00
|
|
|
/*
|
2016-05-17 18:52:22 +00:00
|
|
|
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2006-12-24 16:22:56 +00:00
|
|
|
*
|
2016-05-17 18:52:22 +00:00
|
|
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
2006-12-24 16:22:56 +00:00
|
|
|
*/
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
/*
|
|
|
|
* Experimental ASN1 BIO. When written through the data is converted to an
|
|
|
|
* ASN1 string type: default is OCTET STRING. Additional functions can be
|
|
|
|
* provided to add prefix and suffix data.
|
2006-12-24 16:22:56 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
2016-03-22 09:21:29 +00:00
|
|
|
#include <internal/bio.h>
|
2006-12-24 16:22:56 +00:00
|
|
|
#include <openssl/asn1.h>
|
|
|
|
|
|
|
|
/* Must be large enough for biggest tag+length */
|
|
|
|
#define DEFAULT_ASN1_BUF_SIZE 20
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
typedef enum {
|
|
|
|
ASN1_STATE_START,
|
|
|
|
ASN1_STATE_PRE_COPY,
|
|
|
|
ASN1_STATE_HEADER,
|
|
|
|
ASN1_STATE_HEADER_COPY,
|
|
|
|
ASN1_STATE_DATA_COPY,
|
|
|
|
ASN1_STATE_POST_COPY,
|
|
|
|
ASN1_STATE_DONE
|
|
|
|
} asn1_bio_state_t;
|
|
|
|
|
|
|
|
typedef struct BIO_ASN1_EX_FUNCS_st {
|
|
|
|
asn1_ps_func *ex_func;
|
|
|
|
asn1_ps_func *ex_free_func;
|
|
|
|
} BIO_ASN1_EX_FUNCS;
|
|
|
|
|
|
|
|
typedef struct BIO_ASN1_BUF_CTX_t {
|
|
|
|
/* Internal state */
|
|
|
|
asn1_bio_state_t state;
|
|
|
|
/* Internal buffer */
|
|
|
|
unsigned char *buf;
|
|
|
|
/* Size of buffer */
|
|
|
|
int bufsize;
|
|
|
|
/* Current position in buffer */
|
|
|
|
int bufpos;
|
|
|
|
/* Current buffer length */
|
|
|
|
int buflen;
|
|
|
|
/* Amount of data to copy */
|
|
|
|
int copylen;
|
|
|
|
/* Class and tag to use */
|
|
|
|
int asn1_class, asn1_tag;
|
|
|
|
asn1_ps_func *prefix, *prefix_free, *suffix, *suffix_free;
|
|
|
|
/* Extra buffer for prefix and suffix data */
|
|
|
|
unsigned char *ex_buf;
|
|
|
|
int ex_len;
|
|
|
|
int ex_pos;
|
|
|
|
void *ex_arg;
|
|
|
|
} BIO_ASN1_BUF_CTX;
|
|
|
|
|
|
|
|
static int asn1_bio_write(BIO *h, const char *buf, int num);
|
2006-12-24 16:22:56 +00:00
|
|
|
static int asn1_bio_read(BIO *h, char *buf, int size);
|
|
|
|
static int asn1_bio_puts(BIO *h, const char *str);
|
|
|
|
static int asn1_bio_gets(BIO *h, char *str, int size);
|
|
|
|
static long asn1_bio_ctrl(BIO *h, int cmd, long arg1, void *arg2);
|
|
|
|
static int asn1_bio_new(BIO *h);
|
|
|
|
static int asn1_bio_free(BIO *data);
|
|
|
|
static long asn1_bio_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
|
|
|
|
|
|
|
|
static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size);
|
|
|
|
static int asn1_bio_flush_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
|
2015-01-22 03:40:55 +00:00
|
|
|
asn1_ps_func *cleanup, asn1_bio_state_t next);
|
2006-12-24 16:22:56 +00:00
|
|
|
static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
|
2015-01-22 03:40:55 +00:00
|
|
|
asn1_ps_func *setup,
|
|
|
|
asn1_bio_state_t ex_state,
|
|
|
|
asn1_bio_state_t other_state);
|
|
|
|
|
2016-03-19 16:32:14 +00:00
|
|
|
static const BIO_METHOD methods_asn1 = {
|
2015-01-22 03:40:55 +00:00
|
|
|
BIO_TYPE_ASN1,
|
|
|
|
"asn1",
|
2016-10-20 14:18:39 +00:00
|
|
|
/* TODO: Convert to new style write function */
|
|
|
|
bwrite_conv,
|
2015-01-22 03:40:55 +00:00
|
|
|
asn1_bio_write,
|
2016-09-05 16:26:58 +00:00
|
|
|
/* TODO: Convert to new style read function */
|
|
|
|
bread_conv,
|
2015-01-22 03:40:55 +00:00
|
|
|
asn1_bio_read,
|
|
|
|
asn1_bio_puts,
|
|
|
|
asn1_bio_gets,
|
|
|
|
asn1_bio_ctrl,
|
|
|
|
asn1_bio_new,
|
|
|
|
asn1_bio_free,
|
|
|
|
asn1_bio_callback_ctrl,
|
|
|
|
};
|
2006-12-24 16:22:56 +00:00
|
|
|
|
2016-03-19 16:32:14 +00:00
|
|
|
const BIO_METHOD *BIO_f_asn1(void)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
return (&methods_asn1);
|
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static int asn1_bio_new(BIO *b)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
2016-03-06 20:40:58 +00:00
|
|
|
BIO_ASN1_BUF_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
|
2016-03-06 20:26:46 +00:00
|
|
|
|
2015-10-30 11:12:26 +00:00
|
|
|
if (ctx == NULL)
|
2015-01-22 03:40:55 +00:00
|
|
|
return 0;
|
|
|
|
if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE)) {
|
|
|
|
OPENSSL_free(ctx);
|
|
|
|
return 0;
|
|
|
|
}
|
2016-03-22 09:21:29 +00:00
|
|
|
BIO_set_data(b, ctx);
|
|
|
|
BIO_set_init(b, 1);
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
ctx->buf = OPENSSL_malloc(size);
|
2015-10-30 11:12:26 +00:00
|
|
|
if (ctx->buf == NULL)
|
2015-01-22 03:40:55 +00:00
|
|
|
return 0;
|
|
|
|
ctx->bufsize = size;
|
|
|
|
ctx->asn1_class = V_ASN1_UNIVERSAL;
|
|
|
|
ctx->asn1_tag = V_ASN1_OCTET_STRING;
|
|
|
|
ctx->state = ASN1_STATE_START;
|
|
|
|
return 1;
|
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static int asn1_bio_free(BIO *b)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
2016-03-22 09:21:29 +00:00
|
|
|
BIO_ASN1_BUF_CTX *ctx;
|
|
|
|
|
|
|
|
if (b == NULL)
|
|
|
|
return 0;
|
2015-03-25 15:31:18 +00:00
|
|
|
|
2016-03-22 09:21:29 +00:00
|
|
|
ctx = BIO_get_data(b);
|
2015-01-22 03:40:55 +00:00
|
|
|
if (ctx == NULL)
|
|
|
|
return 0;
|
2016-03-22 09:21:29 +00:00
|
|
|
|
2015-05-01 14:02:07 +00:00
|
|
|
OPENSSL_free(ctx->buf);
|
2015-01-22 03:40:55 +00:00
|
|
|
OPENSSL_free(ctx);
|
2016-03-22 09:21:29 +00:00
|
|
|
BIO_set_data(b, NULL);
|
|
|
|
BIO_set_init(b, 0);
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int asn1_bio_write(BIO *b, const char *in, int inl)
|
|
|
|
{
|
|
|
|
BIO_ASN1_BUF_CTX *ctx;
|
|
|
|
int wrmax, wrlen, ret;
|
|
|
|
unsigned char *p;
|
2016-03-22 09:21:29 +00:00
|
|
|
BIO *next;
|
|
|
|
|
|
|
|
ctx = BIO_get_data(b);
|
|
|
|
next = BIO_next(b);
|
|
|
|
if (in == NULL || inl < 0 || ctx == NULL || next == NULL)
|
2015-01-22 03:40:55 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
wrlen = 0;
|
|
|
|
ret = -1;
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
switch (ctx->state) {
|
|
|
|
/* Setup prefix data, call it */
|
|
|
|
case ASN1_STATE_START:
|
|
|
|
if (!asn1_bio_setup_ex(b, ctx, ctx->prefix,
|
|
|
|
ASN1_STATE_PRE_COPY, ASN1_STATE_HEADER))
|
|
|
|
return 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Copy any pre data first */
|
|
|
|
case ASN1_STATE_PRE_COPY:
|
|
|
|
|
|
|
|
ret = asn1_bio_flush_ex(b, ctx, ctx->prefix_free,
|
|
|
|
ASN1_STATE_HEADER);
|
|
|
|
|
|
|
|
if (ret <= 0)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASN1_STATE_HEADER:
|
|
|
|
ctx->buflen = ASN1_object_size(0, inl, ctx->asn1_tag) - inl;
|
|
|
|
OPENSSL_assert(ctx->buflen <= ctx->bufsize);
|
|
|
|
p = ctx->buf;
|
|
|
|
ASN1_put_object(&p, 0, inl, ctx->asn1_tag, ctx->asn1_class);
|
|
|
|
ctx->copylen = inl;
|
|
|
|
ctx->state = ASN1_STATE_HEADER_COPY;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASN1_STATE_HEADER_COPY:
|
2016-03-22 09:21:29 +00:00
|
|
|
ret = BIO_write(next, ctx->buf + ctx->bufpos, ctx->buflen);
|
2015-01-22 03:40:55 +00:00
|
|
|
if (ret <= 0)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
ctx->buflen -= ret;
|
|
|
|
if (ctx->buflen)
|
|
|
|
ctx->bufpos += ret;
|
|
|
|
else {
|
|
|
|
ctx->bufpos = 0;
|
|
|
|
ctx->state = ASN1_STATE_DATA_COPY;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ASN1_STATE_DATA_COPY:
|
|
|
|
|
|
|
|
if (inl > ctx->copylen)
|
|
|
|
wrmax = ctx->copylen;
|
|
|
|
else
|
|
|
|
wrmax = inl;
|
2016-03-22 09:21:29 +00:00
|
|
|
ret = BIO_write(next, in, wrmax);
|
2015-01-22 03:40:55 +00:00
|
|
|
if (ret <= 0)
|
2017-03-01 04:22:21 +00:00
|
|
|
goto done;
|
2015-01-22 03:40:55 +00:00
|
|
|
wrlen += ret;
|
|
|
|
ctx->copylen -= ret;
|
|
|
|
in += ret;
|
|
|
|
inl -= ret;
|
|
|
|
|
|
|
|
if (ctx->copylen == 0)
|
|
|
|
ctx->state = ASN1_STATE_HEADER;
|
|
|
|
|
|
|
|
if (inl == 0)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2016-08-30 17:31:18 +00:00
|
|
|
case ASN1_STATE_POST_COPY:
|
|
|
|
case ASN1_STATE_DONE:
|
2015-01-22 03:40:55 +00:00
|
|
|
BIO_clear_retry_flags(b);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
BIO_clear_retry_flags(b);
|
|
|
|
BIO_copy_next_retry(b);
|
|
|
|
|
|
|
|
return (wrlen > 0) ? wrlen : ret;
|
|
|
|
|
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static int asn1_bio_flush_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
|
2015-01-22 03:40:55 +00:00
|
|
|
asn1_ps_func *cleanup, asn1_bio_state_t next)
|
|
|
|
{
|
|
|
|
int ret;
|
2016-03-22 09:21:29 +00:00
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
if (ctx->ex_len <= 0)
|
|
|
|
return 1;
|
|
|
|
for (;;) {
|
2016-03-22 09:21:29 +00:00
|
|
|
ret = BIO_write(BIO_next(b), ctx->ex_buf + ctx->ex_pos, ctx->ex_len);
|
2015-01-22 03:40:55 +00:00
|
|
|
if (ret <= 0)
|
|
|
|
break;
|
|
|
|
ctx->ex_len -= ret;
|
|
|
|
if (ctx->ex_len > 0)
|
|
|
|
ctx->ex_pos += ret;
|
|
|
|
else {
|
|
|
|
if (cleanup)
|
|
|
|
cleanup(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg);
|
|
|
|
ctx->state = next;
|
|
|
|
ctx->ex_pos = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx,
|
2015-01-22 03:40:55 +00:00
|
|
|
asn1_ps_func *setup,
|
|
|
|
asn1_bio_state_t ex_state,
|
|
|
|
asn1_bio_state_t other_state)
|
|
|
|
{
|
|
|
|
if (setup && !setup(b, &ctx->ex_buf, &ctx->ex_len, &ctx->ex_arg)) {
|
|
|
|
BIO_clear_retry_flags(b);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (ctx->ex_len > 0)
|
|
|
|
ctx->state = ex_state;
|
|
|
|
else
|
|
|
|
ctx->state = other_state;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int asn1_bio_read(BIO *b, char *in, int inl)
|
|
|
|
{
|
2016-03-22 09:21:29 +00:00
|
|
|
BIO *next = BIO_next(b);
|
|
|
|
if (next == NULL)
|
2015-01-22 03:40:55 +00:00
|
|
|
return 0;
|
2016-03-22 09:21:29 +00:00
|
|
|
return BIO_read(next, in, inl);
|
2015-01-22 03:40:55 +00:00
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static int asn1_bio_puts(BIO *b, const char *str)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
return asn1_bio_write(b, str, strlen(str));
|
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static int asn1_bio_gets(BIO *b, char *str, int size)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
2016-03-22 09:21:29 +00:00
|
|
|
BIO *next = BIO_next(b);
|
|
|
|
if (next == NULL)
|
2015-01-22 03:40:55 +00:00
|
|
|
return 0;
|
2016-03-22 09:21:29 +00:00
|
|
|
return BIO_gets(next, str, size);
|
2015-01-22 03:40:55 +00:00
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static long asn1_bio_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
2016-03-22 09:21:29 +00:00
|
|
|
BIO *next = BIO_next(b);
|
|
|
|
if (next == NULL)
|
|
|
|
return 0;
|
|
|
|
return BIO_callback_ctrl(next, cmd, fp);
|
2015-01-22 03:40:55 +00:00
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static long asn1_bio_ctrl(BIO *b, int cmd, long arg1, void *arg2)
|
2015-01-22 03:40:55 +00:00
|
|
|
{
|
|
|
|
BIO_ASN1_BUF_CTX *ctx;
|
|
|
|
BIO_ASN1_EX_FUNCS *ex_func;
|
|
|
|
long ret = 1;
|
2016-03-22 09:21:29 +00:00
|
|
|
BIO *next;
|
|
|
|
|
|
|
|
ctx = BIO_get_data(b);
|
2015-01-22 03:40:55 +00:00
|
|
|
if (ctx == NULL)
|
|
|
|
return 0;
|
2016-03-22 09:21:29 +00:00
|
|
|
next = BIO_next(b);
|
2015-01-22 03:40:55 +00:00
|
|
|
switch (cmd) {
|
|
|
|
|
|
|
|
case BIO_C_SET_PREFIX:
|
|
|
|
ex_func = arg2;
|
|
|
|
ctx->prefix = ex_func->ex_func;
|
|
|
|
ctx->prefix_free = ex_func->ex_free_func;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BIO_C_GET_PREFIX:
|
|
|
|
ex_func = arg2;
|
|
|
|
ex_func->ex_func = ctx->prefix;
|
|
|
|
ex_func->ex_free_func = ctx->prefix_free;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BIO_C_SET_SUFFIX:
|
|
|
|
ex_func = arg2;
|
|
|
|
ctx->suffix = ex_func->ex_func;
|
|
|
|
ctx->suffix_free = ex_func->ex_free_func;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BIO_C_GET_SUFFIX:
|
|
|
|
ex_func = arg2;
|
|
|
|
ex_func->ex_func = ctx->suffix;
|
|
|
|
ex_func->ex_free_func = ctx->suffix_free;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BIO_C_SET_EX_ARG:
|
|
|
|
ctx->ex_arg = arg2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BIO_C_GET_EX_ARG:
|
|
|
|
*(void **)arg2 = ctx->ex_arg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BIO_CTRL_FLUSH:
|
2016-03-22 09:21:29 +00:00
|
|
|
if (next == NULL)
|
2015-01-22 03:40:55 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Call post function if possible */
|
|
|
|
if (ctx->state == ASN1_STATE_HEADER) {
|
|
|
|
if (!asn1_bio_setup_ex(b, ctx, ctx->suffix,
|
|
|
|
ASN1_STATE_POST_COPY, ASN1_STATE_DONE))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->state == ASN1_STATE_POST_COPY) {
|
|
|
|
ret = asn1_bio_flush_ex(b, ctx, ctx->suffix_free,
|
|
|
|
ASN1_STATE_DONE);
|
|
|
|
if (ret <= 0)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->state == ASN1_STATE_DONE)
|
2016-03-22 09:21:29 +00:00
|
|
|
return BIO_ctrl(next, cmd, arg1, arg2);
|
2015-01-22 03:40:55 +00:00
|
|
|
else {
|
|
|
|
BIO_clear_retry_flags(b);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
2016-03-22 09:21:29 +00:00
|
|
|
if (next == NULL)
|
2015-01-22 03:40:55 +00:00
|
|
|
return 0;
|
2016-03-22 09:21:29 +00:00
|
|
|
return BIO_ctrl(next, cmd, arg1, arg2);
|
2015-01-22 03:40:55 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static int asn1_bio_set_ex(BIO *b, int cmd,
|
2015-01-22 03:40:55 +00:00
|
|
|
asn1_ps_func *ex_func, asn1_ps_func *ex_free_func)
|
|
|
|
{
|
|
|
|
BIO_ASN1_EX_FUNCS extmp;
|
|
|
|
extmp.ex_func = ex_func;
|
|
|
|
extmp.ex_free_func = ex_free_func;
|
|
|
|
return BIO_ctrl(b, cmd, 0, &extmp);
|
|
|
|
}
|
2006-12-24 16:22:56 +00:00
|
|
|
|
|
|
|
static int asn1_bio_get_ex(BIO *b, int cmd,
|
2015-01-22 03:40:55 +00:00
|
|
|
asn1_ps_func **ex_func,
|
|
|
|
asn1_ps_func **ex_free_func)
|
|
|
|
{
|
|
|
|
BIO_ASN1_EX_FUNCS extmp;
|
|
|
|
int ret;
|
|
|
|
ret = BIO_ctrl(b, cmd, 0, &extmp);
|
|
|
|
if (ret > 0) {
|
|
|
|
*ex_func = extmp.ex_func;
|
|
|
|
*ex_free_func = extmp.ex_free_func;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
|
|
|
|
asn1_ps_func *prefix_free)
|
|
|
|
{
|
|
|
|
return asn1_bio_set_ex(b, BIO_C_SET_PREFIX, prefix, prefix_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,
|
|
|
|
asn1_ps_func **pprefix_free)
|
|
|
|
{
|
|
|
|
return asn1_bio_get_ex(b, BIO_C_GET_PREFIX, pprefix, pprefix_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
|
|
|
|
asn1_ps_func *suffix_free)
|
|
|
|
{
|
|
|
|
return asn1_bio_set_ex(b, BIO_C_SET_SUFFIX, suffix, suffix_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
|
|
|
|
asn1_ps_func **psuffix_free)
|
|
|
|
{
|
|
|
|
return asn1_bio_get_ex(b, BIO_C_GET_SUFFIX, psuffix, psuffix_free);
|
|
|
|
}
|