You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

md4.h 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef _IPXE_MD4_H
  2. #define _IPXE_MD4_H
  3. /** @file
  4. *
  5. * MD4 algorithm
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stdint.h>
  10. #include <ipxe/crypto.h>
  11. /** An MD4 digest */
  12. struct md4_digest {
  13. /** Hash output */
  14. uint32_t h[4];
  15. };
  16. /** An MD4 data block */
  17. union md4_block {
  18. /** Raw bytes */
  19. uint8_t byte[64];
  20. /** Raw dwords */
  21. uint32_t dword[16];
  22. /** Final block structure */
  23. struct {
  24. /** Padding */
  25. uint8_t pad[56];
  26. /** Length in bits */
  27. uint64_t len;
  28. } final;
  29. };
  30. /** MD4 digest and data block
  31. *
  32. * The order of fields within this structure is designed to minimise
  33. * code size.
  34. */
  35. struct md4_digest_data {
  36. /** Digest of data already processed */
  37. struct md4_digest digest;
  38. /** Accumulated data */
  39. union md4_block data;
  40. } __attribute__ (( packed ));
  41. /** MD4 digest and data block */
  42. union md4_digest_data_dwords {
  43. /** Digest and data block */
  44. struct md4_digest_data dd;
  45. /** Raw dwords */
  46. uint32_t dword[ sizeof ( struct md4_digest_data ) /
  47. sizeof ( uint32_t ) ];
  48. };
  49. /** An MD4 context */
  50. struct md4_context {
  51. /** Amount of accumulated data */
  52. size_t len;
  53. /** Digest and accumulated data */
  54. union md4_digest_data_dwords ddd;
  55. } __attribute__ (( packed ));
  56. /** MD4 context size */
  57. #define MD4_CTX_SIZE sizeof ( struct md4_context )
  58. /** MD4 digest size */
  59. #define MD4_DIGEST_SIZE sizeof ( struct md4_digest )
  60. extern struct digest_algorithm md4_algorithm;
  61. #endif /* _IPXE_MD4_H */