Skip to contentSkip to conversation

crypto/af_alg06: new regression test for setting malformed authenc key

PATCH New Eric Biggers 2 participants 2 messages Apr 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/af_alg06: new regression test for setting malformed authenc key

From: Eric Biggers <[email protected]>

Test for a bug where the kernel crashed if a malformed key was set on an instance of the "authenc" crypto algorithm.

---
 runtest/crypto                     |  1 +
 testcases/kernel/crypto/.gitignore |  1 +
 testcases/kernel/crypto/af_alg06.c | 50 ++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 testcases/kernel/crypto/af_alg06.c
runtest/crypto +1 -0
index 41ea7b81c..ad713c5ed 100644
@@ -3,5 +3,6 @@ af_alg02 af_alg02
 af_alg03 af_alg03
 af_alg04 af_alg04
 af_alg05 af_alg05
+af_alg06 af_alg06
 pcrypt_aead01 pcrypt_aead01
 crypto_user01 crypto_user01
testcases/kernel/crypto/.gitignore +1 -0
index 17faf3eef..7340bde29 100644
@@ -3,5 +3,6 @@ af_alg02
 af_alg03
 af_alg04
 af_alg05
+af_alg06
 pcrypt_aead01
 crypto_user01
testcases/kernel/crypto/af_alg06.c new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
2.21.0.593.g511ec345e18-goog
#1 lore raw

PATCH 1/1 crypto/af_alg06: new regression test for setting malformed authenc key

Hi Eric,

testcases/kernel/crypto/af_alg06.c line 38

Quoted 3 lines
testcases/kernel/crypto/af_alg06.c new file +3 -0
+	tst_res(TINFO,
+		"Setting malformed authenc key.  May crash buggy kernels.");
+	TEST(setsockopt(algfd, SOL_ALG, ALG_SET_KEY, &key, sizeof(key)));

While test itself works nicely (crashes 4.20 kernel), there were still some old distros issues - missing SOL_ALG [1].
Thus pushed with added lapi/socket.h include.

Kind regards,
Petr

[1] https://api.travis-ci.org/v3/job/523184489/log.txt