diff options
Diffstat (limited to 'src/lib/libcrypto/bio/bf_buff.c')
-rw-r--r-- | src/lib/libcrypto/bio/bf_buff.c | 49 |
1 files changed, 11 insertions, 38 deletions
diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c index 7912b88473..acd8148138 100644 --- a/src/lib/libcrypto/bio/bf_buff.c +++ b/src/lib/libcrypto/bio/bf_buff.c | |||
@@ -59,10 +59,9 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include <errno.h> | 60 | #include <errno.h> |
61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
62 | #include "bio.h" | 62 | #include <openssl/bio.h> |
63 | #include "evp.h" | 63 | #include <openssl/evp.h> |
64 | 64 | ||
65 | #ifndef NOPROTO | ||
66 | static int buffer_write(BIO *h,char *buf,int num); | 65 | static int buffer_write(BIO *h,char *buf,int num); |
67 | static int buffer_read(BIO *h,char *buf,int size); | 66 | static int buffer_read(BIO *h,char *buf,int size); |
68 | static int buffer_puts(BIO *h,char *str); | 67 | static int buffer_puts(BIO *h,char *str); |
@@ -70,16 +69,6 @@ static int buffer_gets(BIO *h,char *str,int size); | |||
70 | static long buffer_ctrl(BIO *h,int cmd,long arg1,char *arg2); | 69 | static long buffer_ctrl(BIO *h,int cmd,long arg1,char *arg2); |
71 | static int buffer_new(BIO *h); | 70 | static int buffer_new(BIO *h); |
72 | static int buffer_free(BIO *data); | 71 | static int buffer_free(BIO *data); |
73 | #else | ||
74 | static int buffer_write(); | ||
75 | static int buffer_read(); | ||
76 | static int buffer_puts(); | ||
77 | static int buffer_gets(); | ||
78 | static long buffer_ctrl(); | ||
79 | static int buffer_new(); | ||
80 | static int buffer_free(); | ||
81 | #endif | ||
82 | |||
83 | #define DEFAULT_BUFFER_SIZE 1024 | 72 | #define DEFAULT_BUFFER_SIZE 1024 |
84 | 73 | ||
85 | static BIO_METHOD methods_buffer= | 74 | static BIO_METHOD methods_buffer= |
@@ -95,13 +84,12 @@ static BIO_METHOD methods_buffer= | |||
95 | buffer_free, | 84 | buffer_free, |
96 | }; | 85 | }; |
97 | 86 | ||
98 | BIO_METHOD *BIO_f_buffer() | 87 | BIO_METHOD *BIO_f_buffer(void) |
99 | { | 88 | { |
100 | return(&methods_buffer); | 89 | return(&methods_buffer); |
101 | } | 90 | } |
102 | 91 | ||
103 | static int buffer_new(bi) | 92 | static int buffer_new(BIO *bi) |
104 | BIO *bi; | ||
105 | { | 93 | { |
106 | BIO_F_BUFFER_CTX *ctx; | 94 | BIO_F_BUFFER_CTX *ctx; |
107 | 95 | ||
@@ -124,8 +112,7 @@ BIO *bi; | |||
124 | return(1); | 112 | return(1); |
125 | } | 113 | } |
126 | 114 | ||
127 | static int buffer_free(a) | 115 | static int buffer_free(BIO *a) |
128 | BIO *a; | ||
129 | { | 116 | { |
130 | BIO_F_BUFFER_CTX *b; | 117 | BIO_F_BUFFER_CTX *b; |
131 | 118 | ||
@@ -140,10 +127,7 @@ BIO *a; | |||
140 | return(1); | 127 | return(1); |
141 | } | 128 | } |
142 | 129 | ||
143 | static int buffer_read(b,out,outl) | 130 | static int buffer_read(BIO *b, char *out, int outl) |
144 | BIO *b; | ||
145 | char *out; | ||
146 | int outl; | ||
147 | { | 131 | { |
148 | int i,num=0; | 132 | int i,num=0; |
149 | BIO_F_BUFFER_CTX *ctx; | 133 | BIO_F_BUFFER_CTX *ctx; |
@@ -209,10 +193,7 @@ start: | |||
209 | goto start; | 193 | goto start; |
210 | } | 194 | } |
211 | 195 | ||
212 | static int buffer_write(b,in,inl) | 196 | static int buffer_write(BIO *b, char *in, int inl) |
213 | BIO *b; | ||
214 | char *in; | ||
215 | int inl; | ||
216 | { | 197 | { |
217 | int i,num=0; | 198 | int i,num=0; |
218 | BIO_F_BUFFER_CTX *ctx; | 199 | BIO_F_BUFFER_CTX *ctx; |
@@ -285,11 +266,7 @@ start: | |||
285 | goto start; | 266 | goto start; |
286 | } | 267 | } |
287 | 268 | ||
288 | static long buffer_ctrl(b,cmd,num,ptr) | 269 | static long buffer_ctrl(BIO *b, int cmd, long num, char *ptr) |
289 | BIO *b; | ||
290 | int cmd; | ||
291 | long num; | ||
292 | char *ptr; | ||
293 | { | 270 | { |
294 | BIO *dbio; | 271 | BIO *dbio; |
295 | BIO_F_BUFFER_CTX *ctx; | 272 | BIO_F_BUFFER_CTX *ctx; |
@@ -432,6 +409,7 @@ fprintf(stderr,"FLUSH [%3d] %3d -> %3d\n",ctx->obuf_off,ctx->obuf_len-ctx->obuf_ | |||
432 | break; | 409 | break; |
433 | } | 410 | } |
434 | } | 411 | } |
412 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
435 | break; | 413 | break; |
436 | case BIO_CTRL_DUP: | 414 | case BIO_CTRL_DUP: |
437 | dbio=(BIO *)ptr; | 415 | dbio=(BIO *)ptr; |
@@ -449,10 +427,7 @@ malloc_error: | |||
449 | return(0); | 427 | return(0); |
450 | } | 428 | } |
451 | 429 | ||
452 | static int buffer_gets(b,buf,size) | 430 | static int buffer_gets(BIO *b, char *buf, int size) |
453 | BIO *b; | ||
454 | char *buf; | ||
455 | int size; | ||
456 | { | 431 | { |
457 | BIO_F_BUFFER_CTX *ctx; | 432 | BIO_F_BUFFER_CTX *ctx; |
458 | int num=0,i,flag; | 433 | int num=0,i,flag; |
@@ -503,9 +478,7 @@ int size; | |||
503 | } | 478 | } |
504 | } | 479 | } |
505 | 480 | ||
506 | static int buffer_puts(b,str) | 481 | static int buffer_puts(BIO *b, char *str) |
507 | BIO *b; | ||
508 | char *str; | ||
509 | { | 482 | { |
510 | return(BIO_write(b,str,strlen(str))); | 483 | return(BIO_write(b,str,strlen(str))); |
511 | } | 484 | } |