]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[crypto] Allow algorithms to be included without being OID-identifiable
authorMichael Brown <mcb30@ipxe.org>
Tue, 16 Jun 2020 16:14:54 +0000 (17:14 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 16 Jun 2020 16:14:54 +0000 (17:14 +0100)
commitbd7a5e4b9cd9833535b840959892135dfe0ffba7
treec422bf231259c13f1150d670132731d9b5bf9a88
parentdc785b0fb6867fd8fb2cacd148150b9115a2547b
[crypto] Allow algorithms to be included without being OID-identifiable

There are many ways in which the object for a cryptographic algorithm
may be included, even if not explicitly enabled in config/crypto.h.
For example: the MD5 algorithm is required by TLSv1.1 or earlier, by
iSCSI CHAP authentication, by HTTP digest authentication, and by NTLM
authentication.

In the current implementation, inclusion of an algorithm for any
reason will result in the algorithm's ASN.1 object identifier being
included in the "asn1_algorithms" table, which consequently allows the
algorithm to be used for any ASN1-identified purpose.  For example: if
the MD5 algorithm is included in order to support HTTP digest
authentication, then iPXE would accept a (validly signed) TLS
certificate using an MD5 digest.

Split the ASN.1 object identifiers into separate files that are
required only if explicitly enabled in config/crypto.h.  This allows
an algorithm to be omitted from the "asn1_algorithms" table even if
the algorithm implementation is dragged in for some other purpose.

The end result is that only the algorithms that are explicitly enabled
in config/crypto.h can be used for ASN1-identified purposes such as
signature verification.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
22 files changed:
src/config/config_crypto.c
src/config/crypto.h
src/crypto/md4.c
src/crypto/md5.c
src/crypto/mishmash/oid_md4.c [new file with mode: 0644]
src/crypto/mishmash/oid_md5.c [new file with mode: 0644]
src/crypto/mishmash/oid_rsa.c [new file with mode: 0644]
src/crypto/mishmash/oid_sha1.c [new file with mode: 0644]
src/crypto/mishmash/oid_sha224.c [new file with mode: 0644]
src/crypto/mishmash/oid_sha256.c [new file with mode: 0644]
src/crypto/mishmash/oid_sha384.c [new file with mode: 0644]
src/crypto/mishmash/oid_sha512.c [new file with mode: 0644]
src/crypto/mishmash/oid_sha512_224.c [new file with mode: 0644]
src/crypto/mishmash/oid_sha512_256.c [new file with mode: 0644]
src/crypto/rsa.c
src/crypto/sha1.c
src/crypto/sha224.c
src/crypto/sha256.c
src/crypto/sha384.c
src/crypto/sha512.c
src/crypto/sha512_224.c
src/crypto/sha512_256.c