* [PATCH] crypto: s390 des3 - permit weak keys unless REQ_WEAK_KEY set
@ 2009-06-08 17:32 Jarod Wilson
2009-06-11 13:38 ` Heiko Carstens
2009-06-18 11:53 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Jarod Wilson @ 2009-06-08 17:32 UTC (permalink / raw)
To: linux-crypto; +Cc: linux-s390, linux-kernel, Herbert Xu
Just started running fips cavs test vectors through an s390x system
for giggles, and discovered that I missed patching s390's arch-specific
des3 implementation w/an earlier des3 patch to permit weak keys.
This change adds the same flag tweaks as ad79cdd77fc1466e45cf923890f66bcfe7c43f12
for s390's des3 implementation, yields expected test results now.
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
arch/s390/crypto/des_s390.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
index 4aba83b..2bc479a 100644
--- a/arch/s390/crypto/des_s390.c
+++ b/arch/s390/crypto/des_s390.c
@@ -250,8 +250,9 @@ static int des3_128_setkey(struct crypto_tfm *tfm, const u8 *key,
const u8 *temp_key = key;
u32 *flags = &tfm->crt_flags;
- if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE))) {
- *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED;
+ if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE)) &&
+ (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
+ *flags |= CRYPTO_TFM_RES_WEAK_KEY;
return -EINVAL;
}
for (i = 0; i < 2; i++, temp_key += DES_KEY_SIZE) {
@@ -411,9 +412,9 @@ static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key,
if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
- DES_KEY_SIZE))) {
-
- *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED;
+ DES_KEY_SIZE)) &&
+ (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
+ *flags |= CRYPTO_TFM_RES_WEAK_KEY;
return -EINVAL;
}
for (i = 0; i < 3; i++, temp_key += DES_KEY_SIZE) {
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: s390 des3 - permit weak keys unless REQ_WEAK_KEY set
2009-06-08 17:32 [PATCH] crypto: s390 des3 - permit weak keys unless REQ_WEAK_KEY set Jarod Wilson
@ 2009-06-11 13:38 ` Heiko Carstens
2009-06-18 11:53 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2009-06-11 13:38 UTC (permalink / raw)
To: Jarod Wilson; +Cc: linux-crypto, linux-s390, linux-kernel, Herbert Xu
On Mon, Jun 08, 2009 at 01:32:09PM -0400, Jarod Wilson wrote:
> Just started running fips cavs test vectors through an s390x system
> for giggles, and discovered that I missed patching s390's arch-specific
> des3 implementation w/an earlier des3 patch to permit weak keys.
>
> This change adds the same flag tweaks as ad79cdd77fc1466e45cf923890f66bcfe7c43f12
> for s390's des3 implementation, yields expected test results now.
>
> Signed-off-by: Jarod Wilson <jarod@redhat.com>
>
> ---
> arch/s390/crypto/des_s390.c | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
> index 4aba83b..2bc479a 100644
> --- a/arch/s390/crypto/des_s390.c
> +++ b/arch/s390/crypto/des_s390.c
> @@ -250,8 +250,9 @@ static int des3_128_setkey(struct crypto_tfm *tfm, const u8 *key,
> const u8 *temp_key = key;
> u32 *flags = &tfm->crt_flags;
>
> - if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE))) {
> - *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED;
> + if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE)) &&
> + (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
> + *flags |= CRYPTO_TFM_RES_WEAK_KEY;
> return -EINVAL;
I think this should go in via crypt-dev. Herbert?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: s390 des3 - permit weak keys unless REQ_WEAK_KEY set
2009-06-08 17:32 [PATCH] crypto: s390 des3 - permit weak keys unless REQ_WEAK_KEY set Jarod Wilson
2009-06-11 13:38 ` Heiko Carstens
@ 2009-06-18 11:53 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2009-06-18 11:53 UTC (permalink / raw)
To: Jarod Wilson; +Cc: linux-crypto, linux-s390, linux-kernel
On Mon, Jun 08, 2009 at 01:32:09PM -0400, Jarod Wilson wrote:
> Just started running fips cavs test vectors through an s390x system
> for giggles, and discovered that I missed patching s390's arch-specific
> des3 implementation w/an earlier des3 patch to permit weak keys.
>
> This change adds the same flag tweaks as ad79cdd77fc1466e45cf923890f66bcfe7c43f12
> for s390's des3 implementation, yields expected test results now.
>
> Signed-off-by: Jarod Wilson <jarod@redhat.com>
Patch applied to cryptodev. Thanks Jarod!
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-18 11:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-08 17:32 [PATCH] crypto: s390 des3 - permit weak keys unless REQ_WEAK_KEY set Jarod Wilson
2009-06-11 13:38 ` Heiko Carstens
2009-06-18 11:53 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox