Blame cipher/hash-common.h

Packit 0680ba
/* hash-common.h - Declarations of common code for hash algorithms.
Packit 0680ba
 * Copyright (C) 2008 Free Software Foundation, Inc.
Packit 0680ba
 *
Packit 0680ba
 * This file is part of Libgcrypt.
Packit 0680ba
 *
Packit 0680ba
 * Libgcrypt is free software; you can redistribute it and/or modify
Packit 0680ba
 * it under the terms of the GNU Lesser General Public License as
Packit 0680ba
 * published by the Free Software Foundation; either version 2.1 of
Packit 0680ba
 * the License, or (at your option) any later version.
Packit 0680ba
 *
Packit 0680ba
 * Libgcrypt is distributed in the hope that it will be useful,
Packit 0680ba
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 0680ba
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 0680ba
 * GNU Lesser General Public License for more details.
Packit 0680ba
 *
Packit 0680ba
 * You should have received a copy of the GNU Lesser General Public
Packit 0680ba
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
Packit 0680ba
 */
Packit 0680ba
Packit 0680ba
#ifndef GCRY_HASH_COMMON_H
Packit 0680ba
#define GCRY_HASH_COMMON_H
Packit 0680ba
Packit 0680ba
#include "types.h"
Packit 0680ba
Packit 0680ba
Packit 0680ba
const char * _gcry_hash_selftest_check_one
Packit 0680ba
/**/         (int algo,
Packit 0680ba
              int datamode, const void *data, size_t datalen,
Packit 0680ba
              const void *expect, size_t expectlen);
Packit 0680ba
Packit 0680ba
/* Type for the md_write helper function.  */
Packit 0680ba
typedef unsigned int (*_gcry_md_block_write_t) (void *c,
Packit 0680ba
						const unsigned char *buf);
Packit 0680ba
Packit 0680ba
#if defined(HAVE_U64_TYPEDEF) && (defined(USE_SHA512) || defined(USE_WHIRLPOOL))
Packit 0680ba
/* SHA-512 needs u64 and larger buffer. Whirlpool needs u64. */
Packit 0680ba
# define MD_BLOCK_MAX_BLOCKSIZE 128
Packit 0680ba
# define MD_NBLOCKS_TYPE u64
Packit 0680ba
#else
Packit 0680ba
# define MD_BLOCK_MAX_BLOCKSIZE 64
Packit 0680ba
# define MD_NBLOCKS_TYPE u32
Packit 0680ba
#endif
Packit 0680ba
Packit 0680ba
typedef struct gcry_md_block_ctx
Packit 0680ba
{
Packit 0680ba
    byte buf[MD_BLOCK_MAX_BLOCKSIZE];
Packit 0680ba
    MD_NBLOCKS_TYPE nblocks;
Packit 0680ba
    MD_NBLOCKS_TYPE nblocks_high;
Packit 0680ba
    int count;
Packit 0680ba
    size_t blocksize;
Packit 0680ba
    _gcry_md_block_write_t bwrite;
Packit 0680ba
} gcry_md_block_ctx_t;
Packit 0680ba
Packit 0680ba
Packit 0680ba
void
Packit 0680ba
_gcry_md_block_write( void *context, const void *inbuf_arg, size_t inlen);
Packit 0680ba
Packit 0680ba
#endif /*GCRY_HASH_COMMON_H*/