diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/evp/encode.c | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/evp.h | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c index 1097a7c903..07cfd7f2bc 100644 --- a/src/lib/libcrypto/evp/encode.c +++ b/src/lib/libcrypto/evp/encode.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: encode.c,v 1.24 2016/05/04 15:05:13 tedu Exp $ */ | 1 | /* $OpenBSD: encode.c,v 1.25 2018/08/24 19:45:11 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -120,7 +120,7 @@ EVP_EncodeInit(EVP_ENCODE_CTX *ctx) | |||
| 120 | ctx->line_num = 0; | 120 | ctx->line_num = 0; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | void | 123 | int |
| 124 | EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | 124 | EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, |
| 125 | const unsigned char *in, int inl) | 125 | const unsigned char *in, int inl) |
| 126 | { | 126 | { |
| @@ -128,13 +128,13 @@ EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | |||
| 128 | size_t total = 0; | 128 | size_t total = 0; |
| 129 | 129 | ||
| 130 | *outl = 0; | 130 | *outl = 0; |
| 131 | if (inl == 0) | 131 | if (inl <= 0) |
| 132 | return; | 132 | return 0; |
| 133 | OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data)); | 133 | OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data)); |
| 134 | if (ctx->length - ctx->num > inl) { | 134 | if (ctx->length - ctx->num > inl) { |
| 135 | memcpy(&(ctx->enc_data[ctx->num]), in, inl); | 135 | memcpy(&(ctx->enc_data[ctx->num]), in, inl); |
| 136 | ctx->num += inl; | 136 | ctx->num += inl; |
| 137 | return; | 137 | return 1; |
| 138 | } | 138 | } |
| 139 | if (ctx->num != 0) { | 139 | if (ctx->num != 0) { |
| 140 | i = ctx->length - ctx->num; | 140 | i = ctx->length - ctx->num; |
| @@ -160,12 +160,14 @@ EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | |||
| 160 | if (total > INT_MAX) { | 160 | if (total > INT_MAX) { |
| 161 | /* Too much output data! */ | 161 | /* Too much output data! */ |
| 162 | *outl = 0; | 162 | *outl = 0; |
| 163 | return; | 163 | return 0; |
| 164 | } | 164 | } |
| 165 | if (inl != 0) | 165 | if (inl != 0) |
| 166 | memcpy(&(ctx->enc_data[0]), in, inl); | 166 | memcpy(&(ctx->enc_data[0]), in, inl); |
| 167 | ctx->num = inl; | 167 | ctx->num = inl; |
| 168 | *outl = total; | 168 | *outl = total; |
| 169 | |||
| 170 | return 1; | ||
| 169 | } | 171 | } |
| 170 | 172 | ||
| 171 | void | 173 | void |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index b607be7ae5..0ec0431bc7 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp.h,v 1.66 2018/08/24 19:36:52 tb Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.67 2018/08/24 19:45:11 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -631,7 +631,7 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | |||
| 631 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | 631 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
| 632 | 632 | ||
| 633 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); | 633 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); |
| 634 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | 634 | int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, |
| 635 | const unsigned char *in, int inl); | 635 | const unsigned char *in, int inl); |
| 636 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); | 636 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); |
| 637 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); | 637 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); |
