1 // Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef OPENSSL_HEADER_MD4_H 16 #define OPENSSL_HEADER_MD4_H 17 18 #include <openssl/base.h> // IWYU pragma: export 19 20 #if defined(__cplusplus) 21 extern "C" { 22 #endif 23 24 25 // MD4. 26 27 // MD4_CBLOCK is the block size of MD4. 28 #define MD4_CBLOCK 64 29 30 // MD4_DIGEST_LENGTH is the length of an MD4 digest. 31 #define MD4_DIGEST_LENGTH 16 32 33 // MD4_Init initialises |md4| and returns one. 34 OPENSSL_EXPORT int MD4_Init(MD4_CTX *md4); 35 36 // MD4_Update adds |len| bytes from |data| to |md4| and returns one. 37 OPENSSL_EXPORT int MD4_Update(MD4_CTX *md4, const void *data, size_t len); 38 39 // MD4_Final adds the final padding to |md4| and writes the resulting digest to 40 // |out|, which must have at least |MD4_DIGEST_LENGTH| bytes of space. It 41 // returns one. 42 OPENSSL_EXPORT int MD4_Final(uint8_t out[MD4_DIGEST_LENGTH], MD4_CTX *md4); 43 44 // MD4 writes the digest of |len| bytes from |data| to |out| and returns |out|. 45 // There must be at least |MD4_DIGEST_LENGTH| bytes of space in |out|. 46 OPENSSL_EXPORT uint8_t *MD4(const uint8_t *data, size_t len, 47 uint8_t out[MD4_DIGEST_LENGTH]); 48 49 // MD4_Transform is a low-level function that performs a single, MD4 block 50 // transformation using the state from |md4| and 64 bytes from |block|. 51 OPENSSL_EXPORT void MD4_Transform(MD4_CTX *md4, 52 const uint8_t block[MD4_CBLOCK]); 53 54 struct md4_state_st { 55 uint32_t h[4]; 56 uint32_t Nl, Nh; 57 uint8_t data[MD4_CBLOCK]; 58 unsigned num; 59 }; 60 61 62 #if defined(__cplusplus) 63 } // extern C 64 #endif 65 66 #endif // OPENSSL_HEADER_MD4_H 67