180016Sobrien/* crypto/ripemd/ripemd.h */
280016Sobrien/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
380016Sobrien * All rights reserved.
480016Sobrien *
580016Sobrien * This package is an SSL implementation written
680016Sobrien * by Eric Young (eay@cryptsoft.com).
780016Sobrien * The implementation was written so as to conform with Netscapes SSL.
880016Sobrien *
980016Sobrien * This library is free for commercial and non-commercial use as long as
1080016Sobrien * the following conditions are aheared to.  The following conditions
1180016Sobrien * apply to all code found in this distribution, be it the RC4, RSA,
1280016Sobrien * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
1380016Sobrien * included with this distribution is covered by the same copyright terms
1480016Sobrien * except that the holder is Tim Hudson (tjh@cryptsoft.com).
1580016Sobrien *
1680016Sobrien * Copyright remains Eric Young's, and as such any Copyright notices in
1780016Sobrien * the code are not to be removed.
1880016Sobrien * If this package is used in a product, Eric Young should be given attribution
1980016Sobrien * as the author of the parts of the library used.
2080016Sobrien * This can be in the form of a textual message at program startup or
2180016Sobrien * in documentation (online or textual) provided with the package.
2280016Sobrien *
2380016Sobrien * Redistribution and use in source and binary forms, with or without
2480016Sobrien * modification, are permitted provided that the following conditions
2580016Sobrien * are met:
2680016Sobrien * 1. Redistributions of source code must retain the copyright
2780016Sobrien *    notice, this list of conditions and the following disclaimer.
2880016Sobrien * 2. Redistributions in binary form must reproduce the above copyright
2980016Sobrien *    notice, this list of conditions and the following disclaimer in the
3080016Sobrien *    documentation and/or other materials provided with the distribution.
3180016Sobrien * 3. All advertising materials mentioning features or use of this software
3280016Sobrien *    must display the following acknowledgement:
3380016Sobrien *    "This product includes cryptographic software written by
3480016Sobrien *     Eric Young (eay@cryptsoft.com)"
3580016Sobrien *    The word 'cryptographic' can be left out if the rouines from the library
3680016Sobrien *    being used are not cryptographic related :-).
3780016Sobrien * 4. If you include any Windows specific code (or a derivative thereof) from
3880016Sobrien *    the apps directory (application code) you must include an acknowledgement:
3980016Sobrien *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
4080016Sobrien *
4180016Sobrien * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
4280016Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4380016Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4480016Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
4580016Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4680016Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4780016Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4880016Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4980016Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5080016Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5180016Sobrien * SUCH DAMAGE.
5280016Sobrien *
5380016Sobrien * The licence and distribution terms for any publically available version or
5480016Sobrien * derivative of this code cannot be changed.  i.e. this code cannot simply be
5580016Sobrien * copied and put under another distribution licence
5680016Sobrien * [including the GNU Public Licence.]
5780016Sobrien */
5880016Sobrien
5980016Sobrien/*
6080016Sobrien * $FreeBSD: stable/10/lib/libmd/ripemd.h 314157 2017-02-23 18:54:33Z avg $
6180016Sobrien */
6280016Sobrien
6380016Sobrien#ifndef HEADER_RIPEMD_H
6480016Sobrien#define HEADER_RIPEMD_H
6580016Sobrien
6680016Sobrien#include <sys/cdefs.h>
6780016Sobrien#include <sys/types.h>		/* XXX switch to machine/ansi.h and __ types */
6880016Sobrien
6980016Sobrien#define RIPEMD160_CBLOCK	64
7080016Sobrien#define RIPEMD160_LBLOCK	16
7180016Sobrien#define RIPEMD160_BLOCK		16
7280016Sobrien#define RIPEMD160_LAST_BLOCK	56
7380016Sobrien#define RIPEMD160_LENGTH_BLOCK	8
7480016Sobrien#define RIPEMD160_DIGEST_LENGTH	20
7580016Sobrien
7680016Sobrientypedef struct RIPEMD160state_st {
7780016Sobrien	u_int32_t A,B,C,D,E;
7880016Sobrien	u_int32_t Nl,Nh;
7980016Sobrien	u_int32_t data[RIPEMD160_LBLOCK];
8080016Sobrien	int num;
8180016Sobrien} RIPEMD160_CTX;
8280016Sobrien
8380016Sobrien__BEGIN_DECLS
8480016Sobrien
8580016Sobrien/* Ensure libmd symbols do not clash with libcrypto */
8680016Sobrien
8780016Sobrien#ifndef RIPEMD160_Init
8880016Sobrien#define RIPEMD160_Init		_libmd_RIPEMD160_Init
8980016Sobrien#endif
9080016Sobrien#ifndef RIPEMD160_Update
9180016Sobrien#define RIPEMD160_Update	_libmd_RIPEMD160_Update
9280016Sobrien#endif
9380016Sobrien#ifndef RIPEMD160_Final
9480016Sobrien#define RIPEMD160_Final		_libmd_RIPEMD160_Final
9580016Sobrien#endif
9680016Sobrien#ifndef RIPEMD160_End
9780016Sobrien#define RIPEMD160_End		_libmd_RIPEMD160_End
9880016Sobrien#endif
9980016Sobrien#ifndef RIPEMD160_File
10080016Sobrien#define RIPEMD160_File		_libmd_RIPEMD160_File
10180016Sobrien#endif
10280016Sobrien#ifndef RIPEMD160_FileChunk
10380016Sobrien#define RIPEMD160_FileChunk	_libmd_RIPEMD160_FileChunk
104#endif
105#ifndef RIPEMD160_Data
106#define RIPEMD160_Data		_libmd_RIPEMD160_Data
107#endif
108
109#ifndef RIPEMD160_Transform
110#define RIPEMD160_Transform	_libmd_RIPEMD160_Transform
111#endif
112#ifndef RMD160_version
113#define RMD160_version		_libmd_RMD160_version
114#endif
115#ifndef ripemd160_block
116#define ripemd160_block		_libmd_ripemd160_block
117#endif
118
119void	RIPEMD160_Init(RIPEMD160_CTX *c);
120void	RIPEMD160_Update(RIPEMD160_CTX *c, const void *data,
121			 size_t len);
122void	RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
123char   *RIPEMD160_End(RIPEMD160_CTX *, char *);
124char   *RIPEMD160_File(const char *, char *);
125char   *RIPEMD160_FileChunk(const char *, char *, off_t, off_t);
126char   *RIPEMD160_Data(const void *, unsigned int, char *);
127__END_DECLS
128
129#endif
130