144290Swollman/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 244290Swollman * All rights reserved. 344290Swollman * 444290Swollman * This package is an SSL implementation written 544290Swollman * by Eric Young (eay@cryptsoft.com). 644290Swollman * The implementation was written so as to conform with Netscapes SSL. 744290Swollman * 844290Swollman * This library is free for commercial and non-commercial use as long as 944290Swollman * the following conditions are aheared to. The following conditions 1044290Swollman * apply to all code found in this distribution, be it the RC4, RSA, 1144290Swollman * lhash, DES, etc., code; not just the SSL code. The SSL documentation 1244290Swollman * included with this distribution is covered by the same copyright terms 1344290Swollman * except that the holder is Tim Hudson (tjh@cryptsoft.com). 1444290Swollman * 1544290Swollman * Copyright remains Eric Young's, and as such any Copyright notices in 1644290Swollman * the code are not to be removed. 1744290Swollman * If this package is used in a product, Eric Young should be given attribution 1844290Swollman * as the author of the parts of the library used. 1944290Swollman * This can be in the form of a textual message at program startup or 2044290Swollman * in documentation (online or textual) provided with the package. 2144290Swollman * 2244290Swollman * Redistribution and use in source and binary forms, with or without 2344290Swollman * modification, are permitted provided that the following conditions 2444290Swollman * are met: 2544290Swollman * 1. Redistributions of source code must retain the copyright 2644290Swollman * notice, this list of conditions and the following disclaimer. 2744290Swollman * 2. Redistributions in binary form must reproduce the above copyright 2844290Swollman * notice, this list of conditions and the following disclaimer in the 2944290Swollman * documentation and/or other materials provided with the distribution. 3044290Swollman * 3. All advertising materials mentioning features or use of this software 3144290Swollman * must display the following acknowledgement: 3244290Swollman * "This product includes cryptographic software written by 3344290Swollman * Eric Young (eay@cryptsoft.com)" 3444290Swollman * The word 'cryptographic' can be left out if the rouines from the library 3544290Swollman * being used are not cryptographic related :-). 3644290Swollman * 4. If you include any Windows specific code (or a derivative thereof) from 3744290Swollman * the apps directory (application code) you must include an acknowledgement: 3844290Swollman * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 3944290Swollman * 4044290Swollman * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 4144290Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4244290Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 4344290Swollman * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 4444290Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4544290Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 4644290Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4744290Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4844290Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 4944290Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5044290Swollman * SUCH DAMAGE. 5144290Swollman * 5244290Swollman * The licence and distribution terms for any publically available version or 5344290Swollman * derivative of this code cannot be changed. i.e. this code cannot simply be 5444290Swollman * copied and put under another distribution licence 5544290Swollman * [including the GNU Public Licence.] 5644290Swollman * 5750476Speter * $FreeBSD$ 5844290Swollman */ 5944290Swollman 6044290Swollman#ifndef _SHA_H_ 6144290Swollman#define _SHA_H_ 1 6244290Swollman 6344290Swollman#include <sys/cdefs.h> 6444290Swollman#include <sys/types.h> /* XXX switch to machine/ansi.h and __ types */ 6544290Swollman 6644290Swollman#define SHA_CBLOCK 64 6744290Swollman#define SHA_LBLOCK 16 6844290Swollman#define SHA_BLOCK 16 6944290Swollman#define SHA_LAST_BLOCK 56 7044290Swollman#define SHA_LENGTH_BLOCK 8 7144290Swollman#define SHA_DIGEST_LENGTH 20 7244290Swollman 7344290Swollmantypedef struct SHAstate_st { 7444290Swollman u_int32_t h0, h1, h2, h3, h4; 7544290Swollman u_int32_t Nl, Nh; 7644290Swollman u_int32_t data[SHA_LBLOCK]; 7744290Swollman int num; 7844290Swollman} SHA_CTX; 7944290Swollman#define SHA1_CTX SHA_CTX 8044290Swollman 8144290Swollman__BEGIN_DECLS 8244290Swollmanvoid SHA_Init(SHA_CTX *c); 83154479Sphkvoid SHA_Update(SHA_CTX *c, const void *data, size_t len); 8444290Swollmanvoid SHA_Final(unsigned char *md, SHA_CTX *c); 8544290Swollmanchar *SHA_End(SHA_CTX *, char *); 8644290Swollmanchar *SHA_File(const char *, char *); 8774385Sphkchar *SHA_FileChunk(const char *, char *, off_t, off_t); 88154479Sphkchar *SHA_Data(const void *, unsigned int, char *); 8944290Swollmanvoid SHA1_Init(SHA_CTX *c); 90154479Sphkvoid SHA1_Update(SHA_CTX *c, const void *data, size_t len); 9144290Swollmanvoid SHA1_Final(unsigned char *md, SHA_CTX *c); 9244290Swollmanchar *SHA1_End(SHA_CTX *, char *); 9344290Swollmanchar *SHA1_File(const char *, char *); 9474385Sphkchar *SHA1_FileChunk(const char *, char *, off_t, off_t); 95154479Sphkchar *SHA1_Data(const void *, unsigned int, char *); 9644290Swollman__END_DECLS 9744290Swollman 9844290Swollman#endif /* !_SHA_H_ */ 99