@ -775,3 +775,201 @@ xzfKY2TzxLiOmctG0hXFkH5J
check_order ( crl1 . get ( ) , crl2 . get ( ) ) ;
check_order ( crl2 . get ( ) , crl1 . get ( ) ) ;
}
TEST ( PKCS7Test , KernelModuleSigning ) {
// Sign a message with the same call that the Linux kernel's sign-file.c
// makes.
static const char kCert [ ] = R " (
- - - - - BEGIN CERTIFICATE - - - - -
MIIFazCCA1OgAwIBAgIURVkPzF / 4 dwy7419Qk75uhIuyf0EwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMTA5MjExOTIyMTJaFw0yMjA5
MjExOTIyMTJaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQC1 + MOn + BopcEVR4QMvjXdAxGkWFllXyQFDToL + qOiP
RU1yN7C8KCtkbOAFttJIO4O / i0iZ7KqYbnmB6YUA / ONAcakocnrdoESgRJcVMeAx
Dk / 11 OtMF5yIfeOOO / TUeVNmAUaT63gFbKy / adpqhzJtOv9BBl5VcYNGGSE + 0 wtb
mjpmNsxunEQR1KLDc97fGYHeRfKoSyrCIEE8IaAEpKGR2Sku3v9Jwh7RpjupgiUA
kH6pJk7VMZm5vl2wFjYvfysgjeN5ZtsxFDMaPYZStpxMxpNd5C9DsO2Ljp5NMpGf
NGmG4ZqiaQg8z2cIM6ESmN1zDJdUh5IXed1fOxBZD / poUFH0wDRFWnvzlaPmjJEF
rYLMK8svnE5nEQp9vu93ISFBx7cofs + niMaUXPEqaRSqruifN2M1it3kOf / 8 YZl1
vurs + VtHD6nOJo6bd11 + 37 aBidIB / BaWnzLrDmSTcPFa1tkTHwoLqc9 + jThTq9jZ
6 w3lA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
) " ;
static const char kKey [ ] = R " (
- - - - - BEGIN PRIVATE KEY - - - - -
MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQC1 + MOn + BopcEVR
4 QMvjXdAxGkWFllXyQFDToL + qOiPRU1yN7C8KCtkbOAFttJIO4O / i0iZ7KqYbnmB
6 YUA / ONAcakocnrdoESgRJcVMeAxDk / 11 OtMF5yIfeOOO / TUeVNmAUaT63gFbKy /
adpqhzJtOv9BBl5VcYNGGSE + 0 wtbmjpmNsxunEQR1KLDc97fGYHeRfKoSyrCIEE8
IaAEpKGR2Sku3v9Jwh7RpjupgiUAkH6pJk7VMZm5vl2wFjYvfysgjeN5ZtsxFDMa
PYZStpxMxpNd5C9DsO2Ljp5NMpGfNGmG4ZqiaQg8z2cIM6ESmN1zDJdUh5IXed1f
OxBZD / poUFH0wDRFWnvzlaPmjJEFrYLMK8svnE5nEQp9vu93ISFBx7cofs + niMaU
XPEqaRSqruifN2M1it3kOf / 8 YZl1vurs + VtHD6nOJo6bd11 + 37 aBidIB / BaWnzLr
DmSTcPFa1tkTHwoLqc9 + jThTq9jZ6w3lAMPpsoenyD19UmQB589 + 4 kNp2SIO / Ttz
VQCGgQPXE2jDCl6G9aIPMkfvpPZK4THVil3WQRCFYnYdDO4HQXo2ZuC4RiqgY5yg
feoL + fa9k383lgxxAHQLS7xsbaVB40RmfdbdevgPYIwZNNO78ddRmMdSv6IknSW9
gydGzY //btY+t1SWcBZWzn1Ewq8g2QIDAQABAoICAFQ/liZAIaypxA5ChP0RG/Mq
fBSzyC1ybFlDEjbg8LrUNST6T6LtXhmipp0 + pWC33SljTPumrNzh2POir + djLbt6
Y / zL88KEHwGsf95aNxe / Lpn8N + wEyn4O + rmxXIq6mTgSwyBc1jZ8uAXu9iZ37YrQ
07 jBQA + C / GoJ3HB / uTRx1TPZjxBu3Lz8m1auYLMd1hiYfd4Y3vT9hfZXAwTjS8KA
riZ7K + p0K1yY / + pczNDUFTAvAjSGQEvUrP + H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jxeteC1neUDIdGxH / BA7JrAqcGaN9GT + R47YIfiS2WrEssD1Pi5h
hJTbHtjEDJ7BHLC / CNUhXbpyyu1y
- - - - - END PRIVATE KEY - - - - -
) " ;
bssl : : UniquePtr < BIO > cert_bio (
BIO_new_mem_buf ( const_cast < char * > ( kCert ) , sizeof ( kCert ) - 1 ) ) ;
bssl : : UniquePtr < X509 > cert (
PEM_read_bio_X509 ( cert_bio . get ( ) , nullptr , nullptr , nullptr ) ) ;
bssl : : UniquePtr < BIO > key_bio (
BIO_new_mem_buf ( const_cast < char * > ( kKey ) , sizeof ( kKey ) - 1 ) ) ;
bssl : : UniquePtr < EVP_PKEY > key (
PEM_read_bio_PrivateKey ( key_bio . get ( ) , nullptr , nullptr , nullptr ) ) ;
static const char kSignedData [ ] = " signed data " ;
bssl : : UniquePtr < BIO > data_bio ( BIO_new_mem_buf ( const_cast < char * > ( kSignedData ) ,
sizeof ( kSignedData ) - 1 ) ) ;
bssl : : UniquePtr < PKCS7 > pkcs7 (
PKCS7_sign ( cert . get ( ) , key . get ( ) , /*certs=*/ nullptr , data_bio . get ( ) ,
PKCS7_NOATTR | PKCS7_BINARY | PKCS7_NOCERTS | PKCS7_DETACHED ) ) ;
ASSERT_TRUE ( pkcs7 ) ;
uint8_t * pkcs7_bytes = nullptr ;
const int pkcs7_len = i2d_PKCS7 ( pkcs7 . get ( ) , & pkcs7_bytes ) ;
ASSERT_GE ( pkcs7_len , 0 ) ;
bssl : : UniquePtr < uint8_t > pkcs7_storage ( pkcs7_bytes ) ;
// RSA signatures are deterministic so the output should not change.
static const uint8_t kExpectedOutput [ ] = {
0x30 , 0x82 , 0x02 , 0xbc , 0x06 , 0x09 , 0x2a , 0x86 , 0x48 , 0x86 , 0xf7 , 0x0d ,
0x01 , 0x07 , 0x02 , 0xa0 , 0x82 , 0x02 , 0xad , 0x30 , 0x82 , 0x02 , 0xa9 , 0x02 ,
0x01 , 0x01 , 0x31 , 0x0d , 0x30 , 0x0b , 0x06 , 0x09 , 0x60 , 0x86 , 0x48 , 0x01 ,
0x65 , 0x03 , 0x04 , 0x02 , 0x01 , 0x30 , 0x0b , 0x06 , 0x09 , 0x2a , 0x86 , 0x48 ,
0x86 , 0xf7 , 0x0d , 0x01 , 0x07 , 0x01 , 0x31 , 0x82 , 0x02 , 0x86 , 0x30 , 0x82 ,
0x02 , 0x82 , 0x02 , 0x01 , 0x01 , 0x30 , 0x5d , 0x30 , 0x45 , 0x31 , 0x0b , 0x30 ,
0x09 , 0x06 , 0x03 , 0x55 , 0x04 , 0x06 , 0x13 , 0x02 , 0x41 , 0x55 , 0x31 , 0x13 ,
0x30 , 0x11 , 0x06 , 0x03 , 0x55 , 0x04 , 0x08 , 0x0c , 0x0a , 0x53 , 0x6f , 0x6d ,
0x65 , 0x2d , 0x53 , 0x74 , 0x61 , 0x74 , 0x65 , 0x31 , 0x21 , 0x30 , 0x1f , 0x06 ,
0x03 , 0x55 , 0x04 , 0x0a , 0x0c , 0x18 , 0x49 , 0x6e , 0x74 , 0x65 , 0x72 , 0x6e ,
0x65 , 0x74 , 0x20 , 0x57 , 0x69 , 0x64 , 0x67 , 0x69 , 0x74 , 0x73 , 0x20 , 0x50 ,
0x74 , 0x79 , 0x20 , 0x4c , 0x74 , 0x64 , 0x02 , 0x14 , 0x45 , 0x59 , 0x0f , 0xcc ,
0x5f , 0xf8 , 0x77 , 0x0c , 0xbb , 0xe3 , 0x5f , 0x50 , 0x93 , 0xbe , 0x6e , 0x84 ,
0x8b , 0xb2 , 0x7f , 0x41 , 0x30 , 0x0b , 0x06 , 0x09 , 0x60 , 0x86 , 0x48 , 0x01 ,
0x65 , 0x03 , 0x04 , 0x02 , 0x01 , 0x30 , 0x0d , 0x06 , 0x09 , 0x2a , 0x86 , 0x48 ,
0x86 , 0xf7 , 0x0d , 0x01 , 0x01 , 0x01 , 0x05 , 0x00 , 0x04 , 0x82 , 0x02 , 0x00 ,
0x54 , 0xd4 , 0x7c , 0xdc , 0x19 , 0x86 , 0xa1 , 0xb2 , 0xbe , 0xe3 , 0xa4 , 0x5e ,
0xad , 0x16 , 0x6f , 0x7c , 0xf9 , 0xa6 , 0x40 , 0x90 , 0xb8 , 0x78 , 0x85 , 0xf1 ,
0x02 , 0x59 , 0xe5 , 0x9f , 0x83 , 0xfb , 0x20 , 0xcf , 0x29 , 0x52 , 0xb6 , 0x35 ,
0x5c , 0xf9 , 0xef , 0x4e , 0xc5 , 0xd3 , 0xa6 , 0x45 , 0x6e , 0xfa , 0x0a , 0xa7 ,
0x53 , 0xc8 , 0xf4 , 0xf9 , 0xd6 , 0xc5 , 0xd8 , 0xd8 , 0x04 , 0x3d , 0xb4 , 0x15 ,
0xa7 , 0x7a , 0x53 , 0xdd , 0x27 , 0xfa , 0x58 , 0x2e , 0x5e , 0xc4 , 0xcd , 0x45 ,
0xaa , 0xc2 , 0x7b , 0xf9 , 0x3d , 0xd7 , 0x22 , 0x20 , 0x90 , 0xbb , 0xa5 , 0x62 ,
0xd5 , 0xaa , 0x39 , 0x8f , 0xc1 , 0x00 , 0xef , 0x4b , 0x03 , 0x2c , 0x32 , 0xc0 ,
0xad , 0x27 , 0xb6 , 0xfe , 0x86 , 0xe5 , 0x9d , 0xf0 , 0xbe , 0xb1 , 0x0d , 0xa4 ,
0xa3 , 0x40 , 0xe0 , 0xaa , 0x0a , 0x13 , 0x6e , 0x61 , 0x9a , 0x3b , 0xae , 0x78 ,
0xd4 , 0x6f , 0x2d , 0x1d , 0x40 , 0x4b , 0xe3 , 0x5f , 0xf8 , 0xe8 , 0x21 , 0x89 ,
0x35 , 0x73 , 0x6d , 0x7e , 0x41 , 0xc6 , 0x0f , 0x0c , 0x01 , 0x64 , 0x61 , 0xa8 ,
0x37 , 0xef , 0x2b , 0x95 , 0xb7 , 0x34 , 0xac , 0xc7 , 0xdb , 0x66 , 0x87 , 0x45 ,
0xb4 , 0x0f , 0x60 , 0x01 , 0x07 , 0x29 , 0x74 , 0x32 , 0x0b , 0xae , 0xbc , 0x08 ,
0x88 , 0x15 , 0xc3 , 0x79 , 0x4a , 0x1c , 0x5a , 0x9c , 0xc2 , 0xfb , 0x4f , 0xd3 ,
0x17 , 0xc2 , 0x40 , 0x71 , 0x37 , 0xea , 0xa6 , 0x1e , 0xf0 , 0x5b , 0xa5 , 0xd7 ,
0x9b , 0x9e , 0x57 , 0x44 , 0x74 , 0xc5 , 0xd5 , 0x5f , 0xba , 0xbc , 0xd7 , 0xe1 ,
0xae , 0xd0 , 0xd3 , 0xb5 , 0x10 , 0xc6 , 0x8b , 0xb1 , 0x83 , 0x7c , 0xaa , 0x3a ,
0xbb , 0xe8 , 0x7f , 0x56 , 0xc4 , 0x3b , 0x9d , 0x45 , 0x09 , 0x9b , 0x34 , 0xc9 ,
0xfb , 0x5a , 0xa1 , 0xab , 0xd0 , 0x07 , 0x79 , 0x43 , 0x58 , 0x44 , 0xd7 , 0x40 ,
0xc4 , 0xa7 , 0xd3 , 0xe9 , 0x18 , 0xb9 , 0x78 , 0x1d , 0x93 , 0x0b , 0xc1 , 0xdb ,
0xc3 , 0xae , 0xc9 , 0xe8 , 0x2c , 0xa7 , 0x8c , 0x7e , 0x31 , 0x1e , 0xec , 0x1c ,
0xab , 0x83 , 0xa0 , 0x5d , 0x0e , 0xc3 , 0x6a , 0x7c , 0x97 , 0x09 , 0xcf , 0x00 ,
0xa9 , 0x66 , 0xda , 0x21 , 0x85 , 0xaa , 0x47 , 0xd8 , 0xea , 0x8f , 0x72 , 0x54 ,
0x03 , 0x6c , 0xbc , 0x4b , 0xf9 , 0x92 , 0xae , 0x82 , 0x75 , 0x33 , 0x10 , 0x4d ,
0x65 , 0x4d , 0x0e , 0x73 , 0x5d , 0x6f , 0x09 , 0xee , 0x56 , 0x78 , 0x87 , 0x0b ,
0xa3 , 0xaa , 0xc2 , 0x5f , 0x49 , 0x73 , 0x0d , 0x78 , 0xfa , 0x40 , 0xc1 , 0x25 ,
0x2f , 0x5d , 0x8a , 0xe1 , 0xbf , 0x38 , 0x2c , 0xd0 , 0x26 , 0xbd , 0xf5 , 0x6e ,
0x02 , 0x01 , 0x2e , 0x9e , 0x27 , 0x64 , 0x4b , 0x61 , 0x8c , 0x68 , 0x6e , 0x09 ,
0xfe , 0x0b , 0xf8 , 0x36 , 0x4e , 0x84 , 0xb7 , 0x76 , 0xcb , 0x41 , 0xf0 , 0x40 ,
0x72 , 0xc9 , 0x74 , 0x64 , 0x5f , 0xbe , 0x9e , 0xfe , 0x9e , 0xce , 0x89 , 0x84 ,
0x68 , 0x81 , 0x57 , 0x2a , 0xdb , 0xd6 , 0x01 , 0xa8 , 0x1b , 0x6e , 0x5d , 0xc4 ,
0x65 , 0xbd , 0x0d , 0x98 , 0x54 , 0xa3 , 0x18 , 0x23 , 0x09 , 0x4a , 0x8d , 0x6c ,
0xc6 , 0x2e , 0xfe , 0x7a , 0xa9 , 0x11 , 0x92 , 0x8b , 0xd0 , 0xc1 , 0xe7 , 0x76 ,
0x71 , 0xec , 0x34 , 0xfc , 0xc8 , 0x2a , 0x5e , 0x38 , 0x52 , 0xe6 , 0xc8 , 0xa5 ,
0x1d , 0x0b , 0xce , 0xf5 , 0xc0 , 0xe5 , 0x0b , 0x88 , 0xa9 , 0x55 , 0x88 , 0x6c ,
0xfa , 0xea , 0xaa , 0x39 , 0x66 , 0xdd , 0x80 , 0x52 , 0xe0 , 0x7e , 0x45 , 0x8e ,
0x51 , 0x2c , 0x36 , 0x07 , 0xd7 , 0x2b , 0xf1 , 0x46 , 0x00 , 0x66 , 0xb2 , 0x5a ,
0x39 , 0xbe , 0xf7 , 0x26 , 0x15 , 0xbc , 0x55 , 0xdb , 0xe9 , 0x01 , 0xdd , 0x54 ,
0x27 , 0x2b , 0xfe , 0x86 , 0x52 , 0xef , 0xc6 , 0x27 , 0xa3 , 0xf7 , 0x55 , 0x55 ,
0xb8 , 0xe2 , 0x1f , 0xcb , 0x32 , 0xd8 , 0xba , 0xd6 , 0x69 , 0xde , 0x8d , 0xa7 ,
0xfa , 0xad , 0xf6 , 0x2a , 0xc0 , 0x6f , 0x86 , 0x50 , 0x27 , 0x5a , 0xe2 , 0xe3 ,
0xf6 , 0xb9 , 0x01 , 0xec , 0x01 , 0x37 , 0x84 , 0x01 ,
} ;
EXPECT_EQ ( Bytes ( pkcs7_bytes , pkcs7_len ) ,
Bytes ( kExpectedOutput , sizeof ( kExpectedOutput ) ) ) ;
// Other option combinations should fail.
EXPECT_FALSE (
PKCS7_sign ( cert . get ( ) , key . get ( ) , /*certs=*/ nullptr , data_bio . get ( ) ,
PKCS7_NOATTR | PKCS7_BINARY | PKCS7_NOCERTS ) ) ;
EXPECT_FALSE (
PKCS7_sign ( cert . get ( ) , key . get ( ) , /*certs=*/ nullptr , data_bio . get ( ) ,
PKCS7_BINARY | PKCS7_NOCERTS | PKCS7_DETACHED ) ) ;
EXPECT_FALSE (
PKCS7_sign ( cert . get ( ) , key . get ( ) , /*certs=*/ nullptr , data_bio . get ( ) ,
PKCS7_NOATTR | PKCS7_TEXT | PKCS7_NOCERTS | PKCS7_DETACHED ) ) ;
EXPECT_FALSE (
PKCS7_sign ( cert . get ( ) , key . get ( ) , /*certs=*/ nullptr , data_bio . get ( ) ,
PKCS7_NOATTR | PKCS7_BINARY | PKCS7_DETACHED ) ) ;
ERR_clear_error ( ) ;
}