69 #define DEFAULT_ASN1_BUF_SIZE 20
113 static int asn1_bio_write(
BIO *
h,
const char *buf,
int num);
114 static int asn1_bio_read(
BIO *
h,
char *buf,
int size);
115 static int asn1_bio_puts(
BIO *
h,
const char *str);
116 static int asn1_bio_gets(
BIO *
h,
char *str,
int size);
117 static long asn1_bio_ctrl(
BIO *
h,
int cmd,
long arg1,
void *arg2);
118 static int asn1_bio_new(
BIO *
h);
119 static int asn1_bio_free(
BIO *
data);
141 asn1_bio_callback_ctrl,
146 return(&methods_asn1);
150 static int asn1_bio_new(
BIO *
b)
159 b->
ptr = (
char *)ctx;
182 static int asn1_bio_free(
BIO *b)
197 static int asn1_bio_write(
BIO *b,
const char *in ,
int inl)
200 int wrmax, wrlen, ret;
202 if (!in || (inl < 0) || (b->
next_bio == NULL))
218 if (!asn1_bio_setup_ex(b, ctx, ctx->
prefix,
297 return (wrlen > 0) ? wrlen : ret;
340 ctx->
state = ex_state;
342 ctx->
state = other_state;
346 static int asn1_bio_read(
BIO *b,
char *in ,
int inl)
353 static int asn1_bio_puts(
BIO *b,
const char *str)
355 return asn1_bio_write(b, str, strlen(str));
358 static int asn1_bio_gets(
BIO *b,
char *str,
int size)
371 static long asn1_bio_ctrl(
BIO *b,
int cmd,
long arg1,
void *arg2)
411 *(
void **)arg2 = ctx->
ex_arg;
421 if (!asn1_bio_setup_ex(b, ctx, ctx->
suffix,
454 static int asn1_bio_set_ex(
BIO *b,
int cmd,
463 static int asn1_bio_get_ex(
BIO *b,
int cmd,