• 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_RIPEMD_H
11 #define OPENSSL_HEADER_RIPEMD_H
12 
13 #include <openssl/base.h>
14 
15 #ifdef  __cplusplus
16 extern "C" {
17 #endif
18 
19 
20 # define RIPEMD160_CBLOCK        64
21 # define RIPEMD160_LBLOCK        (RIPEMD160_CBLOCK/4)
22 # define RIPEMD160_DIGEST_LENGTH 20
23 
24 struct RIPEMD160state_st {
25   uint32_t h[5];
26   uint32_t Nl, Nh;
27   uint8_t data[RIPEMD160_CBLOCK];
28   unsigned num;
29 };
30 
31 // RIPEMD160_Init initialises |ctx| and returns one.
32 OPENSSL_EXPORT int RIPEMD160_Init(RIPEMD160_CTX *ctx);
33 
34 // RIPEMD160_Update adds |len| bytes from |data| to |ctx| and returns one.
35 OPENSSL_EXPORT int RIPEMD160_Update(RIPEMD160_CTX *ctx, const void *data,
36                                    size_t len);
37 
38 // RIPEMD160_Final adds the final padding to |ctx| and writes the resulting
39 // digest to |out|, which must have at least |RIPEMD160_DIGEST_LENGTH| bytes of
40 // space. It returns one.
41 OPENSSL_EXPORT int RIPEMD160_Final(uint8_t out[RIPEMD160_DIGEST_LENGTH],
42                                    RIPEMD160_CTX *ctx);
43 
44 // RIPEMD160 writes the digest of |len| bytes from |data| to |out| and returns
45 // |out|. There must be at least |RIPEMD160_DIGEST_LENGTH| bytes of space in
46 // |out|.
47 OPENSSL_EXPORT uint8_t *RIPEMD160(const uint8_t *data, size_t len,
48                                   uint8_t out[RIPEMD160_DIGEST_LENGTH]);
49 
50 // RIPEMD160_Transform is a low-level function that performs a single,
51 // RIPEMD160 block transformation using the state from |ctx| and 64 bytes from
52 // |block|.
53 OPENSSL_EXPORT void RIPEMD160_Transform(RIPEMD160_CTX *ctx,
54                                         const uint8_t block[RIPEMD160_CBLOCK]);
55 
56 
57 #if defined(__cplusplus)
58 }  // extern C
59 #endif
60 
61 #endif  // OPENSSL_HEADER_RIPEMD_H
62