X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fbio%2Fbf_null.c;h=613fb2e0583dd1524b1bc8c55cfe678221a41559;hp=0736b3f2fcf293d1ea36d808528865d1a6cfaad0;hb=453eccd63ad6ba19f6a3fcac37df05daf6cc1021;hpb=b1322259d93cf6b6286f9febcd468b6a9f577d91 diff --git a/crypto/bio/bf_null.c b/crypto/bio/bf_null.c index 0736b3f2fc..613fb2e058 100644 --- a/crypto/bio/bf_null.c +++ b/crypto/bio/bf_null.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -21,45 +21,27 @@ static int nullf_read(BIO *h, char *buf, int size); static int nullf_puts(BIO *h, const char *str); static int nullf_gets(BIO *h, char *str, int size); static long nullf_ctrl(BIO *h, int cmd, long arg1, void *arg2); -static int nullf_new(BIO *h); -static int nullf_free(BIO *data); -static long nullf_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); +static long nullf_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp); static const BIO_METHOD methods_nullf = { BIO_TYPE_NULL_FILTER, "NULL filter", + /* TODO: Convert to new style write function */ + bwrite_conv, nullf_write, + /* TODO: Convert to new style read function */ + bread_conv, nullf_read, nullf_puts, nullf_gets, nullf_ctrl, - nullf_new, - nullf_free, + NULL, + NULL, nullf_callback_ctrl, }; const BIO_METHOD *BIO_f_null(void) { - return (&methods_nullf); -} - -static int nullf_new(BIO *bi) -{ - bi->init = 1; - bi->ptr = NULL; - bi->flags = 0; - return (1); -} - -static int nullf_free(BIO *a) -{ - if (a == NULL) - return (0); - /*- - a->ptr=NULL; - a->init=0; - a->flags=0; - */ - return (1); + return &methods_nullf; } static int nullf_read(BIO *b, char *out, int outl) @@ -67,13 +49,13 @@ static int nullf_read(BIO *b, char *out, int outl) int ret = 0; if (out == NULL) - return (0); + return 0; if (b->next_bio == NULL) - return (0); + return 0; ret = BIO_read(b->next_bio, out, outl); BIO_clear_retry_flags(b); BIO_copy_next_retry(b); - return (ret); + return ret; } static int nullf_write(BIO *b, const char *in, int inl) @@ -81,13 +63,13 @@ static int nullf_write(BIO *b, const char *in, int inl) int ret = 0; if ((in == NULL) || (inl <= 0)) - return (0); + return 0; if (b->next_bio == NULL) - return (0); + return 0; ret = BIO_write(b->next_bio, in, inl); BIO_clear_retry_flags(b); BIO_copy_next_retry(b); - return (ret); + return ret; } static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr) @@ -95,7 +77,7 @@ static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr) long ret; if (b->next_bio == NULL) - return (0); + return 0; switch (cmd) { case BIO_C_DO_STATE_MACHINE: BIO_clear_retry_flags(b); @@ -108,33 +90,33 @@ static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr) default: ret = BIO_ctrl(b->next_bio, cmd, num, ptr); } - return (ret); + return ret; } -static long nullf_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) +static long nullf_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) { long ret = 1; if (b->next_bio == NULL) - return (0); + return 0; switch (cmd) { default: ret = BIO_callback_ctrl(b->next_bio, cmd, fp); break; } - return (ret); + return ret; } static int nullf_gets(BIO *bp, char *buf, int size) { if (bp->next_bio == NULL) - return (0); - return (BIO_gets(bp->next_bio, buf, size)); + return 0; + return BIO_gets(bp->next_bio, buf, size); } static int nullf_puts(BIO *bp, const char *str) { if (bp->next_bio == NULL) - return (0); - return (BIO_puts(bp->next_bio, str)); + return 0; + return BIO_puts(bp->next_bio, str); }