diff options
author | Richard Levitte <levitte@openssl.org> | 2019-04-30 14:01:52 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-04-30 15:30:30 +0200 |
commit | f79858ac4d90a450d0620d1ecb713bc35d7d9f8d (patch) | |
tree | e38fe9bf3e271d1da32f63797ab910306e38b565 /providers/common/ciphers/aes.c | |
parent | 96384e613ae7092fb6f63daa69a9601d128416b2 (diff) |
Replumbing: make the oneshot proider cipher function like the others
The OP_cipher_final function takes a return output size and an output
buffer size argument. The oneshot OP_cipher_cipher function should do
the same.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8849)
Diffstat (limited to 'providers/common/ciphers/aes.c')
-rw-r--r-- | providers/common/ciphers/aes.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/providers/common/ciphers/aes.c b/providers/common/ciphers/aes.c index 5c6e6703f8..2e93461621 100644 --- a/providers/common/ciphers/aes.c +++ b/providers/common/ciphers/aes.c @@ -235,16 +235,23 @@ static int aes_stream_final(void *vctx, unsigned char *out, size_t *outl, return 1; } -static int aes_cipher(void *vctx, unsigned char *out, const unsigned char *in, - size_t inl) +static int aes_cipher(void *vctx, + unsigned char *out, size_t *outl, size_t outsize, + const unsigned char *in, size_t inl) { PROV_AES_KEY *ctx = (PROV_AES_KEY *)vctx; + if (outsize < inl) { + PROVerr(PROV_F_AES_CIPHER, PROV_R_OUTPUT_BUFFER_TOO_SMALL); + return 0; + } + if (!ctx->ciph->cipher(ctx, out, in, inl)) { PROVerr(PROV_F_AES_CIPHER, PROV_R_CIPHER_OPERATION_FAILED); return 0; } + *outl = inl; return 1; } |