diff options
Diffstat (limited to 'src/lib/libcrypto/bio/bf_buff.c')
-rw-r--r-- | src/lib/libcrypto/bio/bf_buff.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c index ff0c9070ae..f50e8f98a3 100644 --- a/src/lib/libcrypto/bio/bf_buff.c +++ b/src/lib/libcrypto/bio/bf_buff.c | |||
@@ -62,14 +62,14 @@ | |||
62 | #include <openssl/bio.h> | 62 | #include <openssl/bio.h> |
63 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
64 | 64 | ||
65 | static int buffer_write(BIO *h,char *buf,int num); | 65 | static int buffer_write(BIO *h, const char *buf,int num); |
66 | static int buffer_read(BIO *h,char *buf,int size); | 66 | static int buffer_read(BIO *h, char *buf, int size); |
67 | static int buffer_puts(BIO *h,char *str); | 67 | static int buffer_puts(BIO *h, const char *str); |
68 | static int buffer_gets(BIO *h,char *str,int size); | 68 | static int buffer_gets(BIO *h, char *str, int size); |
69 | static long buffer_ctrl(BIO *h,int cmd,long arg1,char *arg2); | 69 | static long buffer_ctrl(BIO *h, int cmd, long arg1, void *arg2); |
70 | static int buffer_new(BIO *h); | 70 | static int buffer_new(BIO *h); |
71 | static int buffer_free(BIO *data); | 71 | static int buffer_free(BIO *data); |
72 | static long buffer_callback_ctrl(BIO *h,int cmd, void (*fp)()); | 72 | static long buffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); |
73 | #define DEFAULT_BUFFER_SIZE 1024 | 73 | #define DEFAULT_BUFFER_SIZE 1024 |
74 | 74 | ||
75 | static BIO_METHOD methods_buffer= | 75 | static BIO_METHOD methods_buffer= |
@@ -95,12 +95,12 @@ static int buffer_new(BIO *bi) | |||
95 | { | 95 | { |
96 | BIO_F_BUFFER_CTX *ctx; | 96 | BIO_F_BUFFER_CTX *ctx; |
97 | 97 | ||
98 | ctx=(BIO_F_BUFFER_CTX *)Malloc(sizeof(BIO_F_BUFFER_CTX)); | 98 | ctx=(BIO_F_BUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_F_BUFFER_CTX)); |
99 | if (ctx == NULL) return(0); | 99 | if (ctx == NULL) return(0); |
100 | ctx->ibuf=(char *)Malloc(DEFAULT_BUFFER_SIZE); | 100 | ctx->ibuf=(char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE); |
101 | if (ctx->ibuf == NULL) { Free(ctx); return(0); } | 101 | if (ctx->ibuf == NULL) { OPENSSL_free(ctx); return(0); } |
102 | ctx->obuf=(char *)Malloc(DEFAULT_BUFFER_SIZE); | 102 | ctx->obuf=(char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE); |
103 | if (ctx->obuf == NULL) { Free(ctx->ibuf); Free(ctx); return(0); } | 103 | if (ctx->obuf == NULL) { OPENSSL_free(ctx->ibuf); OPENSSL_free(ctx); return(0); } |
104 | ctx->ibuf_size=DEFAULT_BUFFER_SIZE; | 104 | ctx->ibuf_size=DEFAULT_BUFFER_SIZE; |
105 | ctx->obuf_size=DEFAULT_BUFFER_SIZE; | 105 | ctx->obuf_size=DEFAULT_BUFFER_SIZE; |
106 | ctx->ibuf_len=0; | 106 | ctx->ibuf_len=0; |
@@ -120,9 +120,9 @@ static int buffer_free(BIO *a) | |||
120 | 120 | ||
121 | if (a == NULL) return(0); | 121 | if (a == NULL) return(0); |
122 | b=(BIO_F_BUFFER_CTX *)a->ptr; | 122 | b=(BIO_F_BUFFER_CTX *)a->ptr; |
123 | if (b->ibuf != NULL) Free(b->ibuf); | 123 | if (b->ibuf != NULL) OPENSSL_free(b->ibuf); |
124 | if (b->obuf != NULL) Free(b->obuf); | 124 | if (b->obuf != NULL) OPENSSL_free(b->obuf); |
125 | Free(a->ptr); | 125 | OPENSSL_free(a->ptr); |
126 | a->ptr=NULL; | 126 | a->ptr=NULL; |
127 | a->init=0; | 127 | a->init=0; |
128 | a->flags=0; | 128 | a->flags=0; |
@@ -195,7 +195,7 @@ start: | |||
195 | goto start; | 195 | goto start; |
196 | } | 196 | } |
197 | 197 | ||
198 | static int buffer_write(BIO *b, char *in, int inl) | 198 | static int buffer_write(BIO *b, const char *in, int inl) |
199 | { | 199 | { |
200 | int i,num=0; | 200 | int i,num=0; |
201 | BIO_F_BUFFER_CTX *ctx; | 201 | BIO_F_BUFFER_CTX *ctx; |
@@ -268,7 +268,7 @@ start: | |||
268 | goto start; | 268 | goto start; |
269 | } | 269 | } |
270 | 270 | ||
271 | static long buffer_ctrl(BIO *b, int cmd, long num, char *ptr) | 271 | static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) |
272 | { | 272 | { |
273 | BIO *dbio; | 273 | BIO *dbio; |
274 | BIO_F_BUFFER_CTX *ctx; | 274 | BIO_F_BUFFER_CTX *ctx; |
@@ -319,9 +319,9 @@ static long buffer_ctrl(BIO *b, int cmd, long num, char *ptr) | |||
319 | case BIO_C_SET_BUFF_READ_DATA: | 319 | case BIO_C_SET_BUFF_READ_DATA: |
320 | if (num > ctx->ibuf_size) | 320 | if (num > ctx->ibuf_size) |
321 | { | 321 | { |
322 | p1=Malloc((int)num); | 322 | p1=OPENSSL_malloc((int)num); |
323 | if (p1 == NULL) goto malloc_error; | 323 | if (p1 == NULL) goto malloc_error; |
324 | if (ctx->ibuf != NULL) Free(ctx->ibuf); | 324 | if (ctx->ibuf != NULL) OPENSSL_free(ctx->ibuf); |
325 | ctx->ibuf=p1; | 325 | ctx->ibuf=p1; |
326 | } | 326 | } |
327 | ctx->ibuf_off=0; | 327 | ctx->ibuf_off=0; |
@@ -353,21 +353,21 @@ static long buffer_ctrl(BIO *b, int cmd, long num, char *ptr) | |||
353 | p2=ctx->obuf; | 353 | p2=ctx->obuf; |
354 | if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) | 354 | if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) |
355 | { | 355 | { |
356 | p1=(char *)Malloc((int)num); | 356 | p1=(char *)OPENSSL_malloc((int)num); |
357 | if (p1 == NULL) goto malloc_error; | 357 | if (p1 == NULL) goto malloc_error; |
358 | } | 358 | } |
359 | if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) | 359 | if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) |
360 | { | 360 | { |
361 | p2=(char *)Malloc((int)num); | 361 | p2=(char *)OPENSSL_malloc((int)num); |
362 | if (p2 == NULL) | 362 | if (p2 == NULL) |
363 | { | 363 | { |
364 | if (p1 != ctx->ibuf) Free(p1); | 364 | if (p1 != ctx->ibuf) OPENSSL_free(p1); |
365 | goto malloc_error; | 365 | goto malloc_error; |
366 | } | 366 | } |
367 | } | 367 | } |
368 | if (ctx->ibuf != p1) | 368 | if (ctx->ibuf != p1) |
369 | { | 369 | { |
370 | Free(ctx->ibuf); | 370 | OPENSSL_free(ctx->ibuf); |
371 | ctx->ibuf=p1; | 371 | ctx->ibuf=p1; |
372 | ctx->ibuf_off=0; | 372 | ctx->ibuf_off=0; |
373 | ctx->ibuf_len=0; | 373 | ctx->ibuf_len=0; |
@@ -375,7 +375,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, char *ptr) | |||
375 | } | 375 | } |
376 | if (ctx->obuf != p2) | 376 | if (ctx->obuf != p2) |
377 | { | 377 | { |
378 | Free(ctx->obuf); | 378 | OPENSSL_free(ctx->obuf); |
379 | ctx->obuf=p2; | 379 | ctx->obuf=p2; |
380 | ctx->obuf_off=0; | 380 | ctx->obuf_off=0; |
381 | ctx->obuf_len=0; | 381 | ctx->obuf_len=0; |
@@ -439,7 +439,7 @@ malloc_error: | |||
439 | return(0); | 439 | return(0); |
440 | } | 440 | } |
441 | 441 | ||
442 | static long buffer_callback_ctrl(BIO *b, int cmd, void (*fp)()) | 442 | static long buffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) |
443 | { | 443 | { |
444 | long ret=1; | 444 | long ret=1; |
445 | 445 | ||
@@ -504,8 +504,8 @@ static int buffer_gets(BIO *b, char *buf, int size) | |||
504 | } | 504 | } |
505 | } | 505 | } |
506 | 506 | ||
507 | static int buffer_puts(BIO *b, char *str) | 507 | static int buffer_puts(BIO *b, const char *str) |
508 | { | 508 | { |
509 | return(BIO_write(b,str,strlen(str))); | 509 | return(buffer_write(b,str,strlen(str))); |
510 | } | 510 | } |
511 | 511 | ||