iPXE
Functions | Variables
md4_test.c File Reference

MD4 tests. More...

#include <ipxe/md4.h>
#include <ipxe/test.h>
#include "digest_test.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
 DIGEST_TEST (md4_empty, &md4_algorithm, DIGEST_EMPTY, DIGEST(0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0))
 
 DIGEST_TEST (md4_nist_abc, &md4_algorithm, DIGEST_NIST_ABC, DIGEST(0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d))
 
 DIGEST_TEST (md4_nist_abc_opq, &md4_algorithm, DIGEST_NIST_ABC_OPQ, DIGEST(0x46, 0x91, 0xa9, 0xec, 0x81, 0xb1, 0xa6, 0xbd, 0x1a, 0xb8, 0x55, 0x72, 0x40, 0xb2, 0x45, 0xc5))
 
static void md4_test_exec (void)
 Perform MD4 self-test. More...
 

Variables

struct self_test md4_test __self_test
 MD4 self-test. More...
 

Detailed Description

MD4 tests.

Test inputs borrowed from NIST SHA-1 tests, with results calculated using "openssl dgst -md4"

Definition in file md4_test.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ DIGEST_TEST() [1/3]

DIGEST_TEST ( md4_empty  ,
md4_algorithm,
DIGEST_EMPTY  ,
DIGEST(0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0)   
)

◆ DIGEST_TEST() [2/3]

DIGEST_TEST ( md4_nist_abc  ,
md4_algorithm,
DIGEST_NIST_ABC  ,
DIGEST(0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52, 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d)   
)

◆ DIGEST_TEST() [3/3]

DIGEST_TEST ( md4_nist_abc_opq  ,
md4_algorithm,
DIGEST_NIST_ABC_OPQ  ,
DIGEST(0x46, 0x91, 0xa9, 0xec, 0x81, 0xb1, 0xa6, 0xbd, 0x1a, 0xb8, 0x55, 0x72, 0x40, 0xb2, 0x45, 0xc5)   
)

◆ md4_test_exec()

static void md4_test_exec ( void  )
static

Perform MD4 self-test.

Definition at line 60 of file md4_test.c.

60  {
61 
62  /* Correctness tests */
63  digest_ok ( &md4_empty );
64  digest_ok ( &md4_nist_abc );
65  digest_ok ( &md4_nist_abc_opq );
66 
67  /* Speed tests */
68  DBG ( "MD4 required %ld cycles per byte\n",
70 }
unsigned long digest_cost(struct digest_algorithm *digest)
Calculate digest algorithm cost.
Definition: digest_test.c:131
#define digest_ok(test)
Report a digest test result.
Definition: digest_test.h:109
struct digest_algorithm md4_algorithm
MD4 algorithm.
Definition: md4.c:261
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498

References DBG, digest_cost(), digest_ok, and md4_algorithm.

Variable Documentation

◆ __self_test

struct self_test md4_test __self_test
Initial value:
= {
.name = "md4",
.exec = md4_test_exec,
}
static void md4_test_exec(void)
Perform MD4 self-test.
Definition: md4_test.c:60

MD4 self-test.

Definition at line 73 of file md4_test.c.