]> git.ipfire.org Git - thirdparty/ipxe.git/log
thirdparty/ipxe.git
13 years ago[umalloc] Unhide umalloc()ed memory region when there are no allocations
Michael Brown [Mon, 26 Mar 2012 23:21:24 +0000 (00:21 +0100)] 
[umalloc] Unhide umalloc()ed memory region when there are no allocations

At present, we always hide an extra sizeof(struct external_memory), to
account for the header on the lowest allocated block.  This header
ceases to exist when there are no allocated blocks remaining.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[umalloc] Fail allocations when we run out of external memory
Michael Brown [Mon, 26 Mar 2012 23:18:12 +0000 (00:18 +0100)] 
[umalloc] Fail allocations when we run out of external memory

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Disambiguate all CMS errors
Michael Brown [Mon, 26 Mar 2012 22:34:49 +0000 (23:34 +0100)] 
[crypto] Disambiguate all CMS errors

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[image] Log results of image signature checks
Michael Brown [Mon, 26 Mar 2012 22:24:27 +0000 (23:24 +0100)] 
[image] Log results of image signature checks

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[downloader] Log final status of all downloads
Michael Brown [Mon, 26 Mar 2012 21:47:50 +0000 (22:47 +0100)] 
[downloader] Log final status of all downloads

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[syslog] Pass internal syslog() priority through to syslog console
Michael Brown [Mon, 26 Mar 2012 19:23:30 +0000 (20:23 +0100)] 
[syslog] Pass internal syslog() priority through to syslog console

Use a private ANSI escape sequence to convey the priority of an
internal syslog() message through to the syslog server.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[console] Do not share ANSI escape context between lineconsole users
Michael Brown [Mon, 26 Mar 2012 20:03:59 +0000 (21:03 +0100)] 
[console] Do not share ANSI escape context between lineconsole users

An ANSI escape sequence context cannot be shared between multiple
users.  Make the ANSI escape sequence context part of the line console
definition and provide individual contexts for each user.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[console] Add "log message" console usage and an internal syslog() call
Michael Brown [Mon, 26 Mar 2012 18:50:50 +0000 (19:50 +0100)] 
[console] Add "log message" console usage and an internal syslog() call

Provide an internal syslog() function (unrelated to the syslog
console) which can be used to create log messages with specified
priorities.

The build-time constant LOG_LEVEL can be used to select the minimum
required priority for log messages.  Any messages that do not have a
sufficient priority will be ignored (and will be optimised away at
compile-time).

The default LOG_LEVEL is LOG_NONE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[console] Exclude text-based UI output from logfile-based consoles
Michael Brown [Mon, 26 Mar 2012 18:02:30 +0000 (19:02 +0100)] 
[console] Exclude text-based UI output from logfile-based consoles

The output from text-based user interfaces such as the "config"
command is not generally meaningful for logfile-based consoles such as
syslog and vmconsole.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[console] Allow usage to be defined independently for each console
Michael Brown [Mon, 26 Mar 2012 16:25:08 +0000 (17:25 +0100)] 
[console] Allow usage to be defined independently for each console

Add the concept of a "console usage", such as "standard output" or
"debug messages".  Allow usages to be associated with each console
independently.  For example, to send debugging output via the serial
port, while preventing it from appearing on the local console:

  #define CONSOLE_SERIAL CONSOLE_USAGE_ALL
  #define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_DEBUG )

If no usages are explicitly specified, then a default set of usages
will be applied.  For example:

  #define CONSOLE_SERIAL

will have the same affect as

  #define CONSOLE_SERIAL CONSOLE_USAGE_ALL

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[console] Remove unused "btext" console
Michael Brown [Mon, 26 Mar 2012 14:47:34 +0000 (15:47 +0100)] 
[console] Remove unused "btext" console

The "btext" console has been disabled by a "#if 0" since 2007.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[console] Move putchar() and getchar() declarations to stdio.h
Michael Brown [Mon, 26 Mar 2012 13:43:52 +0000 (14:43 +0100)] 
[console] Move putchar() and getchar() declarations to stdio.h

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[image] Add the "imgtrust" and "imgverify" commands
Michael Brown [Thu, 22 Mar 2012 13:46:38 +0000 (13:46 +0000)] 
[image] Add the "imgtrust" and "imgverify" commands

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[image] Simplify image management commands and internal API
Michael Brown [Sat, 24 Mar 2012 01:16:37 +0000 (01:16 +0000)] 
[image] Simplify image management commands and internal API

Remove the name, cmdline, and action parameters from imgdownload() and
imgdownload_string().  These functions now simply download and return
an image.

Add the function imgacquire(), which will interpret a "name or URI
string" parameter and return either an existing image or a newly
downloaded image.

Use imgacquire() to merge similar image-management commands that
currently differ only by whether they take the name of an existing
image or the URI of a new image to download.  For example, "chain" and
"imgexec" can now be merged.

Extend imgstat and imgfree commands to take an optional list of
images.

Remove the arbitrary restriction on the length of image names.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[build] Fix compilation under Cygwin
Michael Brown [Thu, 22 Mar 2012 23:52:24 +0000 (23:52 +0000)] 
[build] Fix compilation under Cygwin

Originally-fixed-by: Steve Goodrich <steve.goodrich@se-eng.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[image] Add concept of trusted images
Michael Brown [Thu, 22 Mar 2012 13:39:45 +0000 (13:39 +0000)] 
[image] Add concept of trusted images

Trusted images may always be executed.  Untrusted images may be
executed only if the current image trust requirement allows untrusted
images.

Images can be marked as trusted using image_trust(), and marked as
untrusted using image_untrust().

The current image trust requirement can be changed using
image_set_trust().  It is possible to make the change permanent, in
which case any future attempts to change the image trust requirement
will fail.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[bios] Set character attributes only when necessary
Michael Brown [Thu, 22 Mar 2012 12:22:38 +0000 (12:22 +0000)] 
[bios] Set character attributes only when necessary

There is no INT 10 call for "display character with attribute,
advancing the cursor and scrolling the screen as necessary".  We
therefore make two INT 10 calls: INT 10,09 to write the character with
its attribute at the current cursor position, and then INT 10,0e to
(re)write the character (leaving the attribute unchanged), advance the
cursor position and scroll as necessary.

This confuses the serial-over-LAN console redirection feature provided
by some BIOSes.

Fix by performing the INT10,09 only when necessary to change the
existing attribute.

Reported-by: Itay Gazit <itaygazit@gmail.com>
Tested-by: Itay Gazit <itaygazit@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Add CMS self-tests
Michael Brown [Wed, 21 Mar 2012 17:31:53 +0000 (17:31 +0000)] 
[test] Add CMS self-tests

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Add support for Cryptographic Message Syntax (PKCS #7)
Michael Brown [Tue, 20 Mar 2012 23:54:16 +0000 (23:54 +0000)] 
[crypto] Add support for Cryptographic Message Syntax (PKCS #7)

The Cryptographic Message Syntax (PKCS#7) provides a format for
encapsulating digital signatures of arbitrary binary blobs.  A
signature can be generated using

  openssl cms -sign -in <file to sign> -binary -noattr \
     -signer <signer>.crt -inkey <signer>.key -certfile <CA>.crt \
  -outform DER -out <signature>

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Parse X.509 extended key usage extension
Michael Brown [Wed, 21 Mar 2012 16:16:37 +0000 (16:16 +0000)] 
[crypto] Parse X.509 extended key usage extension

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Differentiate "untrusted root" and "incomplete chain" error cases
Michael Brown [Thu, 22 Mar 2012 10:55:13 +0000 (10:55 +0000)] 
[crypto] Differentiate "untrusted root" and "incomplete chain" error cases

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Shrink raw certificate data to fit certificate
Michael Brown [Thu, 22 Mar 2012 11:01:13 +0000 (11:01 +0000)] 
[crypto] Shrink raw certificate data to fit certificate

The certificate may be part of an ASN.1-encoded certificate chain, and
so may not be the only object contained within the ASN.1 cursor.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Avoid an error when asn1_shrink() is already at end of object
Michael Brown [Thu, 22 Mar 2012 02:10:17 +0000 (02:10 +0000)] 
[crypto] Avoid an error when asn1_shrink() is already at end of object

asn1_skip() will return an error on reaching the end of an object, and
so should not be used as the basis for asn1_shrink().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Add previous certificate in chain as a parameter to parse_next()
Michael Brown [Wed, 21 Mar 2012 16:48:08 +0000 (16:48 +0000)] 
[crypto] Add previous certificate in chain as a parameter to parse_next()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Parse X.509 certificate serial number
Michael Brown [Wed, 21 Mar 2012 17:14:05 +0000 (17:14 +0000)] 
[crypto] Parse X.509 certificate serial number

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Define ASN.1 OID-identified algorithms for all supported digests
Michael Brown [Wed, 21 Mar 2012 14:18:06 +0000 (14:18 +0000)] 
[crypto] Define ASN.1 OID-identified algorithms for all supported digests

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Generalise X.509 OID-identified algorithm to asn1.c
Michael Brown [Wed, 21 Mar 2012 13:57:32 +0000 (13:57 +0000)] 
[crypto] Generalise X.509 OID-identified algorithm to asn1.c

The concept of an OID-identified algorithm as defined in X.509 is used
in some other standards (e.g. PKCS#7).  Generalise this functionality
and provide it as part of the ASN.1 core.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Add X.509 self-tests
Michael Brown [Sun, 18 Mar 2012 17:27:07 +0000 (17:27 +0000)] 
[test] Add X.509 self-tests

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Validate path length constraint in certificate chain
Michael Brown [Wed, 21 Mar 2012 19:18:38 +0000 (19:18 +0000)] 
[crypto] Validate path length constraint in certificate chain

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Treat ASN.1 OIDs as opaque
Michael Brown [Wed, 21 Mar 2012 16:09:58 +0000 (16:09 +0000)] 
[crypto] Treat ASN.1 OIDs as opaque

OIDs are theoretically part of a global hierarchy.  However, the
hierarchy is sufficiently disorganised as to be essentially
meaningless for all purposes other than guaranteeing uniqueness.
Ignore the hierarchical nature of OIDs and treat them as opaque.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Move all ASN.1 OIDs to asn1.h
Michael Brown [Tue, 20 Mar 2012 23:31:01 +0000 (23:31 +0000)] 
[crypto] Move all ASN.1 OIDs to asn1.h

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Use standard bit-rotation functions
Michael Brown [Wed, 21 Mar 2012 14:13:15 +0000 (14:13 +0000)] 
[crypto] Use standard bit-rotation functions

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[tls] Support sending a client certificate
Michael Brown [Tue, 20 Mar 2012 17:09:22 +0000 (17:09 +0000)] 
[tls] Support sending a client certificate

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[build] Allow a client certificate to be specified at build time
Michael Brown [Tue, 20 Mar 2012 13:32:20 +0000 (13:32 +0000)] 
[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>
13 years ago[crypto] Use linker tables for RSA digestInfo prefixes
Michael Brown [Tue, 20 Mar 2012 04:20:06 +0000 (04:20 +0000)] 
[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>
13 years ago[tls] Treat handshake digest algorithm as a session parameter
Michael Brown [Tue, 20 Mar 2012 17:05:37 +0000 (17:05 +0000)] 
[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>
13 years ago[tls] Use hybrid MD5+SHA1 algorithm
Michael Brown [Tue, 20 Mar 2012 04:07:53 +0000 (04:07 +0000)] 
[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>
13 years ago[tls] Check certificate validity period against current date and time
Michael Brown [Mon, 19 Mar 2012 23:04:05 +0000 (23:04 +0000)] 
[tls] Check certificate validity period against current date and time

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[tls] Parse X.509 validity times into seconds since the Epoch
Michael Brown [Mon, 19 Mar 2012 22:49:09 +0000 (22:49 +0000)] 
[tls] Parse X.509 validity times into seconds since the Epoch

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[tls] Include current time within the client random bytes
Michael Brown [Mon, 19 Mar 2012 23:05:26 +0000 (23:05 +0000)] 
[tls] Include current time within the client random bytes

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[time] Add RTC-based time source
Michael Brown [Mon, 19 Mar 2012 17:08:51 +0000 (17:08 +0000)] 
[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>
13 years ago[time] Define an API for getting the current time
Michael Brown [Mon, 19 Mar 2012 16:59:53 +0000 (16:59 +0000)] 
[time] Define an API for getting the current time

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Add self-tests for mktime()
Michael Brown [Mon, 19 Mar 2012 16:10:23 +0000 (16:10 +0000)] 
[test] Add self-tests for mktime()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[libc] Add mktime() function
Michael Brown [Mon, 19 Mar 2012 16:09:41 +0000 (16:09 +0000)] 
[libc] Add mktime() function

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Use correct constraint for byte-addressable register
Michael Brown [Mon, 19 Mar 2012 17:22:52 +0000 (17:22 +0000)] 
[crypto] Use correct constraint for byte-addressable register

Reported-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[tls] Validate server certificate
Michael Brown [Sun, 18 Mar 2012 20:17:41 +0000 (20:17 +0000)] 
[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>
13 years ago[build] Allow trusted root certificates to be specified at build time
Michael Brown [Sun, 18 Mar 2012 22:55:29 +0000 (22:55 +0000)] 
[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>
13 years ago[tls] Add full X.509 certificate parsing
Michael Brown [Sun, 18 Mar 2012 17:25:55 +0000 (17:25 +0000)] 
[tls] Add full X.509 certificate parsing

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[rsa] Actually check the unused-bits byte in the public key bit string
Michael Brown [Sun, 18 Mar 2012 20:42:03 +0000 (20:42 +0000)] 
[rsa] Actually check the unused-bits byte in the public key bit string

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Force caller to provide temporary storage for modular calculations
Michael Brown [Sun, 18 Mar 2012 20:02:25 +0000 (20:02 +0000)] 
[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>
13 years ago[rng] Add Linux entropy source using /dev/random
Michael Brown [Sun, 18 Mar 2012 17:03:58 +0000 (17:03 +0000)] 
[rng] Add Linux entropy source using /dev/random

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[rng] Allow entropy_enable() to return an error
Michael Brown [Sun, 18 Mar 2012 16:45:04 +0000 (16:45 +0000)] 
[rng] Allow entropy_enable() to return an error

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Remove obsolete AXTLS RSA algorithm
Michael Brown [Tue, 13 Mar 2012 16:49:42 +0000 (16:49 +0000)] 
[crypto] Remove obsolete AXTLS RSA algorithm

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[tls] Use iPXE native RSA algorithm
Michael Brown [Sun, 18 Mar 2012 14:44:53 +0000 (14:44 +0000)] 
[tls] Use iPXE native RSA algorithm

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Add self-tests for RSA
Michael Brown [Sun, 18 Mar 2012 13:28:36 +0000 (13:28 +0000)] 
[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>
13 years ago[crypto] Add native RSA algorithm
Michael Brown [Tue, 13 Mar 2012 16:47:29 +0000 (16:47 +0000)] 
[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>
13 years ago[crypto] Add abstraction for a public-key algorithm
Michael Brown [Sun, 18 Mar 2012 13:25:10 +0000 (13:25 +0000)] 
[crypto] Add abstraction for a public-key algorithm

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Add more ASN.1 functions for X.509 certificate parsing
Michael Brown [Sun, 18 Mar 2012 13:24:20 +0000 (13:24 +0000)] 
[crypto] Add more ASN.1 functions for X.509 certificate parsing

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Run self-tests as an embedded image
Michael Brown [Sun, 18 Mar 2012 02:42:00 +0000 (02:42 +0000)] 
[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>
13 years ago[rng] Fix build error when assertions are enabled
Michael Brown [Fri, 16 Mar 2012 19:52:39 +0000 (19:52 +0000)] 
[rng] Fix build error when assertions are enabled

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[libc] Move VA_ARG_COUNT() macro to stdarg.h
Michael Brown [Fri, 16 Mar 2012 11:57:15 +0000 (11:57 +0000)] 
[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>
13 years ago[myri10ge] Fix compilation error in myri10ge_command() with gcc 4.7
Olaf Hering [Fri, 16 Mar 2012 13:46:51 +0000 (14:46 +0100)] 
[myri10ge] Fix compilation error in myri10ge_command() with gcc 4.7

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Use real prototypes for AXTLS' AES_encrypt() and AES_decrypt()
Michael Brown [Wed, 14 Mar 2012 00:10:31 +0000 (00:10 +0000)] 
[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>
13 years ago[eepro100] Add PCI ID 8086:10fe
1d 2k [Wed, 14 Mar 2012 00:03:19 +0000 (00:03 +0000)] 
[eepro100] Add PCI ID 8086:10fe

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Add big integer self-tests
Michael Brown [Tue, 13 Mar 2012 16:44:59 +0000 (16:44 +0000)] 
[test] Add big integer self-tests

These test vectors are generated using Perl's Math::BigInt.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Add big-integer library for RSA calculations
Michael Brown [Tue, 13 Mar 2012 16:35:21 +0000 (16:35 +0000)] 
[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>
13 years ago[crypto] Add ASN.1 functions for X.509 certificate parsing
Michael Brown [Tue, 13 Mar 2012 16:30:17 +0000 (16:30 +0000)] 
[crypto] Add ASN.1 functions for X.509 certificate parsing

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[rng] Remove obsolete (and unfinished) get_random_bytes() function
Michael Brown [Tue, 13 Mar 2012 04:41:49 +0000 (04:41 +0000)] 
[rng] Remove obsolete (and unfinished) get_random_bytes() function

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[802.11] Use rbg_generate() for secure random numbers
Michael Brown [Tue, 13 Mar 2012 04:40:19 +0000 (04:40 +0000)] 
[802.11] Use rbg_generate() for secure random numbers

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[forcedeth] Use standard random() function
Michael Brown [Tue, 13 Mar 2012 04:37:48 +0000 (04:37 +0000)] 
[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>
13 years ago[tls] Use const to mark incoming data being processed
Michael Brown [Sat, 10 Mar 2012 00:25:03 +0000 (00:25 +0000)] 
[tls] Use const to mark incoming data being processed

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Upgrade AES and RSA code to upstream axTLS version 1.4.5
Michael Brown [Fri, 9 Mar 2012 15:45:56 +0000 (15:45 +0000)] 
[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>
13 years ago[ath9k] Fix compilation on older gcc versions
Michael Brown [Fri, 9 Mar 2012 17:08:53 +0000 (17:08 +0000)] 
[ath9k] Fix compilation on older gcc versions

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[prefix] Eliminate uninitialised variable
Michael Brown [Fri, 9 Mar 2012 17:07:53 +0000 (17:07 +0000)] 
[prefix] Eliminate uninitialised variable

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Avoid using "static const" for test declarations
Michael Brown [Wed, 7 Mar 2012 00:33:19 +0000 (00:33 +0000)] 
[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>
13 years ago[debug] Ensure debug address and colourisation fields are fully initialised
Michael Brown [Tue, 6 Mar 2012 22:02:15 +0000 (22:02 +0000)] 
[debug] Ensure debug address and colourisation fields are fully initialised

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Add NIST self-tests for AES128 and AES256 in CBC mode
Michael Brown [Tue, 6 Mar 2012 21:01:30 +0000 (21:01 +0000)] 
[test] Add NIST self-tests for AES128 and AES256 in CBC mode

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[rng] Choose HMAC_DRBG using SHA-256 as the DRBG algorithm
Michael Brown [Tue, 6 Mar 2012 13:42:06 +0000 (13:42 +0000)] 
[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>
13 years ago[rng] Add NIST self-tests for HMAC_DRBG using SHA-256
Michael Brown [Tue, 6 Mar 2012 13:34:22 +0000 (13:34 +0000)] 
[rng] Add NIST self-tests for HMAC_DRBG using SHA-256

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[rng] Allow HMAC_DRBG to use multiple underlying hash algorithms
Michael Brown [Tue, 6 Mar 2012 12:58:56 +0000 (12:58 +0000)] 
[rng] Allow HMAC_DRBG to use multiple underlying hash algorithms

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[rng] Use SHA-256 for Hash_df, and validate the hash function strength
Michael Brown [Mon, 5 Mar 2012 16:21:49 +0000 (16:21 +0000)] 
[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>
13 years ago[rng] Add NIST self-tests for Hash_df using SHA-256
Michael Brown [Mon, 5 Mar 2012 23:51:35 +0000 (23:51 +0000)] 
[rng] Add NIST self-tests for Hash_df using SHA-256

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[rng] Allow hash_df() to accept multiple underlying hash algorithms
Michael Brown [Mon, 5 Mar 2012 16:13:07 +0000 (16:13 +0000)] 
[rng] Allow hash_df() to accept multiple underlying hash algorithms

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[tls] Formalise the definition of a TLS cipher suite
Michael Brown [Mon, 5 Mar 2012 23:12:47 +0000 (23:12 +0000)] 
[tls] Formalise the definition of a TLS cipher suite

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[tls] Support (and prefer) SHA-256 variants of existing cipher suites
Michael Brown [Mon, 5 Mar 2012 15:36:38 +0000 (15:36 +0000)] 
[tls] Support (and prefer) SHA-256 variants of existing cipher suites

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[tls] Support TLS version 1.2
Michael Brown [Mon, 5 Mar 2012 15:28:39 +0000 (15:28 +0000)] 
[tls] Support TLS version 1.2

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Replace MD5 implementation
Michael Brown [Mon, 5 Mar 2012 10:19:40 +0000 (10:19 +0000)] 
[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>
13 years ago[802.11] Avoid using struct md5_ctx directly
Michael Brown [Mon, 5 Mar 2012 10:18:16 +0000 (10:18 +0000)] 
[802.11] Avoid using struct md5_ctx directly

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Add self-tests for MD5 algorithm
Michael Brown [Mon, 5 Mar 2012 00:31:07 +0000 (00:31 +0000)] 
[test] Add self-tests for MD5 algorithm

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Add self-tests for SHA-256 algorithm
Michael Brown [Mon, 5 Mar 2012 00:20:30 +0000 (00:20 +0000)] 
[test] Add self-tests for SHA-256 algorithm

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Add SHA-256 algorithm
Michael Brown [Mon, 5 Mar 2012 00:18:49 +0000 (00:18 +0000)] 
[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>
13 years ago[x86_64] Use memory address constraint in __bswap_16s()
Michael Brown [Sun, 4 Mar 2012 21:46:45 +0000 (21:46 +0000)] 
[x86_64] Use memory address constraint in __bswap_16s()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[i386] Use memory address constraints in __bswap_16s() and __bswap_64s()
Michael Brown [Sun, 4 Mar 2012 21:41:24 +0000 (21:41 +0000)] 
[i386] Use memory address constraints in __bswap_16s() and __bswap_64s()

Minimise code size by forcing the use of memory addresses for
__bswap_16s() and __bswap_64s().  (__bswap_32s() cannot avoid loading the
value into a register.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[i386] Fix building on older versions of gcc
Michael Brown [Sun, 4 Mar 2012 21:09:40 +0000 (21:09 +0000)] 
[i386] Fix building on older versions of gcc

Fix a strict-aliasing error on certain versions of gcc.

Reported-by: Marko Myllynen <myllynen@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[crypto] Replace SHA-1 implementation
Michael Brown [Sun, 4 Mar 2012 15:13:54 +0000 (15:13 +0000)] 
[crypto] Replace SHA-1 implementation

Replace SHA-1 implementation from AXTLS with a dedicated iPXE
implementation which is around 40% smaller.  This implementation has
been verified using the existing SHA-1 self-tests (including the NIST
SHA-1 test vectors).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[802.11] Eliminate use of AXTLS-specific SHA1_SIZE constant
Michael Brown [Sun, 4 Mar 2012 15:00:29 +0000 (15:00 +0000)] 
[802.11] Eliminate use of AXTLS-specific SHA1_SIZE constant

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[test] Add self-tests for byte-order swapping functions
Michael Brown [Sun, 4 Mar 2012 15:12:38 +0000 (15:12 +0000)] 
[test] Add self-tests for byte-order swapping functions

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[x86_64] Provide __bswap_{16,32,64}s()
Michael Brown [Sun, 4 Mar 2012 15:28:44 +0000 (15:28 +0000)] 
[x86_64] Provide __bswap_{16,32,64}s()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[i386] Optimise byte-swapping functions and provide __bswap_{16,32,64}s()
Michael Brown [Sun, 4 Mar 2012 15:06:45 +0000 (15:06 +0000)] 
[i386] Optimise byte-swapping functions and provide __bswap_{16,32,64}s()

Use the "bswap" instruction to shrink the size of byte-swapping code,
and provide the in-place variants __bswap_{16,32,64}s.

"bswap" is available only on 486 and later processors.  (We already
assume the presence of "cpuid" and "rdtsc", which are available only
on Pentium and later processors.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 years ago[tls] Add missing #include <stdlib.h>
Michael Brown [Sun, 4 Mar 2012 15:01:13 +0000 (15:01 +0000)] 
[tls] Add missing #include <stdlib.h>

Signed-off-by: Michael Brown <mcb30@ipxe.org>