|
iPXE
|
NTLM authentication self-tests. More...
#include <stdlib.h>#include <string.h>#include <byteswap.h>#include <ipxe/ntlm.h>#include <ipxe/test.h>Go to the source code of this file.
Data Structures | |
| struct | ntlm_key_test |
| A key generation test. More... | |
| struct | ntlm_authenticate_test |
| An authentication test. More... | |
Macros | |
| #define | DATA(...) { __VA_ARGS__ } |
| Define inline message data. More... | |
| #define | KEY_TEST(name, DOMAIN, USERNAME, PASSWORD, EXPECTED) |
| Define a key generation digest test. More... | |
| #define | AUTHENTICATE_TEST(name, DOMAIN, USERNAME, PASSWORD, WORKSTATION, NONCE, CHALLENGE, EXPECTED) |
| Define an authentication test. More... | |
| #define | ntlm_key_ok(test) ntlm_key_okx ( test, __FILE__, __LINE__ ) |
| #define | ntlm_data_ok(msg, msg_len, data, expected, expected_data) |
| #define | ntlm_authenticate_ok(test) ntlm_authenticate_okx ( test, __FILE__, __LINE__ ) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| KEY_TEST (msnlmp_ntowfv2, "Domain", "User", "Password", DATA(0x0c, 0x86, 0x8a, 0x40, 0x3b, 0xfd, 0x7a, 0x93, 0xa3, 0x00, 0x1e, 0xf2, 0x2e, 0xf0, 0x2e, 0x3f)) | |
| NTOWFv2() test from MS-NLMP specification. More... | |
| AUTHENTICATE_TEST (msnlmp_authenticate, "Domain", "User", "Password", "COMPUTER", DATA(0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa), DATA(0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x38, 0x00, 0x00, 0x00, 0x33, 0x82, 0x8a, 0xe2, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x24, 0x00, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x70, 0x17, 0x00, 0x00, 0x00, 0x0f, 0x53, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x44, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x01, 0x00, 0x0c, 0x00, 0x53, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00), DATA(0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x54, 0x00, 0x54, 0x00, 0x84, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x48, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x54, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x35, 0x82, 0x88, 0xe2, 0x05, 0x01, 0x28, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x44, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x55, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x50, 0x00, 0x55, 0x00, 0x54, 0x00, 0x45, 0x00, 0x52, 0x00, 0x86, 0xc3, 0x50, 0x97, 0xac, 0x9c, 0xec, 0x10, 0x25, 0x54, 0x76, 0x4a, 0x57, 0xcc, 0xcc, 0x19, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x68, 0xcd, 0x0a, 0xb8, 0x51, 0xe5, 0x1c, 0x96, 0xaa, 0xbc, 0x92, 0x7b, 0xeb, 0xef, 0x6a, 0x1c, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x44, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x01, 0x00, 0x0c, 0x00, 0x53, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc5, 0xda, 0xd2, 0x54, 0x4f, 0xc9, 0x79, 0x90, 0x94, 0xce, 0x1c, 0xe9, 0x0b, 0xc9, 0xd0, 0x3e)) | |
| Authentication test from MS-NLMP specification. More... | |
| static void | ntlm_key_okx (struct ntlm_key_test *test, const char *file, unsigned int line) |
| Report key generation test result. More... | |
| static void | ntlm_data_okx (struct ntlm_header *msg, size_t msg_len, struct ntlm_data *data, struct ntlm_header *expected, struct ntlm_data *expected_data, const char *field, const char *file, unsigned int line) |
| Report NTLM variable-length data test result. More... | |
| static void | ntlm_authenticate_okx (struct ntlm_authenticate_test *test, const char *file, unsigned int line) |
| Report NTLM authentication test result. More... | |
| static void | ntlm_test_exec (void) |
| Perform NTLM self-test. More... | |
Variables | |
| struct self_test ntlm_test | __self_test |
| NTLM self-test. More... | |
NTLM authentication self-tests.
The test vectors are taken from the MS-NLMP specification document.
Definition in file ntlm_test.c.
| #define DATA | ( | ... | ) | { __VA_ARGS__ } |
Define inline message data.
Definition at line 78 of file ntlm_test.c.
Define a key generation digest test.
Definition at line 81 of file ntlm_test.c.
| #define AUTHENTICATE_TEST | ( | name, | |
| DOMAIN, | |||
| USERNAME, | |||
| PASSWORD, | |||
| WORKSTATION, | |||
| NONCE, | |||
| CHALLENGE, | |||
| EXPECTED | |||
| ) |
Define an authentication test.
Definition at line 92 of file ntlm_test.c.
| #define ntlm_key_ok | ( | test | ) | ntlm_key_okx ( test, __FILE__, __LINE__ ) |
Definition at line 170 of file ntlm_test.c.
Definition at line 214 of file ntlm_test.c.
| #define ntlm_authenticate_ok | ( | test | ) | ntlm_authenticate_okx ( test, __FILE__, __LINE__ ) |
Definition at line 292 of file ntlm_test.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| KEY_TEST | ( | msnlmp_ntowfv2 | , |
| "Domain" | , | ||
| "User" | , | ||
| "Password" | , | ||
| DATA(0x0c, 0x86, 0x8a, 0x40, 0x3b, 0xfd, 0x7a, 0x93, 0xa3, 0x00, 0x1e, 0xf2, 0x2e, 0xf0, 0x2e, 0x3f) | |||
| ) |
NTOWFv2() test from MS-NLMP specification.
| AUTHENTICATE_TEST | ( | msnlmp_authenticate | , |
| "Domain" | , | ||
| "User" | , | ||
| "Password" | , | ||
| "COMPUTER" | , | ||
| DATA(0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa) | , | ||
| DATA(0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x38, 0x00, 0x00, 0x00, 0x33, 0x82, 0x8a, 0xe2, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x24, 0x00, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x70, 0x17, 0x00, 0x00, 0x00, 0x0f, 0x53, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x44, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x01, 0x00, 0x0c, 0x00, 0x53, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00) | , | ||
| DATA(0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x54, 0x00, 0x54, 0x00, 0x84, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x48, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x54, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x35, 0x82, 0x88, 0xe2, 0x05, 0x01, 0x28, 0x0a, 0x00, 0x00, 0x00, 0x0f, 0x44, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x55, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x50, 0x00, 0x55, 0x00, 0x54, 0x00, 0x45, 0x00, 0x52, 0x00, 0x86, 0xc3, 0x50, 0x97, 0xac, 0x9c, 0xec, 0x10, 0x25, 0x54, 0x76, 0x4a, 0x57, 0xcc, 0xcc, 0x19, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x68, 0xcd, 0x0a, 0xb8, 0x51, 0xe5, 0x1c, 0x96, 0xaa, 0xbc, 0x92, 0x7b, 0xeb, 0xef, 0x6a, 0x1c, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x44, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x01, 0x00, 0x0c, 0x00, 0x53, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc5, 0xda, 0xd2, 0x54, 0x4f, 0xc9, 0x79, 0x90, 0x94, 0xce, 0x1c, 0xe9, 0x0b, 0xc9, 0xd0, 0x3e) | |||
| ) |
Authentication test from MS-NLMP specification.
|
static |
Report key generation test result.
| test | Key generation test |
| file | Test code file |
| line | Test code line |
Definition at line 162 of file ntlm_test.c.
References key, memcmp(), ntlm_key(), okx, and test.
|
static |
Report NTLM variable-length data test result.
| msg | Message header |
| msg_len | Length of message |
| data | Variable-length data descriptor |
| expected | Expected message header |
| expected_data | Expected variable-length data descriptor |
| field | Field name |
| file | Test code file |
| line | Test code line |
Definition at line 185 of file ntlm_test.c.
References data, DBGC, DBGC_HDA, le16_to_cpu, le32_to_cpu, ntlm_data::len, len, memcmp(), msg(), offset, ntlm_data::offset, okx, and raw.
Referenced by ntlm_authenticate_okx().
|
static |
Report NTLM authentication test result.
| test | Authentication test |
| file | Test code file |
| line | Test code line |
Definition at line 225 of file ntlm_test.c.
References ntlm_authenticate::domain, ntlm_authenticate::flags, free, ntlm_authenticate::header, info, key, len, ntlm_authenticate::lm, malloc(), memcmp(), nt, ntlm_authenticate::nt, ntlm_authenticate_len(), ntlm_data_okx(), ntlm_key(), NTLM_NEGOTIATE_KEY_EXCH, ntlm_response(), NULL, okx, ntlm_authenticate::session, test, ntlm_authenticate::user, and ntlm_authenticate::workstation.
|
static |
Perform NTLM self-test.
Definition at line 299 of file ntlm_test.c.
References ntlm_authenticate_ok, and ntlm_key_ok.
| struct self_test ntlm_test __self_test |
NTLM self-test.
Definition at line 309 of file ntlm_test.c.
1.8.15