diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2023-11-29 20:08:12 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2023-11-30 17:49:47 +0000 |
| commit | 47d767dab54895f3ba8abac6ab2295797394659e (patch) | |
| tree | c05f47c4526c124924c575958cf6f44277bb64ba /sys/crypto/openssl | |
| parent | 0fac350c54d0a72f5341e15021efcde63eb58a4b (diff) | |
Diffstat (limited to 'sys/crypto/openssl')
| -rw-r--r-- | sys/crypto/openssl/amd64/ossl_aes_gcm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/crypto/openssl/amd64/ossl_aes_gcm.c b/sys/crypto/openssl/amd64/ossl_aes_gcm.c index 0d205ec3ff90..d08b2ac8a759 100644 --- a/sys/crypto/openssl/amd64/ossl_aes_gcm.c +++ b/sys/crypto/openssl/amd64/ossl_aes_gcm.c @@ -459,7 +459,7 @@ gcm_encrypt_aesni(struct ossl_gcm_context *ctx, const unsigned char *in, size_t bulk = 0, res; int error; - res = (AES_BLOCK_LEN - ctx->gcm.mres) % AES_BLOCK_LEN; + res = MIN(len, (AES_BLOCK_LEN - ctx->gcm.mres) % AES_BLOCK_LEN); if ((error = gcm_encrypt(ctx, in, out, res)) != 0) return error; @@ -621,12 +621,12 @@ gcm_decrypt_aesni(struct ossl_gcm_context *ctx, const unsigned char *in, size_t bulk = 0, res; int error; - res = (AES_BLOCK_LEN - ctx->gcm.mres) % AES_BLOCK_LEN; + res = MIN(len, (AES_BLOCK_LEN - ctx->gcm.mres) % AES_BLOCK_LEN); if ((error = gcm_decrypt(ctx, in, out, res)) != 0) return error; - bulk = aesni_gcm_decrypt(in, out, len, &ctx->aes_ks, ctx->gcm.Yi.c, - ctx->gcm.Xi.u); + bulk = aesni_gcm_decrypt(in + res, out + res, len - res, &ctx->aes_ks, + ctx->gcm.Yi.c, ctx->gcm.Xi.u); ctx->gcm.len.u[1] += bulk; bulk += res; |
