From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Harald Freudenberger <freude@linux.ibm.com>,
richard.henderson@linaro.org, david@kernel.org,
thuth@redhat.com, berrange@redhat.com
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
linux-s390@vger.kernel.org, dengler@linux.ibm.com,
borntraeger@linux.ibm.com, fcallies@linux.ibm.com,
cohuck@redhat.com
Subject: Re: [PATCH v12 04/17] crypto: Add aes-helpers file to support some AES modes
Date: Tue, 14 Jul 2026 13:45:22 +0200 [thread overview]
Message-ID: <13fa7159-9757-4858-b824-6507494e0876@linux.ibm.com> (raw)
In-Reply-To: <20260710152906.80207-5-freude@linux.ibm.com>
On 7/10/26 17:28, Harald Freudenberger wrote:
> Add a new file crypto/aes-helpers.c with simple functions
> to support some AES modes:
> - AES cbc: AES_cbc_encrypt() AES_cbc_decrypt()
> - AES ctr: AES_ctr_encrypt()
> - AES xts: AES_xts_encrypt() AES_xts_decrypt()
> and some AES related helpers:
> - AES_xor()
> - AES_xts_prep_next_tweak()
> Add header file include/crypto/aes-helpers.h for these functions
>
> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
> Reviewed-by: Finn Callies <fcallies@linux.ibm.com>
> ---
> crypto/aes-helpers.c | 106 ++++++++++++++++++++++++++++++++
> crypto/meson.build | 1 +
> include/crypto/aes-helpers.h | 116 +++++++++++++++++++++++++++++++++++
> 3 files changed, 223 insertions(+)
> create mode 100644 crypto/aes-helpers.c
> create mode 100644 include/crypto/aes-helpers.h
>
> diff --git a/crypto/aes-helpers.c b/crypto/aes-helpers.c
> new file mode 100644
> index 0000000000..ff4aa0a385
> --- /dev/null
> +++ b/crypto/aes-helpers.c
[...]
> +void AES_ctr_encrypt(const unsigned char *in, unsigned char *out,
> + const unsigned char *ctr, const AES_KEY *key)
> +{
> + unsigned char buf[AES_BLOCK_SIZE];
> +
> + /* encrypt ctr => buf */
> + AES_encrypt(ctr, buf, key);
> + /* exor input data with encrypted ctr => out */
> + AES_xor(in, buf, out);
> +}
> +
> +/*
> + * Tweak calculation for AES XTS.
> + * Multiply tweak by α (x) in GF(2^128) per IEEE 1619-2007. The tweak
> + * is a 128-bit little-endian integer (tweak[0]=LSB, tweak[15]=MSB).
> + * This implementation has been verified on litte and big endian.
> + */
Nit: do we need to have this comment twice?
It's already present in the header.
Also typo: litte -> little (but I'm not sure if we even need to state
that in the code).
[...]
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
next prev parent reply other threads:[~2026-07-14 11:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 15:28 [PATCH v12 00/17] target/s390x: Extend qemu CPACF support Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 01/17] target/s390x: Rework s390 cpacf implementations Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 02/17] target/s390x: Move cpacf sha512 code into a new file Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 03/17] target/s390x: Support cpacf sha256 Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 04/17] crypto: Add aes-helpers file to support some AES modes Harald Freudenberger
2026-07-14 11:45 ` Ilya Leoshkevich [this message]
2026-07-14 14:16 ` Daniel P. Berrangé
2026-07-10 15:28 ` [PATCH v12 05/17] target/s390x: Support AES ECB for cpacf km instruction Harald Freudenberger
2026-07-14 11:49 ` Ilya Leoshkevich
2026-07-10 15:28 ` [PATCH v12 06/17] target/s390x: Support AES CBC for cpacf kmc instruction Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 07/17] target/s390x: Support AES CTR for cpacf kmctr instruction Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 08/17] target/s390x: Minimal AES XTS support for cpacf pcc instruction Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 09/17] target/s390x: Support AES XTS for cpacf km instruction Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 10/17] target/s390x: Base support for cpacf protected keys and pckmo Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 11/17] target/s390x: Support protected key AES ECB for cpacf km instruction Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 12/17] target/s390x: Support protected key AES CBC for cpacf kmc instruction Harald Freudenberger
2026-07-10 15:28 ` [PATCH v12 13/17] target/s390x: Support protected key AES CTR for cpacf kmctr instruction Harald Freudenberger
2026-07-10 15:29 ` [PATCH v12 14/17] target/s390x: Minimal protected key AES XTS support for cpacf pcc instruction Harald Freudenberger
2026-07-10 15:29 ` [PATCH v12 15/17] target/s390x: Support protected key AES XTS for cpacf km instruction Harald Freudenberger
2026-07-10 15:29 ` [PATCH v12 16/17] docs/s390: Document CPACF instructions support Harald Freudenberger
2026-07-14 12:07 ` Ilya Leoshkevich
2026-07-10 15:29 ` [PATCH v12 17/17] tests/tcg/s390x: Add tests for CPACF instructions Harald Freudenberger
2026-07-14 12:01 ` Ilya Leoshkevich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=13fa7159-9757-4858-b824-6507494e0876@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=berrange@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@kernel.org \
--cc=dengler@linux.ibm.com \
--cc=fcallies@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.