| 1 |
// Copyright (c) 2018, Google Inc. |
| 2 |
// SPDX-License-Identifier: ISC |
| 3 |
|
| 4 |
#ifndef OPENSSL_HEADER_MD5_INTERNAL_H |
| 5 |
#define OPENSSL_HEADER_MD5_INTERNAL_H |
| 6 |
|
| 7 |
#include <openssl/base.h> |
| 8 |
|
| 9 |
#if defined(__cplusplus) |
| 10 |
extern "C" { |
| 11 |
#endif |
| 12 |
|
| 13 |
// MD5_CHAINING_LENGTH is the chaining length in bytes of MD5 |
| 14 |
// It corresponds to the length in bytes of the h part of the state |
| 15 |
#define MD5_CHAINING_LENGTH 16 |
| 16 |
|
| 17 |
// MD5_Init_from_state is a low-level function that initializes |sha| with a |
| 18 |
// custom state. |h| is the hash state in big endian. |n| is the number of bits |
| 19 |
// processed at this point. It must be a multiple of |MD5_CBLOCK*8|. |
| 20 |
// It returns one on success and zero on error. |
| 21 |
// This function is for internal use only and should never be directly called. |
| 22 |
OPENSSL_EXPORT int MD5_Init_from_state(MD5_CTX *sha, |
| 23 |
const uint8_t h[MD5_CHAINING_LENGTH], |
| 24 |
uint64_t n); |
| 25 |
|
| 26 |
// MD5_get_state is a low-level function that exports the hash state in big |
| 27 |
// endian into |out_n| and the number of bits processed at this point in |
| 28 |
// |out_n|. |MD5_Final| must not have been called before (otherwise results |
| 29 |
// are not guaranteed). Furthermore, the number of bytes processed by |
| 30 |
// |MD5_Update| must be a multiple of the block length |MD5_CBLOCK| |
| 31 |
// (otherwise it fails). It returns one on success and zero on error. |
| 32 |
// This function is for internal use only and should never be directly called. |
| 33 |
OPENSSL_EXPORT int MD5_get_state(MD5_CTX *ctx, |
| 34 |
uint8_t out_h[MD5_CHAINING_LENGTH], |
| 35 |
uint64_t *out_n); |
| 36 |
|
| 37 |
#if !defined(OPENSSL_NO_ASM) && \ |
| 38 |
(defined(OPENSSL_X86_64) || defined(OPENSSL_X86) || defined(OPENSSL_AARCH64)) |
| 39 |
#define MD5_ASM |
| 40 |
extern void md5_block_asm_data_order(uint32_t *state, const uint8_t *data, |
| 41 |
size_t num); |
| 42 |
#endif |
| 43 |
|
| 44 |
|
| 45 |
#if defined(__cplusplus) |
| 46 |
} // extern "C" |
| 47 |
#endif |
| 48 |
|
| 49 |
#endif // OPENSSL_HEADER_MD5_INTERNAL_H |