diff options
| author | Michael Brown | 2014-03-25 16:01:32 +0100 |
|---|---|---|
| committer | Michael Brown | 2014-03-25 17:30:43 +0100 |
| commit | 01fa7efa38060c010103d444b47a2cd3ff684f82 (patch) | |
| tree | aa9eaf98352260b208691559165696b71fb05812 /src/crypto/cms.c | |
| parent | [ocsp] Handle OCSP responses that don't provide certificates (diff) | |
| download | ipxe-01fa7efa38060c010103d444b47a2cd3ff684f82.tar.gz ipxe-01fa7efa38060c010103d444b47a2cd3ff684f82.tar.xz ipxe-01fa7efa38060c010103d444b47a2cd3ff684f82.zip | |
[crypto] Remove dynamically-allocated storage for certificate name
iPXE currently allocates a copy the certificate's common name as a
string. This string is used by the TLS and CMS code to check
certificate names against an expected name, and also appears in
debugging messages.
Provide a function x509_check_name() to centralise certificate name
checking (in preparation for adding subjectAlternativeName support),
and a function x509_name() to provide a name to be used in debugging
messages, and remove the dynamically allocated string.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto/cms.c')
| -rw-r--r-- | src/crypto/cms.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/crypto/cms.c b/src/crypto/cms.c index c0c8d144f..6191d1bbe 100644 --- a/src/crypto/cms.c +++ b/src/crypto/cms.c @@ -130,7 +130,7 @@ static int cms_parse_certificates ( struct cms_signature *sig, } cert = x509_last ( sig->certificates ); DBGC ( sig, "CMS %p found certificate %s\n", - sig, cert->subject.name ); + sig, x509_name ( cert ) ); /* Move to next certificate */ asn1_skip_any ( &cursor ); @@ -680,8 +680,7 @@ int cms_verify ( struct cms_signature *sig, userptr_t data, size_t len, /* Verify using all signerInfos */ list_for_each_entry ( info, &sig->info, list ) { cert = x509_first ( info->chain ); - if ( name && ( ( cert->subject.name == NULL ) || - ( strcmp ( cert->subject.name, name ) != 0 ) ) ) + if ( name && ( x509_check_name ( cert, name ) != 0 ) ) continue; if ( ( rc = cms_verify_signer_info ( sig, info, data, len, time, root ) ) != 0 ) |
