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

4016 Commits

Author SHA1 Message Date
Michael Brown 8685280cbd [build] Allow a client certificate to be specified at build time
Allow a client certificate and corresponding private key to be
specified at build time using the syntax

  make CERT=/path/to/certificate KEY=/path/to/key

The build process uses openssl to convert the files into DER format,
and includes them within the client certificate store in
clientcert.c.  The build process will prompt for the private key
password if applicable.

Note that the private key is stored unencrypted, and so the resulting
iPXE binary (and the temporary files created during the build process)
should be treated as being equivalent to an unencrypted private key
file.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-20 20:39:11 +00:00
Michael Brown 05c13716f9 [crypto] Use linker tables for RSA digestInfo prefixes
Allow external code to specify RSA digestInfo prefixes for additional
digest algorithms.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-20 17:10:39 +00:00
Michael Brown 7869f71ae7 [tls] Treat handshake digest algorithm as a session parameter
Simplify code by recording the active handshake digest algorithm as a
session parameter.  (Note that we must still accumulate digests for
all supported algorithms, since we don't know which digest will
eventually be used until we receive the Server Hello.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-20 17:10:39 +00:00
Michael Brown a156c15746 [tls] Use hybrid MD5+SHA1 algorithm
TLSv1.1 and earlier use a hybrid of MD5 and SHA-1 to generate digests
over the handshake messages.  Formalise this as a separate digest
algorithm "md5+sha1".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-20 16:57:16 +00:00
Michael Brown 8583c323a2 [tls] Check certificate validity period against current date and time
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 23:14:17 +00:00
Michael Brown 0610bcb1d2 [tls] Parse X.509 validity times into seconds since the Epoch
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 23:07:15 +00:00
Michael Brown 5da712385e [tls] Include current time within the client random bytes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 23:07:13 +00:00
Michael Brown 12002d6955 [time] Add RTC-based time source
Add a time source using the CMOS RTC to obtain the current time.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 22:13:32 +00:00
Michael Brown 846bde90e6 [time] Define an API for getting the current time
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-19 22:13:27 +00:00
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