jpayne@69: /* jpayne@69: * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved. jpayne@69: * jpayne@69: * Licensed under the OpenSSL license (the "License"). You may not use jpayne@69: * this file except in compliance with the License. You can obtain a copy jpayne@69: * in the file LICENSE in the source distribution or at jpayne@69: * https://www.openssl.org/source/license.html jpayne@69: */ jpayne@69: jpayne@69: #ifndef HEADER_WHRLPOOL_H jpayne@69: # define HEADER_WHRLPOOL_H jpayne@69: jpayne@69: #include jpayne@69: jpayne@69: # ifndef OPENSSL_NO_WHIRLPOOL jpayne@69: # include jpayne@69: # include jpayne@69: # ifdef __cplusplus jpayne@69: extern "C" { jpayne@69: # endif jpayne@69: jpayne@69: # define WHIRLPOOL_DIGEST_LENGTH (512/8) jpayne@69: # define WHIRLPOOL_BBLOCK 512 jpayne@69: # define WHIRLPOOL_COUNTER (256/8) jpayne@69: jpayne@69: typedef struct { jpayne@69: union { jpayne@69: unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; jpayne@69: /* double q is here to ensure 64-bit alignment */ jpayne@69: double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; jpayne@69: } H; jpayne@69: unsigned char data[WHIRLPOOL_BBLOCK / 8]; jpayne@69: unsigned int bitoff; jpayne@69: size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; jpayne@69: } WHIRLPOOL_CTX; jpayne@69: jpayne@69: int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); jpayne@69: int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); jpayne@69: void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); jpayne@69: int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); jpayne@69: unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); jpayne@69: jpayne@69: # ifdef __cplusplus jpayne@69: } jpayne@69: # endif jpayne@69: # endif jpayne@69: jpayne@69: #endif