david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

4057 Commits

Author SHA1 Message Date
Michael Brown c130001bdf [test] Add self-tests for mktime()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 17:35:46 +00:00
Michael Brown bd6805a8c1 [libc] Add mktime() function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 17:35:46 +00:00
Michael Brown 0b2c7885c7 [crypto] Use correct constraint for byte-addressable register
Reported-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 17:22:52 +00:00
Michael Brown f3a791c6de [tls] Validate server certificate
Validate the server certificate against the trusted root certificate
store.  The server must provide a complete certificate chain, up to
and including the trusted root certificate that is embedded into iPXE.

Note that the date and time are not yet validated.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 00:26:19 +00:00
Michael Brown aee3a064f2 [build] Allow trusted root certificates to be specified at build time
Allow trusted root certificates to be specified at build time using
the syntax

  make TRUST=/path/to/certificate1,/path/to/certificate2,...

The build process uses openssl to calculate the SHA-256 fingerprints
of the specified certificates, and adds them to the root certificate
store in rootcert.c.  The certificates can be in any format understood
by openssl.

The certificates may be server certificates or (more usefully) CA
certificates.

If no trusted certificates are specified, then the default "iPXE root
CA" certificate will be used.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 00:23:29 +00:00
Michael Brown 4d3b5473f8 [tls] Add full X.509 certificate parsing
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 00:22:22 +00:00
Michael Brown d6979e0d55 [rsa] Actually check the unused-bits byte in the public key bit string
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 20:46:38 +00:00
Michael Brown 3ec773cd2b [crypto] Force caller to provide temporary storage for modular calculations
bigint_mod_multiply() and bigint_mod_exp() require a fixed amount of
temporary storage for intermediate results.  (The amount of temporary
storage required depends upon the size of the integers involved.)

When performing calculations for 4096-bit RSA the amount of temporary
storage space required will exceed 2.5kB, which is too much to
allocate on the stack.  Avoid this problem by forcing the caller to
allocate temporary storage.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 20:22:43 +00:00
Michael Brown 5af9e62196 [rng] Add Linux entropy source using /dev/random
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 17:06:03 +00:00
Michael Brown 196f0bb081 [rng] Allow entropy_enable() to return an error
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 17:05:37 +00:00
Michael Brown 66f200bdac [crypto] Remove obsolete AXTLS RSA algorithm
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 14:47:16 +00:00
Michael Brown dc87161c30 [tls] Use iPXE native RSA algorithm
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 14:44:53 +00:00
Michael Brown 7fb064470f [test] Add self-tests for RSA
Add self-tests for the RSA algorithm using test vectors generated with
the openssl tools.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 13:37:56 +00:00
Michael Brown 299dedcff0 [crypto] Add native RSA algorithm
Add an implementation of RSA that uses the iPXE big-integer support.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 13:36:07 +00:00
Michael Brown c00eb6e190 [crypto] Add abstraction for a public-key algorithm
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 13:35:32 +00:00
Michael Brown e20550fddf [crypto] Add more ASN.1 functions for X.509 certificate parsing
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 13:34:47 +00:00
Michael Brown da76a489d6 [test] Run self-tests as an embedded image
Allow iPXE to exit after running self-tests, rather than locking the
machine.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 13:13:50 +00:00
Michael Brown b0a1ad9242 [rng] Fix build error when assertions are enabled
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 12:26:33 +00:00
Michael Brown a0082b1308 [libc] Move VA_ARG_COUNT() macro to stdarg.h
Make the non-standard but extremely useful macro VA_ARG_COUNT()
available outside of dhcp.h.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-18 12:26:33 +00:00
Olaf Hering 0e81ff2297 [myri10ge] Fix compilation error in myri10ge_command() with gcc 4.7
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-16 16:43:55 +00:00
Michael Brown 37cb7c7498 [crypto] Use real prototypes for AXTLS' AES_encrypt() and AES_decrypt()
Avoid a compiler warning on some versions of gcc by using real
function prototypes.

Reported-by: Rob Shelley <Rob@cirris.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-14 00:12:02 +00:00
1d 2k 321883014b [eepro100] Add PCI ID 8086:10fe
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-14 00:03:19 +00:00
Michael Brown 4e53303c03 [test] Add big integer self-tests
These test vectors are generated using Perl's Math::BigInt.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-13 23:27:38 +00:00
Michael Brown 071184a6e4 [crypto] Add big-integer library for RSA calculations
RSA requires modular exponentiation using arbitrarily large integers.
Given the sizes of the modulus and exponent, all required calculations
can be done without any further dynamic storage allocation.  The x86
architecture allows for efficient large integer support via inline
assembly using the instructions that take advantage of the carry flag
(e.g. "adcl", "rcrl").

This implemention is approximately 80% smaller than the (more generic)
AXTLS implementation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-13 23:27:30 +00:00
Michael Brown f229162749 [crypto] Add ASN.1 functions for X.509 certificate parsing
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-13 16:30:17 +00:00
Michael Brown ffb6d6be6d [rng] Remove obsolete (and unfinished) get_random_bytes() function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-13 15:58:04 +00:00
Michael Brown 554627c960 [802.11] Use rbg_generate() for secure random numbers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-13 15:58:04 +00:00
Michael Brown a0e559d1f3 [forcedeth] Use standard random() function
It seems unlikely that a network card driver requires
cryptographically secure random numbers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-13 15:58:04 +00:00
Michael Brown b63bcd73a0 [tls] Use const to mark incoming data being processed
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-13 15:57:34 +00:00
Michael Brown 1c29b4d979 [crypto] Upgrade AES and RSA code to upstream axTLS version 1.4.5
All axTLS files are now vanilla versions of the upstream axTLS files,
with one minor exception: the unused "ctx" parameter of
bi_int_divide() has been marked with "__unused" to avoid a compilation
error.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-09 17:14:39 +00:00
Michael Brown 74b1e706a8 [ath9k] Fix compilation on older gcc versions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-09 17:09:26 +00:00
Michael Brown b4bb39909e [prefix] Eliminate uninitialised variable
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-09 17:09:26 +00:00
Michael Brown 8ad1e7ac12 [test] Avoid using "static const" for test declarations
gcc will not warn about unused constant static variables.  An unused
test declaration is almost certainly a bug, so ensure that warnings
are generated.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-07 00:35:58 +00:00
Michael Brown 18ff2ad53e [debug] Ensure debug address and colourisation fields are fully initialised
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-06 22:02:15 +00:00
Michael Brown 1f238bc69e [test] Add NIST self-tests for AES128 and AES256 in CBC mode
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-06 21:01:30 +00:00
Michael Brown 8d038040ea [rng] Choose HMAC_DRBG using SHA-256 as the DRBG algorithm
Both HMAC_DRBG using SHA-1 and HMAC_DRBG using SHA-256 are Approved
algorithms in ANS X9.82 for our chosen security strength of 128 bits.
However, general recommendations (see e.g. NIST SP800-57) are to use a
larger hash function in preference to SHA-1.

Since SHA-256 is required anyway for TLSv1.2 support, there is no code
size penalty for switching HMAC_DRBG to also use SHA-256.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-06 13:42:06 +00:00
Michael Brown a810258b42 [rng] Add NIST self-tests for HMAC_DRBG using SHA-256
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-06 13:34:22 +00:00
Michael Brown b9d9c3f1d5 [rng] Allow HMAC_DRBG to use multiple underlying hash algorithms
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-06 13:12:30 +00:00
Michael Brown 742e43be05 [rng] Use SHA-256 for Hash_df, and validate the hash function strength
ANS X9.82 Part 4 (April 2011 Draft) Section 13.3.4.2 states that "When
using the derivation function based on a hash function, the output
length of the hash function shall meet or exceed the security strength
indicated by the min_entropy parameter in the Get_entropy_input call",
although this criteria is missing from the pseudocode provided in the
same section.

Add a test for this condition, and upgrade from SHA-1 to SHA-256 since
SHA-1 has an output length of 160 bits, which is insufficient for
generating the (128 * 3/2 = 192) bits required when instantiating the
128-bit strength DRBG.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 23:51:54 +00:00
Michael Brown 0978251a66 [rng] Add NIST self-tests for Hash_df using SHA-256
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 23:51:54 +00:00
Michael Brown fb6a33360f [rng] Allow hash_df() to accept multiple underlying hash algorithms
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 23:23:45 +00:00
Michael Brown c8f52cccfb [tls] Formalise the definition of a TLS cipher suite
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 23:13:52 +00:00
Michael Brown 6069b09bfc [tls] Support (and prefer) SHA-256 variants of existing cipher suites
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 15:36:38 +00:00
Michael Brown 015c936791 [tls] Support TLS version 1.2
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 15:28:39 +00:00
Michael Brown fba2310562 [crypto] Replace MD5 implementation
Replace MD5 implementation with one which is around 20% smaller.  This
implementation has been verified using the existing MD5 self-tests.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 10:25:58 +00:00
Michael Brown cdb4802ff1 [802.11] Avoid using struct md5_ctx directly
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 10:18:16 +00:00
Michael Brown c15e73f283 [test] Add self-tests for MD5 algorithm
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 00:31:07 +00:00
Michael Brown bbdf17c3e8 [test] Add self-tests for SHA-256 algorithm
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 00:20:30 +00:00
Michael Brown 657ab17338 [crypto] Add SHA-256 algorithm
This implementation has been verified using the NIST SHA-256 test vectors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-05 00:18:49 +00:00
Michael Brown 3b689e531d [x86_64] Use memory address constraint in __bswap_16s()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-04 21:46:45 +00:00