1d54cfbdroberto/*
2047f369cy * Copyright (C) 2004-2007, 2009  Internet Systems Consortium, Inc. ("ISC")
3d54cfbdroberto * Copyright (C) 2000, 2001  Internet Software Consortium.
4d54cfbdroberto *
5d54cfbdroberto * Permission to use, copy, modify, and/or distribute this software for any
6d54cfbdroberto * purpose with or without fee is hereby granted, provided that the above
7d54cfbdroberto * copyright notice and this permission notice appear in all copies.
8d54cfbdroberto *
9d54cfbdroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10d54cfbdroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11d54cfbdroberto * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12d54cfbdroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13d54cfbdroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14d54cfbdroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15d54cfbdroberto * PERFORMANCE OF THIS SOFTWARE.
16d54cfbdroberto */
17d54cfbdroberto
18d54cfbdroberto#ifndef ISC_SHA1_H
19d54cfbdroberto#define ISC_SHA1_H 1
20d54cfbdroberto
21047f369cy/* $Id: sha1.h,v 1.19 2009/02/06 23:47:42 tbox Exp $ */
22d54cfbdroberto
23d54cfbdroberto/*	$NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $	*/
24d54cfbdroberto
25d54cfbdroberto/*! \file isc/sha1.h
26d54cfbdroberto * \brief SHA-1 in C
27d54cfbdroberto * \author By Steve Reid <steve@edmweb.com>
28d54cfbdroberto * \note 100% Public Domain
29d54cfbdroberto */
30d54cfbdroberto
31d54cfbdroberto#include <isc/lang.h>
32047f369cy#include <isc/platform.h>
33d54cfbdroberto#include <isc/types.h>
34d54cfbdroberto
35d54cfbdroberto#define ISC_SHA1_DIGESTLENGTH 20U
36d54cfbdroberto#define ISC_SHA1_BLOCK_LENGTH 64U
37d54cfbdroberto
38047f369cy#ifdef ISC_PLATFORM_OPENSSLHASH
39047f369cy#include <openssl/evp.h>
40047f369cy
41047f369cytypedef EVP_MD_CTX isc_sha1_t;
42047f369cy
43047f369cy#else
44047f369cy
45d54cfbdrobertotypedef struct {
46d54cfbdroberto	isc_uint32_t state[5];
47d54cfbdroberto	isc_uint32_t count[2];
48d54cfbdroberto	unsigned char buffer[ISC_SHA1_BLOCK_LENGTH];
49d54cfbdroberto} isc_sha1_t;
50047f369cy#endif
51d54cfbdroberto
52d54cfbdrobertoISC_LANG_BEGINDECLS
53d54cfbdroberto
54d54cfbdrobertovoid
55d54cfbdrobertoisc_sha1_init(isc_sha1_t *ctx);
56d54cfbdroberto
57d54cfbdrobertovoid
58d54cfbdrobertoisc_sha1_invalidate(isc_sha1_t *ctx);
59d54cfbdroberto
60d54cfbdrobertovoid
61d54cfbdrobertoisc_sha1_update(isc_sha1_t *ctx, const unsigned char *data, unsigned int len);
62d54cfbdroberto
63d54cfbdrobertovoid
64d54cfbdrobertoisc_sha1_final(isc_sha1_t *ctx, unsigned char *digest);
65d54cfbdroberto
66d54cfbdrobertoISC_LANG_ENDDECLS
67d54cfbdroberto
68d54cfbdroberto#endif /* ISC_SHA1_H */
69