openssl/crypto/x509
Dr. Stephen Henson ec2fede946 Fix various certificate fingerprint issues.
By using non-DER or invalid encodings outside the signed portion of a
certificate the fingerprint can be changed without breaking the signature.
Although no details of the signed portion of the certificate can be changed
this can cause problems with some applications: e.g. those using the
certificate fingerprint for blacklists.

1. Reject signatures with non zero unused bits.

If the BIT STRING containing the signature has non zero unused bits reject
the signature. All current signature algorithms require zero unused bits.

2. Check certificate algorithm consistency.

Check the AlgorithmIdentifier inside TBS matches the one in the
certificate signature. NB: this will result in signature failure
errors for some broken certificates.

3. Check DSA/ECDSA signatures use DER.

Reencode DSA/ECDSA signatures and compare with the original received
signature. Return an error if there is a mismatch.

This will reject various cases including garbage after signature
(thanks to Antti Karjalainen and Tuomo Untinen from the Codenomicon CROSS
program for discovering this case) and use of BER or invalid ASN.1 INTEGERs
(negative or with leading zeroes).

CVE-2014-8275
Reviewed-by: Emilia Käsper <emilia@openssl.org>

(cherry picked from commit 208a6012be)

Conflicts:
	crypto/dsa/dsa_vrf.c
2015-01-05 16:37:10 +00:00
..
.cvsignore
by_dir.c Fix X509_STORE locking 2010-02-19 18:25:39 +00:00
by_file.c
Makefile Make update: delete duplicate error code. 2008-09-17 17:11:09 +00:00
x509.h Add ASN1_TYPE_cmp and X509_ALGOR_cmp. 2015-01-05 15:34:49 +00:00
x509_att.c Add support for Local Machine Keyset attribute in PKCS#12 files. 2008-06-26 23:26:52 +00:00
x509_cmp.c PR: 1422 2009-02-15 12:10:39 +00:00
x509_d2.c
x509_def.c
x509_err.c Rebuild error file C source files. 2006-11-21 20:14:46 +00:00
x509_ext.c
x509_lu.c Fix X509_STORE locking 2010-02-19 18:25:39 +00:00
x509_obj.c
x509_r2x.c backport recent changes from the cvs head 2006-02-08 19:16:33 +00:00
x509_req.c allocate a new attributes entry in X509_REQ_add_extensions() 2006-12-04 19:10:58 +00:00
x509_set.c
x509_trs.c Change old obsolete email address... 2008-11-05 18:36:57 +00:00
x509_txt.c Typo in x509_txt.c [from HEAD]. 2007-05-19 18:04:21 +00:00
x509_v3.c improved error checking and some fixes 2005-07-26 20:55:17 +00:00
x509_vfy.c PR: 2606 2011-09-23 13:40:06 +00:00
x509_vfy.h Update from 1.0.0-stable. 2009-06-26 11:34:22 +00:00
x509_vpm.c Update from 1.0.0-stable. 2009-06-30 11:22:25 +00:00
x509cset.c Change old obsolete email address... 2008-11-05 18:36:57 +00:00
x509name.c
x509rset.c
x509spki.c Change old obsolete email address... 2008-11-05 18:36:57 +00:00
x509type.c
x_all.c Fix various certificate fingerprint issues. 2015-01-05 16:37:10 +00:00