• David Howells's avatar
    PEFILE: Relax the check on the length of the PKCS#7 cert · 0aa04094
    David Howells authored
    Relax the check on the length of the PKCS#7 cert as it appears that the PE
    file wrapper size gets rounded up to the nearest 8.
    
    The debugging output looks like this:
    
    	PEFILE: ==> verify_pefile_signature()
    	PEFILE: ==> pefile_parse_binary()
    	PEFILE: checksum @ 110
    	PEFILE: header size = 200
    	PEFILE: cert = 968 @547be0 [68 09 00 00 00 02 02 00 30 82 09 56 ]
    	PEFILE: sig wrapper = { 968, 200, 2 }
    	PEFILE: Signature data not PKCS#7
    
    The wrapper is the first 8 bytes of the hex dump inside [].  This indicates a
    length of 0x968 bytes, including the wrapper header - so 0x960 bytes of
    payload.
    
    The ASN.1 wrapper begins [ ... 30 82 09 56 ].  That indicates an object of size
    0x956 - a four byte discrepency, presumably just padding for alignment
    purposes.
    
    So we just check that the ASN.1 container is no bigger than the payload and
    reduce the recorded size appropriately.
    
    Whilst we're at it, allow shorter PKCS#7 objects that manage to squeeze within
    127 or 255 bytes.  It's just about conceivable if no X.509 certs are included
    in the PKCS#7 message.
    Reported-by: default avatarVivek Goyal <vgoyal@redhat.com>
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
    Acked-by: default avatarPeter Jones <pjones@redhat.com>
    Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
    0aa04094
Name
Last commit
Last update
..
asymmetric_keys Loading commit data...
async_tx Loading commit data...
842.c Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
ablk_helper.c Loading commit data...
ablkcipher.c Loading commit data...
aead.c Loading commit data...
aes_generic.c Loading commit data...
af_alg.c Loading commit data...
ahash.c Loading commit data...
algapi.c Loading commit data...
algboss.c Loading commit data...
algif_hash.c Loading commit data...
algif_skcipher.c Loading commit data...
ansi_cprng.c Loading commit data...
anubis.c Loading commit data...
api.c Loading commit data...
arc4.c Loading commit data...
authenc.c Loading commit data...
authencesn.c Loading commit data...
blkcipher.c Loading commit data...
blowfish_common.c Loading commit data...
blowfish_generic.c Loading commit data...
camellia_generic.c Loading commit data...
cast5_generic.c Loading commit data...
cast6_generic.c Loading commit data...
cast_common.c Loading commit data...
cbc.c Loading commit data...
ccm.c Loading commit data...
chainiv.c Loading commit data...
cipher.c Loading commit data...
cmac.c Loading commit data...
compress.c Loading commit data...
crc32.c Loading commit data...
crc32c_generic.c Loading commit data...
crct10dif_common.c Loading commit data...
crct10dif_generic.c Loading commit data...
cryptd.c Loading commit data...
crypto_null.c Loading commit data...
crypto_user.c Loading commit data...
crypto_wq.c Loading commit data...
ctr.c Loading commit data...
cts.c Loading commit data...
deflate.c Loading commit data...
des_generic.c Loading commit data...
drbg.c Loading commit data...
ecb.c Loading commit data...
eseqiv.c Loading commit data...
fcrypt.c Loading commit data...
fips.c Loading commit data...
gcm.c Loading commit data...
gf128mul.c Loading commit data...
ghash-generic.c Loading commit data...
hash_info.c Loading commit data...
hmac.c Loading commit data...
internal.h Loading commit data...
khazad.c Loading commit data...
krng.c Loading commit data...
lrw.c Loading commit data...
lz4.c Loading commit data...
lz4hc.c Loading commit data...
lzo.c Loading commit data...
md4.c Loading commit data...
md5.c Loading commit data...
memneq.c Loading commit data...
michael_mic.c Loading commit data...
pcbc.c Loading commit data...
pcompress.c Loading commit data...
pcrypt.c Loading commit data...
proc.c Loading commit data...
ripemd.h Loading commit data...
rmd128.c Loading commit data...
rmd160.c Loading commit data...
rmd256.c Loading commit data...
rmd320.c Loading commit data...
rng.c Loading commit data...
salsa20_generic.c Loading commit data...
scatterwalk.c Loading commit data...
seed.c Loading commit data...
seqiv.c Loading commit data...
serpent_generic.c Loading commit data...
sha1_generic.c Loading commit data...
sha256_generic.c Loading commit data...
sha512_generic.c Loading commit data...
shash.c Loading commit data...
tcrypt.c Loading commit data...
tcrypt.h Loading commit data...
tea.c Loading commit data...
testmgr.c Loading commit data...
testmgr.h Loading commit data...
tgr192.c Loading commit data...
twofish_common.c Loading commit data...
twofish_generic.c Loading commit data...
vmac.c Loading commit data...
wp512.c Loading commit data...
xcbc.c Loading commit data...
xor.c Loading commit data...
xts.c Loading commit data...
zlib.c Loading commit data...