1e1051a39Sopenharmony_ci/*
2e1051a39Sopenharmony_ci * Copyright 2005-2020 The OpenSSL Project Authors. All Rights Reserved.
3e1051a39Sopenharmony_ci *
4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License").  You may not use
5e1051a39Sopenharmony_ci * this file except in compliance with the License.  You can obtain a copy
6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at
7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html
8e1051a39Sopenharmony_ci */
9e1051a39Sopenharmony_ci
10e1051a39Sopenharmony_ci#ifndef OPENSSL_WHRLPOOL_H
11e1051a39Sopenharmony_ci# define OPENSSL_WHRLPOOL_H
12e1051a39Sopenharmony_ci# pragma once
13e1051a39Sopenharmony_ci
14e1051a39Sopenharmony_ci# include <openssl/macros.h>
15e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_DEPRECATED_3_0
16e1051a39Sopenharmony_ci#  define HEADER_WHRLPOOL_H
17e1051a39Sopenharmony_ci# endif
18e1051a39Sopenharmony_ci
19e1051a39Sopenharmony_ci# include <openssl/opensslconf.h>
20e1051a39Sopenharmony_ci
21e1051a39Sopenharmony_ci# ifndef OPENSSL_NO_WHIRLPOOL
22e1051a39Sopenharmony_ci#  include <openssl/e_os2.h>
23e1051a39Sopenharmony_ci#  include <stddef.h>
24e1051a39Sopenharmony_ci#  ifdef __cplusplus
25e1051a39Sopenharmony_ciextern "C" {
26e1051a39Sopenharmony_ci#  endif
27e1051a39Sopenharmony_ci
28e1051a39Sopenharmony_ci#  define WHIRLPOOL_DIGEST_LENGTH (512/8)
29e1051a39Sopenharmony_ci
30e1051a39Sopenharmony_ci#  if !defined(OPENSSL_NO_DEPRECATED_3_0)
31e1051a39Sopenharmony_ci
32e1051a39Sopenharmony_ci#   define WHIRLPOOL_BBLOCK        512
33e1051a39Sopenharmony_ci#   define WHIRLPOOL_COUNTER       (256/8)
34e1051a39Sopenharmony_ci
35e1051a39Sopenharmony_citypedef struct {
36e1051a39Sopenharmony_ci    union {
37e1051a39Sopenharmony_ci        unsigned char c[WHIRLPOOL_DIGEST_LENGTH];
38e1051a39Sopenharmony_ci        /* double q is here to ensure 64-bit alignment */
39e1051a39Sopenharmony_ci        double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)];
40e1051a39Sopenharmony_ci    } H;
41e1051a39Sopenharmony_ci    unsigned char data[WHIRLPOOL_BBLOCK / 8];
42e1051a39Sopenharmony_ci    unsigned int bitoff;
43e1051a39Sopenharmony_ci    size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)];
44e1051a39Sopenharmony_ci} WHIRLPOOL_CTX;
45e1051a39Sopenharmony_ci#  endif
46e1051a39Sopenharmony_ci#  ifndef OPENSSL_NO_DEPRECATED_3_0
47e1051a39Sopenharmony_ciOSSL_DEPRECATEDIN_3_0 int WHIRLPOOL_Init(WHIRLPOOL_CTX *c);
48e1051a39Sopenharmony_ciOSSL_DEPRECATEDIN_3_0 int WHIRLPOOL_Update(WHIRLPOOL_CTX *c,
49e1051a39Sopenharmony_ci                                           const void *inp, size_t bytes);
50e1051a39Sopenharmony_ciOSSL_DEPRECATEDIN_3_0 void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,
51e1051a39Sopenharmony_ci                                               const void *inp, size_t bits);
52e1051a39Sopenharmony_ciOSSL_DEPRECATEDIN_3_0 int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c);
53e1051a39Sopenharmony_ciOSSL_DEPRECATEDIN_3_0 unsigned char *WHIRLPOOL(const void *inp, size_t bytes,
54e1051a39Sopenharmony_ci                                               unsigned char *md);
55e1051a39Sopenharmony_ci#  endif
56e1051a39Sopenharmony_ci
57e1051a39Sopenharmony_ci#  ifdef __cplusplus
58e1051a39Sopenharmony_ci}
59e1051a39Sopenharmony_ci#  endif
60e1051a39Sopenharmony_ci# endif
61e1051a39Sopenharmony_ci
62e1051a39Sopenharmony_ci#endif
63