X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fevp%2Fencode.c;h=91160adec06c31d5049333bfe50e395a711c7009;hb=56c77c52e1b0ad69fa133adb48c3221141b684c4;hp=36affe56261d281594a522d9ea3fb3e63b1254d7;hpb=b785504a10310cb2872270eb409b70971be5e76e;p=oweals%2Fopenssl.git diff --git a/crypto/evp/encode.c b/crypto/evp/encode.c index 36affe5626..91160adec0 100644 --- a/crypto/evp/encode.c +++ b/crypto/evp/encode.c @@ -59,6 +59,7 @@ #include #include "internal/cryptlib.h" #include +#include "evp_locl.h" static unsigned char conv_ascii2bin(unsigned char a); #ifndef CHARSET_EBCDIC @@ -140,6 +141,20 @@ static unsigned char conv_ascii2bin(unsigned char a) } #endif +EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void) +{ + return (EVP_ENCODE_CTX *)OPENSSL_zalloc(sizeof(EVP_ENCODE_CTX)); +} + +void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx) +{ + OPENSSL_free(ctx); +} +int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx) +{ + return ctx->num; +} + void EVP_EncodeInit(EVP_ENCODE_CTX *ctx) { ctx->length = 48; @@ -344,13 +359,13 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, tail: if (n > 0) { if ((n & 3) == 0) { - decoded_len = EVP_DecodeBlock(out, d, n); - n = 0; - if (decoded_len < 0 || eof > decoded_len) { - rv = -1; - goto end; - } - ret += (decoded_len - eof); + decoded_len = EVP_DecodeBlock(out, d, n); + n = 0; + if (decoded_len < 0 || eof > decoded_len) { + rv = -1; + goto end; + } + ret += (decoded_len - eof); } else if (seof) { /* EOF in the middle of a base64 block. */ rv = -1;