Skip to contentSkip to conversation

encrypted-keys: Print more useful debug info if encryption algo is not available

PATCH NAK Anatol Pomozov 3 participants 8 messages Oct 5, 2020 – Oct 12, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 encrypted-keys: Print more useful debug info if encryption algo is not available

It helps to improve a cryptic message "encrypted_key failed to alloc_cipher (-2)". Adding algo name makes it easier to understand what cipher has failed.

---
 security/keys/encrypted-keys/encrypted.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
security/keys/encrypted-keys/encrypted.c +2 -2
index 192e531c146f..c09d48f53682 100644
@@ -84,8 +84,8 @@ static int aes_get_sizes(void)
 
 	tfm = crypto_alloc_skcipher(blkcipher_alg, 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(tfm)) {
-		pr_err("encrypted_key: failed to alloc_cipher (%ld)\n",
-		       PTR_ERR(tfm));
+		pr_err("encrypted_key: failed to alloc_cipher for %s (%ld)\n",
+		       blkcipher_alg, PTR_ERR(tfm));
 		return PTR_ERR(tfm);
 	}
 	ivsize = crypto_skcipher_ivsize(tfm);
Signature · 1 line
2.28.0
#1 lore raw
Quoted 4 lines · Anatol Pomozov

It helps to improve a cryptic message "encrypted_key failed to alloc_cipher (-2)". Adding algo name makes it easier to understand what cipher has failed.

NAK, because you are missing David Howells from the CC list.

/Jarkko

#2 lore raw
In reply to Anatol Pomozov
Quoted 7 lines · Jarkko Sakkinen
Quoted 4 lines · Anatol Pomozov

It helps to improve a cryptic message "encrypted_key failed to alloc_cipher (-2)". Adding algo name makes it easier to understand what cipher has failed.

NAK, because you are missing David Howells from the CC list.

Oh and also me. You are essentially missing all the keyring maintainers.

/Jarkko

#3 lore raw
In reply to Anatol Pomozov

Hi

Quoted 11 lines · Jarkko Sakkinen
Quoted 7 lines · Jarkko Sakkinen
Quoted 4 lines · Anatol Pomozov

It helps to improve a cryptic message "encrypted_key failed to alloc_cipher (-2)". Adding algo name makes it easier to understand what cipher has failed.

NAK, because you are missing David Howells from the CC list.

Oh and also me. You are essentially missing all the keyring maintainers.

The MAINTAINERS file states following:

KEYS-ENCRYPTED

M:      Mimi Zohar <[email protected]>
L:      [email protected]
L:      [email protected]
S:      Supported
F:      Documentation/security/keys/trusted-encrypted.rst
F:      include/keys/encrypted-type.h
F:      security/keys/encrypted-keys/

Everything seems fine as I included the official maintainer and the project maillist.

If David is not subscribed to the project maillist I'll be glad to CC him as well.

Acked-by on v2 1/1
#4 lore raw
In reply to Anatol Pomozov
Quoted 27 lines · Anatol Pomozov

Hi

Quoted 11 lines · Jarkko Sakkinen
Quoted 7 lines · Jarkko Sakkinen
Quoted 4 lines · Anatol Pomozov

It helps to improve a cryptic message "encrypted_key failed to alloc_cipher (-2)". Adding algo name makes it easier to understand what cipher has failed.

NAK, because you are missing David Howells from the CC list.

Oh and also me. You are essentially missing all the keyring maintainers.

The MAINTAINERS file states following:

KEYS-ENCRYPTED

M:      Mimi Zohar <[email protected]>
L:      [email protected]
L:      [email protected]
S:      Supported
F:      Documentation/security/keys/trusted-encrypted.rst
F:      include/keys/encrypted-type.h
F:      security/keys/encrypted-keys/
Quoted 5 lines

Everything seems fine as I included the official maintainer and the project maillist.

If David is not subscribed to the project maillist I'll be glad to CC him as well.

Ugh, you are right then. Those two lists still confuse me thought but that is not your fault.

Based on that I can give my ack because the change looks right still.

Thanks for explaining the situation.

/Jarkko

maintainer
#5 lore raw
In reply to Anatol Pomozov
Quoted 28 lines · Jarkko Sakkinen
Quoted 27 lines · Anatol Pomozov

Hi

Quoted 11 lines · Jarkko Sakkinen
Quoted 7 lines · Jarkko Sakkinen
Quoted 4 lines · Anatol Pomozov

It helps to improve a cryptic message "encrypted_key failed to alloc_cipher (-2)". Adding algo name makes it easier to understand what cipher has failed.

NAK, because you are missing David Howells from the CC list.

Oh and also me. You are essentially missing all the keyring maintainers.

The MAINTAINERS file states following:

KEYS-ENCRYPTED

M:      Mimi Zohar <[email protected]>
L:      [email protected]
L:      [email protected]
S:      Supported
F:      Documentation/security/keys/trusted-encrypted.rst
F:      include/keys/encrypted-type.h
F:      security/keys/encrypted-keys/
Quoted 8 lines
Quoted 5 lines

Everything seems fine as I included the official maintainer and the project maillist.

If David is not subscribed to the project maillist I'll be glad to CC him as well.

Ugh, you are right then. Those two lists still confuse me thought but that is not your fault.

Please refer to Documentation/security/keys/trusted-encrypted.rst for an explanation.

Quoted 7 lines

Based on that I can give my ack because the change looks right still.

Thanks for explaining the situation.

Thanks, Jarrko. I'm on vacation, returning next week.

Mimi

#6 lore raw
In reply to Anatol Pomozov
Quoted 32 lines · Mimi Zohar
Quoted 31 lines · Jarkko Sakkinen
Quoted 30 lines · Anatol Pomozov

Hi

Quoted 11 lines · Jarkko Sakkinen
Quoted 7 lines · Jarkko Sakkinen
Quoted 4 lines · Anatol Pomozov

It helps to improve a cryptic message "encrypted_key failed to alloc_cipher (-2)". Adding algo name makes it easier to understand what cipher has failed.

NAK, because you are missing David Howells from the CC list.

Oh and also me. You are essentially missing all the keyring maintainers.

The MAINTAINERS file states following:

KEYS-ENCRYPTED

M:      Mimi Zohar <[email protected]>
L:      [email protected]
L:      [email protected]
S:      Supported
F:      Documentation/security/keys/trusted-encrypted.rst
F:      include/keys/encrypted-type.h
F:      security/keys/encrypted-keys/

Everything seems fine as I included the official maintainer and the project maillist.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

If David is not subscribed to the project maillist I'll be glad to CC him as well.

Ugh, you are right then. Those two lists still confuse me thought but that is not your fault.

Please refer to Documentation/security/keys/trusted-encrypted.rst for an explanation.

Yeah, I was not sure about the organization and just spotted keyrings in the CC list :-)

Quoted 10 lines
Quoted 8 lines

Based on that I can give my ack because the change looks right still.

Thanks for explaining the situation.

Thanks, Jarrko. I'm on vacation, returning next week.

Have a good one!

Quoted 1 line

Mimi

/Jarkko

maintainer
#7 lore raw
In reply to Anatol Pomozov

Hi Anatol,

Quoted 4 lines · Anatol Pomozov

It helps to improve a cryptic message "encrypted_key failed to alloc_cipher (-2)". Adding algo name makes it easier to understand what cipher has failed.

The "if" clause in the Subject line doesn't belong there, but in the patch description. I would start the patch description with "Improve the cryptic message ... by adding ..."

Quoted 9 lines
---
 security/keys/encrypted-keys/encrypted.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
security/keys/encrypted-keys/encrypted.c +0 -0
index 192e531c146f..c09d48f53682 100644

security/keys/encrypted-keys/encrypted.c static int aes_get_sizes(void) · line 88

Quoted 7 lines
security/keys/encrypted-keys/encrypted.c +2 -2
@@ -84,8 +84,8 @@ static int aes_get_sizes(void)
 
 	tfm = crypto_alloc_skcipher(blkcipher_alg, 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(tfm)) {
-		pr_err("encrypted_key: failed to alloc_cipher (%ld)\n",
-		       PTR_ERR(tfm));
+		pr_err("encrypted_key: failed to alloc_cipher for %s (%ld)\n",
+		       blkcipher_alg, PTR_ERR(tfm));

I don't have a problem with including the blkcipher_alg in the error
message. It is currently defined as "cbc(aes)". Is it ever anything
else?

thanks,

Mimi

Quoted 3 lines
security/keys/encrypted-keys/encrypted.c +0 -0
 		return PTR_ERR(tfm);
 	}
 	ivsize = crypto_skcipher_ivsize(tfm);