tests: EAP-AKA using external USIM processing for UMTS auth

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: FT negative test with mismatching R0KH-ID

Signed-off-by: Jouni Malinen <j@w1.fi>
TNC: Allow tnc_config file path to be replaced

This is for enabling easier testing of TNCS/TNCC functionality as part
of the test scripts without having to use the fixed /etc/tnc_config
location that could be used by the main system and would require changes
within /etc.

Signed-off-by: Jouni Malinen <j@w1.fi>
TNC: Move common definitions into a shared header file

No need to duplicate these in multiple places.

Signed-off-by: Jouni Malinen <j@w1.fi>
TNC: Allow TNC to be enabled dynamically

Previously, hostapd had to be started with at least one of the
configuration files enabling TNC for TNC to be usable. Change this to
allow TNC to be enabled when the first interface with TNC enabled gets
added during runtime.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: TNC testing

This implements minimal IMC and IMV to allow TNC testing with PEAP (SoH)
and TTLS/FAST with EAP-TNC.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: Incorrect/missing password with TTLS non-EAP methods

Incorrect password was already tested with TTLS/MSCHAPv2, but the other
non-EAP inner methods in TTLS use their own implementation of password
validation, so check each and also verify the case of no matching EAP
user entry for the specific method.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: EAP-TTLS/EAP-AKA, EAP-PEAP/EAP-AKA, EAP-FAST/EAP-AKA

These add some more EAP-TTLS/PEAP/FAST coverage to test pending Phase 2
response re-processing.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: EAP-AKA' and EAP-AKA both enabled (bidding mechanism)

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: EAP-FAST using PAC file

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: EAP-PEAP crypto_binding=0/1

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: EAP-PEAP parameters

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: Add CAVP test vectors for byte-oriented SHA-1 and SHA-256

This allows the SHA-1 implementation to be validated against the
SHA1ShortMsg.rsp and SHA1LongMsg.rsp test vectors from
http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip.
Similarly, the SHA-256 can be validated against the SHA256ShortMsg.rsp
and SHA256LongMsg.rsp.

Signed-off-by: Jouni Malinen <j@w1.fi>
X.509: Fix internal TLS/X.509 validation of PKCS#1 signature

Verify that there is no extra data after the hash field. This is needed
to avoid potential attacks using additional data to construct a value
that passes the RSA operation and allows the hash value to be forged.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
PKCS #1: Allow only BT=01 for signature in internal TLS

Based on PKCS #1, v1.5, 10.1.3, the block type shall be 01 for a
signature. This avoids a potential attack vector for internal TLS/X.509
implementation.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
PKCS #1: Enforce minimum padding for decryption in internal TLS

Follow the PKCS #1 v1.5, 8.1 constraint of at least eight octets long PS
for the case where the internal TLS implementation decrypts PKCS #1
formatted data. Similar limit was already in place for signature
validation, but not for this decryption routine.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Add function for building RSA public key from n and e parameters

This is similar to the existing functionality that parsed ASN.1-encoded
RSA public key by generating a similar public key instance from already
parsed n and e parameters.

Signed-off-by: Jouni Malinen <j@w1.fi>
RSA: Add OID definitions and helper function for hash algorithms

Signed-off-by: Jouni Malinen <j@w1.fi>
PKCS 1: Add function for checking v1.5 RSA signature

This could be used as a step towards replacing more specific functions
used in X.509 and TLS processing.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: Add CAVP test vectors for RSA/PKCS #1 v1.5 signature validation

This allow the PKCS #1 and RSA implementation to be validated against
the test vectors from
http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-2rsatestvectors.zip
and
http://csrc.nist.gov/groups/STM/cavp/documents/dss/SigVer15EMTest.txt.

Signed-off-by: Jouni Malinen <j@w1.fi>