summaryrefslogtreecommitdiff
path: root/deps/openssl/openssl/crypto/evp/bio_b64.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/openssl/openssl/crypto/evp/bio_b64.c')
-rw-r--r--deps/openssl/openssl/crypto/evp/bio_b64.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/deps/openssl/openssl/crypto/evp/bio_b64.c b/deps/openssl/openssl/crypto/evp/bio_b64.c
index a86e8db0bf..9f891f7626 100644
--- a/deps/openssl/openssl/crypto/evp/bio_b64.c
+++ b/deps/openssl/openssl/crypto/evp/bio_b64.c
@@ -17,9 +17,6 @@
static int b64_write(BIO *h, const char *buf, int num);
static int b64_read(BIO *h, char *buf, int size);
static int b64_puts(BIO *h, const char *str);
-/*
- * static int b64_gets(BIO *h, char *str, int size);
- */
static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2);
static int b64_new(BIO *h);
static int b64_free(BIO *data);
@@ -49,7 +46,11 @@ typedef struct b64_struct {
static const BIO_METHOD methods_b64 = {
BIO_TYPE_BASE64,
"base64 encoding",
+ /* TODO: Convert to new style write function */
+ bwrite_conv,
b64_write,
+ /* TODO: Convert to new style read function */
+ bread_conv,
b64_read,
b64_puts,
NULL, /* b64_gets, */
@@ -69,9 +70,10 @@ static int b64_new(BIO *bi)
{
BIO_B64_CTX *ctx;
- ctx = OPENSSL_zalloc(sizeof(*ctx));
- if (ctx == NULL)
+ if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
+ EVPerr(EVP_F_B64_NEW, ERR_R_MALLOC_FAILURE);
return 0;
+ }
ctx->cont = 1;
ctx->start = 1;
@@ -113,7 +115,7 @@ static int b64_read(BIO *b, char *out, int outl)
BIO *next;
if (out == NULL)
- return (0);
+ return 0;
ctx = (BIO_B64_CTX *)BIO_get_data(b);
next = BIO_next(b);
@@ -354,7 +356,7 @@ static int b64_write(BIO *b, const char *in, int inl)
i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);
if (i <= 0) {
BIO_copy_next_retry(b);
- return (i);
+ return i;
}
OPENSSL_assert(i <= n);
ctx->buf_off += i;
@@ -367,7 +369,7 @@ static int b64_write(BIO *b, const char *in, int inl)
ctx->buf_len = 0;
if ((in == NULL) || (inl <= 0))
- return (0);
+ return 0;
while (inl > 0) {
n = (inl > B64_BLOCK_SIZE) ? B64_BLOCK_SIZE : inl;
@@ -440,7 +442,7 @@ static int b64_write(BIO *b, const char *in, int inl)
ctx->buf_len = 0;
ctx->buf_off = 0;
}
- return (ret);
+ return ret;
}
static long b64_ctrl(BIO *b, int cmd, long num, void *ptr)
@@ -542,7 +544,7 @@ static long b64_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
ret = BIO_callback_ctrl(next, cmd, fp);
break;
}
- return (ret);
+ return ret;
}
static int b64_puts(BIO *b, const char *str)