• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 #ifndef OPENSSL_HEADER_MD4_H
11 #define OPENSSL_HEADER_MD4_H
12 
13 #include <openssl/base.h>
14 
15 #if defined(__cplusplus)
16 extern "C" {
17 #endif
18 
19 
20 // MD4.
21 
22 // MD4_CBLOCK is the block size of MD4.
23 #define MD4_CBLOCK 64
24 
25 // MD4_DIGEST_LENGTH is the length of an MD4 digest.
26 #define MD4_DIGEST_LENGTH 16
27 
28 // MD4_Init initialises |md4| and returns one.
29 OPENSSL_EXPORT int MD4_Init(MD4_CTX *md4);
30 
31 // MD4_Update adds |len| bytes from |data| to |md4| and returns one.
32 OPENSSL_EXPORT int MD4_Update(MD4_CTX *md4, const void *data, size_t len);
33 
34 // MD4_Final adds the final padding to |md4| and writes the resulting digest to
35 // |out|, which must have at least |MD4_DIGEST_LENGTH| bytes of space. It
36 // returns one.
37 OPENSSL_EXPORT int MD4_Final(uint8_t out[MD4_DIGEST_LENGTH], MD4_CTX *md4);
38 
39 // MD4 writes the digest of |len| bytes from |data| to |out| and returns |out|.
40 // There must be at least |MD4_DIGEST_LENGTH| bytes of space in |out|.
41 OPENSSL_EXPORT uint8_t *MD4(const uint8_t *data, size_t len,
42                             uint8_t out[MD4_DIGEST_LENGTH]);
43 
44 // MD4_Transform is a low-level function that performs a single, MD4 block
45 // transformation using the state from |md4| and 64 bytes from |block|.
46 OPENSSL_EXPORT void MD4_Transform(MD4_CTX *md4,
47                                   const uint8_t block[MD4_CBLOCK]);
48 
49 struct md4_state_st {
50   uint32_t h[4];
51   uint32_t Nl, Nh;
52   uint8_t data[MD4_CBLOCK];
53   unsigned num;
54 };
55 
56 
57 #if defined(__cplusplus)
58 }  // extern C
59 #endif
60 
61 #endif  // OPENSSL_HEADER_MD4_H
62