Keyctl: DH test failure
Hi,
The keyctl test COMPUTE DERIVED KEY WITH LEADING ZEROS fails on current kernels.
keyutils/tests/keyctl/dh_compute/valid
+++ LOAD SOURCE KEYS
+++ COMPUTE DH PUBLIC KEY
+++ LOAD SHA-256 SOURCE KEYS
+++ COMPUTE DH SHARED SECRET
+++ COMPUTE DERIVED KEY FROM DH SHARED SECRET (SHA-256) +++ COMPUTE DERIVED KEY WITH LEADING ZEROS FAILED
+++ LOAD SHA-224 SOURCE KEYS
+++ COMPUTE DH SHARED SECRET
+++ COMPUTE DERIVED KEY FROM DH SHARED SECRET (SHA-224)
The failure happens in the following check:
+ '[' 2 '!=' 2 -o 'xf571d0e7 18e00aba c6c1962b 11ded645' '!=' 'x0066207b cdab1d64 bbf489b3 d6a0dadc' ']'
I.e. the kernel returns "xf571d0e7 18e00aba c6c1962b 11ded645" but the test expects "x0066207b cdab1d64 bbf489b3 d6a0dadc".
Ciao
Stephan
David Howells
maintainerQuoted 17 lines · Stephan Müller
The keyctl test COMPUTE DERIVED KEY WITH LEADING ZEROS fails on current kernels.
keyutils/tests/keyctl/dh_compute/valid
+++ LOAD SOURCE KEYS
+++ COMPUTE DH PUBLIC KEY
+++ LOAD SHA-256 SOURCE KEYS
+++ COMPUTE DH SHARED SECRET
+++ COMPUTE DERIVED KEY FROM DH SHARED SECRET (SHA-256) +++ COMPUTE DERIVED KEY WITH LEADING ZEROS FAILED
+++ LOAD SHA-224 SOURCE KEYS
+++ COMPUTE DH SHARED SECRET
+++ COMPUTE DERIVED KEY FROM DH SHARED SECRET (SHA-224)
Quoted 7 lines
The failure happens in the following check:
+ '[' 2 '!=' 2 -o 'xf571d0e7
18e00abac6c1962b11ded645' '!=' 'x0066207bcdab1d64bbf489b3d6a0dadc' ']'I.e. the kernel returns "xf571d0e7
18e00abac6c1962b11ded645" but the test expects "x0066207bcdab1d64bbf489b3d6a0dadc".
Hmmm... It works fine for me. I'm using commit 9791581c049c10929e97098374dd1716a81fefcc as the base. Any idea where it goes wrong?
David
Am Montag, dem 25.01.2021 um 15:17 +0000 schrieb David Howells:
Quoted 5 lines
Quoted 4 lines · Stephan Müller
+ '[' 2 '!=' 2 -o 'xf571d0e7
18e00abac6c1962b11ded645' '!=' 'x0066207bcdab1d64bbf489b3d6a0dadc' ']'
Quoted 8 lines
Quoted 3 lines
I.e. the kernel returns "xf571d0e7
18e00abac6c1962b11ded645" but the test
expects "x0066207bcdab1d64bbf489b3d6a0dadc".Hmmm... It works fine for me. I'm using commit
9791581c049c10929e97098374dd1716a81fefccas the base. Any idea where it goes
wrong?
The issue is that it does not work for me on either 5.11-rc4, 5.10-rc1, and even on the Fedora 32 kernel package version 5.9.11-100.fc32.x86_64.
So, I am a bit surprised too.
I noticed the issue during the development of the KDF patches and thought my patches are broken. But my patches calculate the exact same responses as the kernel version without the patches. So, it must be something with either the input data or the operations before the KDF.
Still investigating...
Ciao
Stephan