diff options
author | 2016-05-04 14:53:29 +0000 | |
---|---|---|
committer | 2016-05-04 14:53:29 +0000 | |
commit | 55475ed7e38fd67735d0bd551cf84bdaa662266c (patch) | |
tree | 15a4efcd9876feb8cfc483f7c32f66263eabf25a /lib/libcrypto/evp/encode.c | |
parent | add IdentityAgent; noticed & ok jmc@ (diff) | |
download | wireguard-openbsd-55475ed7e38fd67735d0bd551cf84bdaa662266c.tar.xz wireguard-openbsd-55475ed7e38fd67735d0bd551cf84bdaa662266c.zip |
revert the big change from yesterday to prepare for smaller commits.
Diffstat (limited to 'lib/libcrypto/evp/encode.c')
-rw-r--r-- | lib/libcrypto/evp/encode.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/libcrypto/evp/encode.c b/lib/libcrypto/evp/encode.c index e4104173d48..637870cef6b 100644 --- a/lib/libcrypto/evp/encode.c +++ b/lib/libcrypto/evp/encode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: encode.c,v 1.22 2016/05/03 14:05:41 bcook Exp $ */ +/* $OpenBSD: encode.c,v 1.23 2016/05/04 14:53:29 tedu Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -125,13 +125,13 @@ EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int i, j; - size_t total = 0; + unsigned int total = 0; *outl = 0; if (inl == 0) return; OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data)); - if (ctx->length - ctx->num > inl) { + if ((ctx->num + inl) < ctx->length) { memcpy(&(ctx->enc_data[ctx->num]), in, inl); ctx->num += inl; return; @@ -148,7 +148,7 @@ EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, *out = '\0'; total = j + 1; } - while (inl >= ctx->length && total <= INT_MAX) { + while (inl >= ctx->length) { j = EVP_EncodeBlock(out, in, ctx->length); in += ctx->length; inl -= ctx->length; @@ -157,11 +157,6 @@ EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, *out = '\0'; total += j + 1; } - if (total > INT_MAX) { - /* Too much output data! */ - *outl = 0; - return; - } if (inl != 0) memcpy(&(ctx->enc_data[0]), in, inl); ctx->num = inl; |