1135446Strhodes/*
2224092Sdougb * Copyright (C) 2004-2007, 2009  Internet Systems Consortium, Inc. ("ISC")
3135446Strhodes * Copyright (C) 2000, 2001  Internet Software Consortium.
4135446Strhodes *
5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any
6135446Strhodes * purpose with or without fee is hereby granted, provided that the above
7135446Strhodes * copyright notice and this permission notice appear in all copies.
8135446Strhodes *
9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11135446Strhodes * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15135446Strhodes * PERFORMANCE OF THIS SOFTWARE.
16135446Strhodes */
17135446Strhodes
18135446Strhodes#ifndef ISC_SHA1_H
19135446Strhodes#define ISC_SHA1_H 1
20135446Strhodes
21234010Sdougb/* $Id: sha1.h,v 1.19 2009/02/06 23:47:42 tbox Exp $ */
22135446Strhodes
23135446Strhodes/*	$NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $	*/
24135446Strhodes
25193149Sdougb/*! \file isc/sha1.h
26170222Sdougb * \brief SHA-1 in C
27170222Sdougb * \author By Steve Reid <steve@edmweb.com>
28170222Sdougb * \note 100% Public Domain
29135446Strhodes */
30135446Strhodes
31135446Strhodes#include <isc/lang.h>
32224092Sdougb#include <isc/platform.h>
33135446Strhodes#include <isc/types.h>
34135446Strhodes
35170222Sdougb#define ISC_SHA1_DIGESTLENGTH 20U
36170222Sdougb#define ISC_SHA1_BLOCK_LENGTH 64U
37135446Strhodes
38224092Sdougb#ifdef ISC_PLATFORM_OPENSSLHASH
39224092Sdougb#include <openssl/evp.h>
40224092Sdougb
41224092Sdougbtypedef EVP_MD_CTX isc_sha1_t;
42224092Sdougb
43224092Sdougb#else
44224092Sdougb
45135446Strhodestypedef struct {
46135446Strhodes	isc_uint32_t state[5];
47135446Strhodes	isc_uint32_t count[2];
48170222Sdougb	unsigned char buffer[ISC_SHA1_BLOCK_LENGTH];
49135446Strhodes} isc_sha1_t;
50224092Sdougb#endif
51135446Strhodes
52135446StrhodesISC_LANG_BEGINDECLS
53135446Strhodes
54135446Strhodesvoid
55135446Strhodesisc_sha1_init(isc_sha1_t *ctx);
56135446Strhodes
57135446Strhodesvoid
58135446Strhodesisc_sha1_invalidate(isc_sha1_t *ctx);
59135446Strhodes
60135446Strhodesvoid
61135446Strhodesisc_sha1_update(isc_sha1_t *ctx, const unsigned char *data, unsigned int len);
62135446Strhodes
63135446Strhodesvoid
64135446Strhodesisc_sha1_final(isc_sha1_t *ctx, unsigned char *digest);
65135446Strhodes
66135446StrhodesISC_LANG_ENDDECLS
67135446Strhodes
68135446Strhodes#endif /* ISC_SHA1_H */
69