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

3982 Commits

Author SHA1 Message Date
Michael Brown e7d4d69031 [console] Add "no_latin1" keymap
The "no" keymap is for a Dvorak keyboard.

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 21:08:22 +01:00
Michael Brown 4740703d9d [console] Ignore unexpected keysyms when generating keyboard maps
I am unable to find any definitive documentation on how Linux keyboard
symbols work.  In the absence of any documentation, I'm going to
assume that unexpected keysyms are harmless and should be ignored.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 20:59:47 +01:00
Michael Brown ed64732b73 [crypto] Add an explicit "RSA signature incorrect" error message
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 14:58:45 +01:00
Michael Brown d45392a67f [console] Add LOG_ALL as a synonym for LOG_DEBUG
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 11:14:36 +01:00
Michael Brown 730c972124 [image] Log image executions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 11:11:28 +01:00
Michael Brown 82ecaaac91 [console] Remove "log message" usage from interactive console defaults
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 00:51:50 +01:00
Michael Brown cef3beaba4 [downloader] Use a more meaningful error message when out of memory
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 00:43:07 +01:00
Michael Brown 9445cb9f8b [downloader] Abort download immediately if buffer resizing fails
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 00:38:19 +01:00
Michael Brown 2834f9f6de [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>
2012-03-27 00:31:01 +01:00
Michael Brown 920799a0ba [umalloc] Fail allocations when we run out of external memory
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 00:30:54 +01:00
Michael Brown 0f0a94f2fa [crypto] Disambiguate all CMS errors
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-26 23:34:49 +01:00
Michael Brown 2d11a46b71 [image] Log results of image signature checks
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-26 23:24:27 +01:00
Michael Brown 5a91f5646a [downloader] Log final status of all downloads
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-26 22:47:50 +01:00
Michael Brown 3ff7927d2f [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>
2012-03-26 21:58:58 +01:00
Michael Brown c2875ae329 [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>
2012-03-26 21:58:50 +01:00
Michael Brown 24b7296319 [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>
2012-03-26 19:58:14 +01:00
Michael Brown 64d17dbd50 [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>
2012-03-26 19:02:30 +01:00
Michael Brown e024cd39a8 [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>
2012-03-26 17:40:01 +01:00
Michael Brown b35d454422 [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>
2012-03-26 15:47:34 +01:00
Michael Brown a6d49c17c9 [console] Move putchar() and getchar() declarations to stdio.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-26 14:43:52 +01:00
Michael Brown d1465f7b0b [image] Add the "imgtrust" and "imgverify" commands
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-25 00:11:43 +00:00
Michael Brown 1c127a6962 [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>
2012-03-24 23:12:04 +00:00
Michael Brown 4766b1455f [build] Fix compilation under Cygwin
Originally-fixed-by: Steve Goodrich <steve.goodrich@se-eng.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 23:52:24 +00:00
Michael Brown 97dcc824bf [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>
2012-03-22 16:16:02 +00:00
Michael Brown efb0c7fce4 [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>
2012-03-22 12:30:47 +00:00
Michael Brown 7ace2ebe94 [test] Add CMS self-tests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 11:41:29 +00:00
Michael Brown bdb69d587e [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>
2012-03-22 11:41:23 +00:00
Michael Brown fe6e741c62 [crypto] Parse X.509 extended key usage extension
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 11:41:22 +00:00
Michael Brown f2af64aba5 [crypto] Differentiate "untrusted root" and "incomplete chain" error cases
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 11:41:22 +00:00
Michael Brown 5c66395939 [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>
2012-03-22 11:41:21 +00:00
Michael Brown 2cd24473b8 [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>
2012-03-22 02:28:49 +00:00
Michael Brown 2d9d0adc4e [crypto] Add previous certificate in chain as a parameter to parse_next()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 01:34:40 +00:00
Michael Brown c285378388 [crypto] Parse X.509 certificate serial number
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 00:31:22 +00:00
Michael Brown d56499ab18 [crypto] Define ASN.1 OID-identified algorithms for all supported digests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 00:31:22 +00:00
Michael Brown 38b7e43f7d [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>
2012-03-22 00:31:22 +00:00
Michael Brown 9a03a8e3d2 [test] Add X.509 self-tests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-22 00:31:17 +00:00
Michael Brown b1316ef276 [crypto] Validate path length constraint in certificate chain
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-21 19:19:28 +00:00
Michael Brown 94cdbd76d6 [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>
2012-03-21 16:28:24 +00:00
Michael Brown 225be9d598 [crypto] Move all ASN.1 OIDs to asn1.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-21 16:27:12 +00:00
Michael Brown c76afb3605 [crypto] Use standard bit-rotation functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-21 16:27:12 +00:00
Michael Brown cf78afa5c5 [tls] Support sending a client certificate
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-20 20:42:51 +00:00
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