| 1 |
// Copyright (C) 1995-1998 Eric Young ([email protected]) All rights reserved. |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
#ifndef OPENSSL_HEADER_MD4_H |
| 5 |
#define OPENSSL_HEADER_MD4_H |
| 6 |
|
| 7 |
#include <openssl/base.h> |
| 8 |
|
| 9 |
#if defined(__cplusplus) |
| 10 |
extern "C" { |
| 11 |
#endif |
| 12 |
|
| 13 |
|
| 14 |
// MD4. |
| 15 |
|
| 16 |
// MD4_CBLOCK is the block size of MD4. |
| 17 |
#define MD4_CBLOCK 64 |
| 18 |
|
| 19 |
// MD4_DIGEST_LENGTH is the length of an MD4 digest. |
| 20 |
#define MD4_DIGEST_LENGTH 16 |
| 21 |
|
| 22 |
// MD4_Init initialises |md4| and returns one. |
| 23 |
OPENSSL_EXPORT int MD4_Init(MD4_CTX *md4); |
| 24 |
|
| 25 |
// MD4_Update adds |len| bytes from |data| to |md4| and returns one. |
| 26 |
OPENSSL_EXPORT int MD4_Update(MD4_CTX *md4, const void *data, size_t len); |
| 27 |
|
| 28 |
// MD4_Final adds the final padding to |md4| and writes the resulting digest to |
| 29 |
// |out|, which must have at least |MD4_DIGEST_LENGTH| bytes of space. It |
| 30 |
// returns one. |
| 31 |
OPENSSL_EXPORT int MD4_Final(uint8_t out[MD4_DIGEST_LENGTH], MD4_CTX *md4); |
| 32 |
|
| 33 |
// MD4 writes the digest of |len| bytes from |data| to |out| and returns |out|. |
| 34 |
// There must be at least |MD4_DIGEST_LENGTH| bytes of space in |out|. |
| 35 |
OPENSSL_EXPORT uint8_t *MD4(const uint8_t *data, size_t len, |
| 36 |
uint8_t out[MD4_DIGEST_LENGTH]); |
| 37 |
|
| 38 |
// MD4_Transform is a low-level function that performs a single, MD4 block |
| 39 |
// transformation using the state from |md4| and 64 bytes from |block|. |
| 40 |
OPENSSL_EXPORT void MD4_Transform(MD4_CTX *md4, |
| 41 |
const uint8_t block[MD4_CBLOCK]); |
| 42 |
|
| 43 |
struct md4_state_st { |
| 44 |
uint32_t h[4]; |
| 45 |
uint32_t Nl, Nh; |
| 46 |
uint8_t data[MD4_CBLOCK]; |
| 47 |
unsigned num; |
| 48 |
}; |
| 49 |
|
| 50 |
|
| 51 |
#if defined(__cplusplus) |
| 52 |
} // extern C |
| 53 |
#endif |
| 54 |
|
| 55 |
#endif // OPENSSL_HEADER_MD4_H |