summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bf_nbio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bio/bf_nbio.c')
-rw-r--r--src/lib/libcrypto/bio/bf_nbio.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bio/bf_nbio.c b/src/lib/libcrypto/bio/bf_nbio.c
index cbec2bae29..5e574b7231 100644
--- a/src/lib/libcrypto/bio/bf_nbio.c
+++ b/src/lib/libcrypto/bio/bf_nbio.c
@@ -73,6 +73,7 @@ static int nbiof_gets(BIO *h,char *str,int size);
73static long nbiof_ctrl(BIO *h,int cmd,long arg1,char *arg2); 73static long nbiof_ctrl(BIO *h,int cmd,long arg1,char *arg2);
74static int nbiof_new(BIO *h); 74static int nbiof_new(BIO *h);
75static int nbiof_free(BIO *data); 75static int nbiof_free(BIO *data);
76static long nbiof_callback_ctrl(BIO *h,int cmd,void (*fp)());
76typedef struct nbio_test_st 77typedef struct nbio_test_st
77 { 78 {
78 /* only set if we sent a 'should retry' error */ 79 /* only set if we sent a 'should retry' error */
@@ -91,6 +92,7 @@ static BIO_METHOD methods_nbiof=
91 nbiof_ctrl, 92 nbiof_ctrl,
92 nbiof_new, 93 nbiof_new,
93 nbiof_free, 94 nbiof_free,
95 nbiof_callback_ctrl,
94 }; 96 };
95 97
96BIO_METHOD *BIO_f_nbio_test(void) 98BIO_METHOD *BIO_f_nbio_test(void)
@@ -137,7 +139,7 @@ static int nbiof_read(BIO *b, char *out, int outl)
137 139
138 BIO_clear_retry_flags(b); 140 BIO_clear_retry_flags(b);
139#if 0 141#if 0
140 RAND_bytes(&n,1); 142 RAND_pseudo_bytes(&n,1);
141 num=(n&0x07); 143 num=(n&0x07);
142 144
143 if (outl > num) outl=num; 145 if (outl > num) outl=num;
@@ -178,7 +180,7 @@ static int nbiof_write(BIO *b, char *in, int inl)
178 } 180 }
179 else 181 else
180 { 182 {
181 RAND_bytes(&n,1); 183 RAND_pseudo_bytes(&n,1);
182 num=(n&7); 184 num=(n&7);
183 } 185 }
184 186
@@ -224,6 +226,20 @@ static long nbiof_ctrl(BIO *b, int cmd, long num, char *ptr)
224 return(ret); 226 return(ret);
225 } 227 }
226 228
229static long nbiof_callback_ctrl(BIO *b, int cmd, void (*fp)())
230 {
231 long ret=1;
232
233 if (b->next_bio == NULL) return(0);
234 switch (cmd)
235 {
236 default:
237 ret=BIO_callback_ctrl(b->next_bio,cmd,fp);
238 break;
239 }
240 return(ret);
241 }
242
227static int nbiof_gets(BIO *bp, char *buf, int size) 243static int nbiof_gets(BIO *bp, char *buf, int size)
228 { 244 {
229 if (bp->next_bio == NULL) return(0); 245 if (bp->next_bio == NULL) return(0);