1258945Sroberto/* 2280849Scy * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") 3258945Sroberto * Copyright (C) 2000, 2001 Internet Software Consortium. 4258945Sroberto * 5258945Sroberto * Permission to use, copy, modify, and/or distribute this software for any 6258945Sroberto * purpose with or without fee is hereby granted, provided that the above 7258945Sroberto * copyright notice and this permission notice appear in all copies. 8258945Sroberto * 9258945Sroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10258945Sroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11258945Sroberto * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12258945Sroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13258945Sroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14258945Sroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15258945Sroberto * PERFORMANCE OF THIS SOFTWARE. 16258945Sroberto */ 17258945Sroberto 18258945Sroberto#ifndef ISC_SHA1_H 19258945Sroberto#define ISC_SHA1_H 1 20258945Sroberto 21280849Scy/* $Id: sha1.h,v 1.19 2009/02/06 23:47:42 tbox Exp $ */ 22258945Sroberto 23258945Sroberto/* $NetBSD: sha1.h,v 1.2 1998/05/29 22:55:44 thorpej Exp $ */ 24258945Sroberto 25258945Sroberto/*! \file isc/sha1.h 26258945Sroberto * \brief SHA-1 in C 27258945Sroberto * \author By Steve Reid <steve@edmweb.com> 28258945Sroberto * \note 100% Public Domain 29258945Sroberto */ 30258945Sroberto 31258945Sroberto#include <isc/lang.h> 32280849Scy#include <isc/platform.h> 33258945Sroberto#include <isc/types.h> 34258945Sroberto 35258945Sroberto#define ISC_SHA1_DIGESTLENGTH 20U 36258945Sroberto#define ISC_SHA1_BLOCK_LENGTH 64U 37258945Sroberto 38280849Scy#ifdef ISC_PLATFORM_OPENSSLHASH 39280849Scy#include <openssl/evp.h> 40280849Scy 41280849Scytypedef EVP_MD_CTX isc_sha1_t; 42280849Scy 43280849Scy#else 44280849Scy 45258945Srobertotypedef struct { 46258945Sroberto isc_uint32_t state[5]; 47258945Sroberto isc_uint32_t count[2]; 48258945Sroberto unsigned char buffer[ISC_SHA1_BLOCK_LENGTH]; 49258945Sroberto} isc_sha1_t; 50280849Scy#endif 51258945Sroberto 52258945SrobertoISC_LANG_BEGINDECLS 53258945Sroberto 54258945Srobertovoid 55258945Srobertoisc_sha1_init(isc_sha1_t *ctx); 56258945Sroberto 57258945Srobertovoid 58258945Srobertoisc_sha1_invalidate(isc_sha1_t *ctx); 59258945Sroberto 60258945Srobertovoid 61258945Srobertoisc_sha1_update(isc_sha1_t *ctx, const unsigned char *data, unsigned int len); 62258945Sroberto 63258945Srobertovoid 64258945Srobertoisc_sha1_final(isc_sha1_t *ctx, unsigned char *digest); 65258945Sroberto 66258945SrobertoISC_LANG_ENDDECLS 67258945Sroberto 68258945Sroberto#endif /* ISC_SHA1_H */ 69