]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
PKCS#7: fix direct verification of SignerInfo signature
authorEric Biggers <ebiggers@google.com>
Thu, 22 Feb 2018 14:38:33 +0000 (14:38 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 27 Aug 2018 14:40:05 +0000 (16:40 +0200)
commit17e1a05218b0451beb987bd9d7cff10919d622ab
treeae8455a3b0bfab47eaf1e57efb0d7d47bc5ce45b
parent82492597c54183978aecbaa3ca5fbf3137fdf6fa
PKCS#7: fix direct verification of SignerInfo signature

BugLink: http://bugs.launchpad.net/bugs/1786352
[ Upstream commit 6459ae386699a5fe0dc52cf30255f75274fa43a4 ]

If none of the certificates in a SignerInfo's certificate chain match a
trusted key, nor is the last certificate signed by a trusted key, then
pkcs7_validate_trust_one() tries to check whether the SignerInfo's
signature was made directly by a trusted key.  But, it actually fails to
set the 'sig' variable correctly, so it actually verifies the last
signature seen.  That will only be the SignerInfo's signature if the
certificate chain is empty; otherwise it will actually be the last
certificate's signature.

This is not by itself a security problem, since verifying any of the
certificates in the chain should be sufficient to verify the SignerInfo.
Still, it's not working as intended so it should be fixed.

Fix it by setting 'sig' correctly for the direct verification case.

Fixes: 757932e6da6d ("PKCS#7: Handle PKCS#7 messages that contain no X.509 certs")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
crypto/asymmetric_keys/pkcs7_trust.c