chromium/third_party/boringssl/src/crypto/bio/bio.c

/* Copyright (C) 1995-1998 Eric Young ([email protected])
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young ([email protected]).
 * The implementation was written so as to conform with Netscapes SSL.
 *
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson ([email protected]).
 *
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young ([email protected])"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson ([email protected])"
 *
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.] */

#include <openssl/bio.h>

#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <string.h>

#include <openssl/asn1.h>
#include <openssl/err.h>
#include <openssl/mem.h>
#include <openssl/thread.h>

#include "../internal.h"


static CRYPTO_EX_DATA_CLASS g_ex_data_class =;

BIO *BIO_new(const BIO_METHOD *method) {}

int BIO_free(BIO *bio) {}

int BIO_up_ref(BIO *bio) {}

void BIO_vfree(BIO *bio) {}

void BIO_free_all(BIO *bio) {}

int BIO_read(BIO *bio, void *buf, int len) {}

int BIO_gets(BIO *bio, char *buf, int len) {}

int BIO_write(BIO *bio, const void *in, int inl) {}

int BIO_write_all(BIO *bio, const void *data, size_t len) {}

int BIO_puts(BIO *bio, const char *in) {}

int BIO_flush(BIO *bio) {}

long BIO_ctrl(BIO *bio, int cmd, long larg, void *parg) {}

char *BIO_ptr_ctrl(BIO *b, int cmd, long larg) {}

long BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg) {}

int BIO_reset(BIO *bio) {}

int BIO_eof(BIO *bio) {}

void BIO_set_flags(BIO *bio, int flags) {}

int BIO_test_flags(const BIO *bio, int flags) {}

int BIO_should_read(const BIO *bio) {}

int BIO_should_write(const BIO *bio) {}

int BIO_should_retry(const BIO *bio) {}

int BIO_should_io_special(const BIO *bio) {}

int BIO_get_retry_reason(const BIO *bio) {}

void BIO_set_retry_reason(BIO *bio, int reason) {}

void BIO_clear_flags(BIO *bio, int flags) {}

void BIO_set_retry_read(BIO *bio) {}

void BIO_set_retry_write(BIO *bio) {}

static const int kRetryFlags =;

int BIO_get_retry_flags(BIO *bio) {}

void BIO_clear_retry_flags(BIO *bio) {}

int BIO_method_type(const BIO *bio) {}

void BIO_copy_next_retry(BIO *bio) {}

long BIO_callback_ctrl(BIO *bio, int cmd, bio_info_cb fp) {}

size_t BIO_pending(const BIO *bio) {}

size_t BIO_ctrl_pending(const BIO *bio) {}

size_t BIO_wpending(const BIO *bio) {}

int BIO_set_close(BIO *bio, int close_flag) {}

OPENSSL_EXPORT uint64_t BIO_number_read(const BIO *bio) {}

OPENSSL_EXPORT uint64_t BIO_number_written(const BIO *bio) {}

BIO *BIO_push(BIO *bio, BIO *appended_bio) {}

BIO *BIO_pop(BIO *bio) {}

BIO *BIO_next(BIO *bio) {}

BIO *BIO_find_type(BIO *bio, int type) {}

int BIO_indent(BIO *bio, unsigned indent, unsigned max_indent) {}

static int print_bio(const char *str, size_t len, void *bio) {}

void ERR_print_errors(BIO *bio) {}

// bio_read_all reads everything from |bio| and prepends |prefix| to it. On
// success, |*out| is set to an allocated buffer (which should be freed with
// |OPENSSL_free|), |*out_len| is set to its length and one is returned. The
// buffer will contain |prefix| followed by the contents of |bio|. On failure,
// zero is returned.
//
// The function will fail if the size of the output would equal or exceed
// |max_len|.
static int bio_read_all(BIO *bio, uint8_t **out, size_t *out_len,
                        const uint8_t *prefix, size_t prefix_len,
                        size_t max_len) {}

// bio_read_full reads |len| bytes |bio| and writes them into |out|. It
// tolerates partial reads from |bio| and returns one on success or zero if a
// read fails before |len| bytes are read. On failure, it additionally sets
// |*out_eof_on_first_read| to whether the error was due to |bio| returning zero
// on the first read. |out_eof_on_first_read| may be NULL to discard the value.
static int bio_read_full(BIO *bio, uint8_t *out, int *out_eof_on_first_read,
                         size_t len) {}

// For compatibility with existing |d2i_*_bio| callers, |BIO_read_asn1| uses
// |ERR_LIB_ASN1| errors.
OPENSSL_DECLARE_ERROR_REASON()
OPENSSL_DECLARE_ERROR_REASON()
OPENSSL_DECLARE_ERROR_REASON()
OPENSSL_DECLARE_ERROR_REASON()

int BIO_read_asn1(BIO *bio, uint8_t **out, size_t *out_len, size_t max_len) {}

void BIO_set_retry_special(BIO *bio) {}

int BIO_set_write_buffer_size(BIO *bio, int buffer_size) {}

static CRYPTO_MUTEX g_index_lock =;
static int g_index =;

int BIO_get_new_index(void) {}

BIO_METHOD *BIO_meth_new(int type, const char *name) {}

void BIO_meth_free(BIO_METHOD *method) {}

int BIO_meth_set_create(BIO_METHOD *method,
                        int (*create_func)(BIO *)) {}

int BIO_meth_set_destroy(BIO_METHOD *method,
                         int (*destroy_func)(BIO *)) {}

int BIO_meth_set_write(BIO_METHOD *method,
                       int (*write_func)(BIO *, const char *, int)) {}

int BIO_meth_set_read(BIO_METHOD *method,
                      int (*read_func)(BIO *, char *, int)) {}

int BIO_meth_set_gets(BIO_METHOD *method,
                      int (*gets_func)(BIO *, char *, int)) {}

int BIO_meth_set_ctrl(BIO_METHOD *method,
                      long (*ctrl_func)(BIO *, int, long, void *)) {}

void BIO_set_data(BIO *bio, void *ptr) {}

void *BIO_get_data(BIO *bio) {}

void BIO_set_init(BIO *bio, int init) {}

int BIO_get_init(BIO *bio) {}

void BIO_set_shutdown(BIO *bio, int shutdown) {}

int BIO_get_shutdown(BIO *bio) {}

int BIO_meth_set_puts(BIO_METHOD *method, int (*puts)(BIO *, const char *)) {}

int BIO_get_ex_new_index(long argl, void *argp,
                                    CRYPTO_EX_unused *unused,
                                    CRYPTO_EX_dup *dup_unused,
                                    CRYPTO_EX_free *free_func) {}

int BIO_set_ex_data(BIO *bio, int idx, void *data) {}

void *BIO_get_ex_data(const BIO *bio, int idx) {}