aboutsummaryrefslogtreecommitdiffstats
path: root/src/crypto/sha256.c
Commit message (Collapse)AuthorAgeFilesLines
* [libc] Replace linker_assert() with build_assert()Michael Brown2024-01-161-9/+9
| | | | | | | | | | | | | | | | | | | | | | | We currently implement build-time assertions via a mechanism that generates a call to an undefined external function that will cause the link to fail unless the compiler can prove that the asserted condition is true (and thereby eliminate the undefined function call). This assertion mechanism can be used for conditions that are not amenable to the use of static_assert(), since static_assert() will not allow for proofs via dead code elimination. Add __attribute__((error(...))) to the undefined external function, so that the error is raised at compile time rather than at link time. This allows us to provide a more meaningful error message (which will include the file name and line number, as with any other compile-time error), and avoids the need for the caller to specify a unique symbol name for the external function. Change the name from linker_assert() to build_assert(), since the assertion now takes place at compile time rather than at link time. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Allow algorithms to be included without being OID-identifiableMichael Brown2020-06-161-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [crypto] Add SHA-512 algorithmMichael Brown2015-04-121-4/+4
| | | | | | | This implementation has been verified using the NIST SHA-512 test vectors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Add SHA-224 algorithmMichael Brown2015-04-121-13/+36
| | | | | | | | | | SHA-224 is almost identical to SHA-256, with differing initial hash values and a truncated output length. This implementation has been verified using the NIST SHA-224 test vectors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-021-1/+5
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Update FSF mailing address in GPL licence textsMichael Brown2012-07-201-1/+2
| | | | | Suggested-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Define ASN.1 OID-identified algorithms for all supported digestsMichael Brown2012-03-221-0/+11
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Use standard bit-rotation functionsMichael Brown2012-03-211-11/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Add SHA-256 algorithmMichael Brown2012-03-051-0/+254
This implementation has been verified using the NIST SHA-256 test vectors. Signed-off-by: Michael Brown <mcb30@ipxe.org>