summaryrefslogtreecommitdiffstats
path: root/src/tests
Commit message (Collapse)AuthorAgeFilesLines
* [profile] Add generic profiling infrastructureMichael Brown2014-04-286-29/+204
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add flsll()Michael Brown2014-04-271-0/+37
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add isqrt() function to find integer square rootsMichael Brown2014-04-261-0/+11
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Check for correct -mrtd assumption on libgcc arithmetic functionsMichael Brown2014-04-261-4/+74
| | | | | | | | | | | | | | | | | | | | | | | | As observed in commit 082cedb ("[build] Fix __libgcc attribute for recent gcc versions"), recent versions of gcc have changed the semantics of -mrtd as applied to the implicit arithmetic functions. It is possible for tests to succeed even if our assumptions about gcc's interpretation of -mrtd are incorrect. In particular, if gcc chooses to utilise a frame pointer in the calling function, then it can tolerate a temporarily incorrect stack pointer (since the stack pointer will shortly afterwards be restored from the frame pointer anyway). Add tests designed specifically to check that our implementations of the implicit arithmetic functions manipulate the stack pointer as expected by gcc. The effect of these tests can be observed by temporarily reverting commit 082cedb ("[build] Fix __libgcc attribute for recent gcc versions"): without this fix in place, the tests will fail on gcc 4.7 and later. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add tests for 64-bit divisionMichael Brown2014-04-251-0/+122
| | | | | | | | | | On a 32-bit system, 64-bit division is implemented using the libgcc functions provided in __udivmoddi4.c etc. Calls to these functions are generated automatically by gcc, with a calling convention that is somewhat empirical in nature. Add these self-tests primarily as a check that we are using the correct calling convention. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for flsl()Michael Brown2014-04-242-0/+87
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Rewrite TCP/IP tests using okx()Michael Brown2014-04-241-38/+53
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Add support for subjectAltName and wildcard certificatesMichael Brown2014-03-311-0/+9
| | | | | Originally-implemented-by: Alex Chernyakhovsky <achernya@google.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add subject alternative names to X.509 server test certificateMichael Brown2014-03-311-69/+75
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add tests for x509_check_name()Michael Brown2014-03-311-0/+38
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Rewrite CMS tests using okx()Michael Brown2014-03-311-14/+40
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Rewrite X.509 tests using okx()Michael Brown2014-03-311-61/+145
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Generalise X.509 cache to a full certificate storeMichael Brown2014-03-282-37/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expand the concept of the X.509 cache to provide the functionality of a certificate store. Certificates in the store will be automatically used to complete certificate chains where applicable. The certificate store may be prepopulated at build time using the CERT=... build command line option. For example: make bin/ipxe.usb CERT=mycert1.crt,mycert2.crt Certificates within the certificate store are not implicitly trusted; the trust list is specified using TRUST=... as before. For example: make bin/ipxe.usb CERT=root.crt TRUST=root.crt This can be used to embed the full trusted root certificate within the iPXE binary, which is potentially useful in an HTTPS-only environment in which there is no HTTP server from which to automatically download cross-signed certificates or other certificate chain fragments. This usage of CERT= extends the existing use of CERT= to specify the client certificate. The client certificate is now identified automatically by checking for a match against the private key. For example: make bin/ipxe.usb CERT=root.crt,client.crt TRUST=root.crt KEY=client.key Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Refactor URI parsing and formattingMichael Brown2014-02-272-120/+833
| | | | | | | | | | | | | | | | | | | | | | | | Add support for parsing of URIs containing literal IPv6 addresses (e.g. "http://[fe80::69ff:fe50:5845%25net0]/boot.ipxe"). Duplicate URIs by directly copying the relevant fields, rather than by formatting and reparsing a URI string. This relaxes the requirements on the URI formatting code and allows it to focus on generating human-readable URIs (e.g. by not escaping ':' characters within literal IPv6 addresses). As a side-effect, this allows relative URIs containing parameter lists (e.g. "../boot.php##params") to function as expected. Add validity check for FTP paths to ensure that only printable characters are accepted (since FTP is a human-readable line-based protocol with no support for character escaping). Construct TFTP next-server+filename URIs directly, rather than parsing a constructed "tftp://..." string, Add self-tests for URI functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Remove "uristring" setting typeMichael Brown2014-02-271-13/+0Star
| | | | | | | | | | | | | | Commit b5f5f73 ("[cmdline] Expand settings within each command-line token individually") effectively rendered the "uristring" setting type obsolete, since strings containing whitespace no longer break the command line parser. The concept of the "uristring" type is not well defined, since URI escaping rules depend on which portion of a URI is being escaped. Remove the "uristring" type, converting it into an alias for the "string" setting type so as to avoid breaking existing scripts. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dns] Support DNS search listsMichael Brown2014-02-052-0/+606
| | | | | | | | | | | Update the DNS resolver to support DNS search lists (as provided by DHCP option 119, DHCPv6 option 24, or NDP option 31). Add validation code to ensure that parsing of DNS packets does not overrun the input, get stuck in infinite loops, or (worse) write beyond the end of allocated buffers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [png] Add support for PNG imagesMichael Brown2014-01-122-0/+1994
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Generalise pnm_ok() to pixbuf_ok()Michael Brown2014-01-123-88/+157
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Rewrite pnm_ok() using okx()Michael Brown2014-01-121-29/+36
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [deflate] Fix literal data length calculationMichael Brown2014-01-121-0/+7
| | | | | | | | Fix incorrect calculation used to determine length of data to be copied within a literal data block, and add a test case to prevent this bug from going undetected in future. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [deflate] Add support for DEFLATE decompressionMichael Brown2014-01-062-0/+240
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Explicitly separate the concept of a completed fetched settingMichael Brown2013-12-051-53/+54
| | | | | | | | | | The fetch_setting() family of functions may currently modify the definition of the specified setting (e.g. to add missing type information). Clean up this interface by requiring callers to provide an explicit buffer to contain the completed definition of the fetched setting, if required. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pnm] Add support for PNM imagesMichael Brown2013-11-272-0/+297
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Include failing code within failed test result outputMichael Brown2013-11-271-3/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv6] Add "ipv6" setting typeMichael Brown2013-11-141-0/+16
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv6] Add inet6_aton()Michael Brown2013-09-111-0/+66
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ipv6] Replace IPv6 stackMichael Brown2013-09-032-0/+116
| | | | | | | | | | | | | | | | Replace the existing partially-implemented IPv6 stack with a fresh implementation. This implementation is not yet complete. The IPv6 transmit and receive datapaths are functional (including fragment reassembly and parsing of arbitrary extension headers). NDP neighbour solicitations and advertisements are supported. ICMPv6 echo is supported. At present, only link-local addresses may be used, and there is no way to specify an IPv6 address as part of a URI (either directly or via a DNS lookup). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Allow numeric_setting_value() to handle long setting valuesMichael Brown2013-08-121-0/+6
| | | | | | | | | | | Allow numeric_setting_value() to handle e.g. the byte sequence 00:00:00:00:12:34:56:78 by returning -ERANGE only if the value actually overflows the return type. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for snprintf()Michael Brown2013-08-122-0/+103
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Introduce the generalised concept of a numeric settingMichael Brown2013-08-011-2/+89
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add "busdevfn" setting typeMichael Brown2013-07-121-0/+10
| | | | | | | Allow network device's "busloc" setting to be formatted as a PCI bus:dev.fn address using e.g. ${net0/busloc:busdevfn}. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add "hexraw" setting typeMichael Brown2013-07-121-0/+14
| | | | | Originally-implemented-by: Jeppe Toustrup <ipxe@tenzer.dk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Use hex_decode() to parse hex settingsMichael Brown2013-07-121-7/+9
| | | | | | | | | | Use hex_decode() to parse "hex" and "hexhyp" settings. Note that this parser is stricter than the old parser; it now requires exactly two hex digits for each byte. (The old parser was based upon strtoul() and so would allow leading whitespace and a leading plus or minus sign.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for base16Michael Brown2013-07-122-0/+122
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for string functionsMichael Brown2012-11-122-0/+134
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Remove self-test for empty formatted setting valueMichael Brown2012-10-201-2/+0Star
| | | | | | | | | | | Commit 5ad445f ("[settings] Treat an empty formatted value as meaning "delete setting"") (re)defined the semantics of storing an empty formatted setting as meaning "delete setting". Remove the existing self-test using an empty formatted hex setting value, since it no longer conforms to the defined semantics. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add speed tests for cipher algorithmsMichael Brown2012-09-263-4/+94
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add speed tests for digest algorithmsMichael Brown2012-09-265-0/+54
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Update FSF mailing address in GPL licence textsMichael Brown2012-07-2020-20/+40
| | | | | Suggested-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for TCP/IP checksum calculationMichael Brown2012-06-272-0/+214
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add memcpy() self-testsMichael Brown2012-06-272-34/+257
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Construct OCSP check URIMichael Brown2012-05-221-83/+8Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for base64Michael Brown2012-05-202-0/+125
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for OCSPMichael Brown2012-05-152-0/+1526
| | | | | | | Add self-tests for OCSP using test vectors generated with the openssl tools. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [list] Add list_last_entry()Michael Brown2012-05-081-1/+13
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Add self-tests for crc32_le()Michael Brown2012-05-072-0/+117
| | | | | | | Add self-tests for crc32_le() using test vectors generated with Perl's Digest::CRC. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Fix compiler warning on older gcc versionsMichael Brown2012-05-041-2/+2
| | | | | Reported-by: Alex Davies <alex@davz.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Allow certificate chains to be long-lived data structuresMichael Brown2012-05-042-127/+159
| | | | | | | | | | | | | | | | | At present, certificate chain validation is treated as an instantaneous process that can be carried out using only data that is already in memory. This model does not allow for validation to include non-instantaneous steps, such as downloading a cross-signing certificate, or determining certificate revocation status via OCSP. Redesign the internal representation of certificate chains to allow chains to outlive the scope of the original source of certificates (such as a TLS Certificate record). Allow for certificates to be cached, so that each certificate needs to be validated only once. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [list] Add list_for_each_entry_continue() and _continue_reverse()Michael Brown2012-05-041-14/+77
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Fix memory leak in settings self-testsMichael Brown2012-05-041-1/+2
| | | | | | Detected using Valgrind. Signed-off-by: Michael Brown <mcb30@ipxe.org>