Skip to contentSkip to conversation

crypto: Fix data mismatch over ipsec tunnel encrypted/decrypted with ppc64le AES/GCM module.

PATCH In review Danny Tsen 3 participants 6 messages Sep 12, 2024 – Sep 15, 2024

Subsystems (3)
lore
Share & tools
lore

Danny Tsen

author
#0 lore raw

PATCH 1/1 crypto: Fix data mismatch over ipsec tunnel encrypted/decrypted with ppc64le AES/GCM module.

This patch is to fix an issue when simd is not usable that data mismatch may occur over ipsec tunnel. The fix is to register algs as SIMD modules so that the algorithm is excecuted when SIMD instructions is usable.

A new module rfc4106(gcm(aes)) is also added. Re-write AES/GCM assembly codes with smaller footprints and small performance gain.

This patch has been tested with the kernel crypto module tcrypt.ko and has passed the selftest. The patch is also tested with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS enabled.

---
 arch/powerpc/crypto/Kconfig            |    1 +
 arch/powerpc/crypto/aes-gcm-p10-glue.c |  141 +-
 arch/powerpc/crypto/aes-gcm-p10.S      | 2421 +++++++++++-------------
 3 files changed, 1187 insertions(+), 1376 deletions(-)
arch/powerpc/crypto/Kconfig +1 -0
index 09ebcbdfb34f..951a43726461 100644
@@ -112,6 +112,7 @@ config CRYPTO_AES_GCM_P10
 	select CRYPTO_ALGAPI
 	select CRYPTO_AEAD
 	select CRYPTO_SKCIPHER
+	select CRYPTO_SIMD
 	help
 	  AEAD cipher: AES cipher algorithms (FIPS-197)
 	  GCM (Galois/Counter Mode) authenticated encryption mode (NIST SP800-38D)
arch/powerpc/crypto/aes-gcm-p10-glue.c +118 -23

264 lines not on this page · raw message

arch/powerpc/crypto/aes-gcm-p10.S +1068 -1353

2,555 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw
Quoted 11 lines · Danny Tsen

This patch is to fix an issue when simd is not usable that data mismatch may occur over ipsec tunnel. The fix is to register algs as SIMD modules so that the algorithm is excecuted when SIMD instructions is usable.

A new module rfc4106(gcm(aes)) is also added. Re-write AES/GCM assembly codes with smaller footprints and small performance gain.

This patch has been tested with the kernel crypto module tcrypt.ko and has passed the selftest. The patch is also tested with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS enabled.

Quoted 6 lines
---
 arch/powerpc/crypto/Kconfig            |    1 +
 arch/powerpc/crypto/aes-gcm-p10-glue.c |  141 +-
 arch/powerpc/crypto/aes-gcm-p10.S      | 2421 +++++++++++-------------
 3 files changed, 1187 insertions(+), 1376 deletions(-)

As this is a bug fix it should have a Fixes: tag, and probably a stable Cc as well.

But that diffstat is really large for a bug fix. Is there no way to fix the issue in a smaller patch? Even if that is just disabling the feature until it can be fixed in subsequent commits?

cheers

#2 lore raw
Quoted 19 lines · Michael Ellerman
Quoted 11 lines · Danny Tsen

This patch is to fix an issue when simd is not usable that data mismatch may occur over ipsec tunnel. The fix is to register algs as SIMD modules so that the algorithm is excecuted when SIMD instructions is usable.

A new module rfc4106(gcm(aes)) is also added. Re-write AES/GCM assembly codes with smaller footprints and small performance gain.

This patch has been tested with the kernel crypto module tcrypt.ko and has passed the selftest. The patch is also tested with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS enabled.

Quoted 6 lines
---
 arch/powerpc/crypto/Kconfig            |    1 +
 arch/powerpc/crypto/aes-gcm-p10-glue.c |  141 +-
 arch/powerpc/crypto/aes-gcm-p10.S      | 2421 +++++++++++-------------
 3 files changed, 1187 insertions(+), 1376 deletions(-)
Quoted 8 lines

As this is a bug fix it should have a Fixes: tag, and probably a stable Cc as well.

But that diffstat is really large for a bug fix. Is there no way to fix the issue in a smaller patch? Even if that is just disabling the feature until it can be fixed in subsequent commits?

cheers

The commit message says "The fix is to register algs as SIMD modules"

and

"A new module rfc4106(gcm(aes)) is also added."

and I also see some indentation changes.(This can't go with fixes patch, will just add the noise)

Would suggest to break the patch in three.

I see a big subject line, have you ran the checkpatch?

Kamlesh

author
#3 lore raw

Yes, checkpath was run.

Not sure what you mean by "some indentation changes.(This can't go with fixes patch, will just add the noise)"

Thanks.

Quoted 43 lines · Kamlesh Gurudasani
Quoted 18 lines · Michael Ellerman
Quoted 11 lines · Danny Tsen

This patch is to fix an issue when simd is not usable that data mismatch may occur over ipsec tunnel. The fix is to register algs as SIMD modules so that the algorithm is excecuted when SIMD instructions is usable.

A new module rfc4106(gcm(aes)) is also added. Re-write AES/GCM assembly codes with smaller footprints and small performance gain.

This patch has been tested with the kernel crypto module tcrypt.ko and has passed the selftest. The patch is also tested with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS enabled.

Quoted 6 lines
---
  arch/powerpc/crypto/Kconfig            |    1 +
  arch/powerpc/crypto/aes-gcm-p10-glue.c |  141 +-
  arch/powerpc/crypto/aes-gcm-p10.S      | 2421 +++++++++++-------------
  3 files changed, 1187 insertions(+), 1376 deletions(-)
Quoted 8 lines

As this is a bug fix it should have a Fixes: tag, and probably a stable Cc as well.

But that diffstat is really large for a bug fix. Is there no way to fix the issue in a smaller patch? Even if that is just disabling the feature until it can be fixed in subsequent commits?

cheers

The commit message says "The fix is to register algs as SIMD modules"

and

"A new module rfc4106(gcm(aes)) is also added."

and I also see some indentation changes.(This can't go with fixes patch, will just add the noise)

Would suggest to break the patch in three.

I see a big subject line, have you ran the checkpatch?

Kamlesh

#4 lore raw
Quoted 1 line · Danny Tsen

Yes, checkpath was run.

As you're splitting the patches anyways, this may not be needed anymore, but below is guideline for subject line.

https://docs.kernel.org/process/submitting-patches.html

"For these reasons, the summary must be no more than 70-75 characters, and it must describe both what the patch changes, as well as why the patch might be necessary.
It is challenging to be both succinct and descriptive, but that is what a well-written summary should do."

I guess check patch is not checking that.

Also avoid top posting,

Read "Use trimmed interleaved replies in email discussions" from above document.

Kamlesh

Quoted 6 lines

Not sure what you mean by "some indentation changes.(This can't go with fixes patch, will just add the noise)"

Thanks.

...

Quoted 23 lines
Quoted 23 lines
Quoted 8 lines

As this is a bug fix it should have a Fixes: tag, and probably a stable Cc as well.

But that diffstat is really large for a bug fix. Is there no way to fix the issue in a smaller patch? Even if that is just disabling the feature until it can be fixed in subsequent commits?

cheers

The commit message says "The fix is to register algs as SIMD modules"

and

"A new module rfc4106(gcm(aes)) is also added."

and I also see some indentation changes.(This can't go with fixes patch, will just add the noise)

Would suggest to break the patch in three.

I see a big subject line, have you ran the checkpatch?

Kamlesh

author
#5 lore raw
In reply to Michael Ellerman

Hi Michael,

I did think of that.  I can try to remove the feature first and apply the subsequent changes.

Thanks.

-Danny

Quoted 27 lines · Michael Ellerman
Quoted 11 lines · Danny Tsen

This patch is to fix an issue when simd is not usable that data mismatch may occur over ipsec tunnel. The fix is to register algs as SIMD modules so that the algorithm is excecuted when SIMD instructions is usable.

A new module rfc4106(gcm(aes)) is also added. Re-write AES/GCM assembly codes with smaller footprints and small performance gain.

This patch has been tested with the kernel crypto module tcrypt.ko and has passed the selftest. The patch is also tested with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS enabled.

Quoted 6 lines
---
  arch/powerpc/crypto/Kconfig            |    1 +
  arch/powerpc/crypto/aes-gcm-p10-glue.c |  141 +-
  arch/powerpc/crypto/aes-gcm-p10.S      | 2421 +++++++++++-------------
  3 files changed, 1187 insertions(+), 1376 deletions(-)

As this is a bug fix it should have a Fixes: tag, and probably a stable Cc as well.

But that diffstat is really large for a bug fix. Is there no way to fix the issue in a smaller patch? Even if that is just disabling the feature until it can be fixed in subsequent commits?

cheers