1*be9962e2SThomas Veerman /* $NetBSD: rmd160.h,v 1.2 2008/02/16 17:37:13 apb Exp $ */ 2*be9962e2SThomas Veerman /* $KAME: rmd160.h,v 1.2 2003/07/25 09:37:55 itojun Exp $ */ 3*be9962e2SThomas Veerman /* $OpenBSD: rmd160.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */ 4*be9962e2SThomas Veerman /* 5*be9962e2SThomas Veerman * Copyright (c) 2001 Markus Friedl. All rights reserved. 6*be9962e2SThomas Veerman * 7*be9962e2SThomas Veerman * Redistribution and use in source and binary forms, with or without 8*be9962e2SThomas Veerman * modification, are permitted provided that the following conditions 9*be9962e2SThomas Veerman * are met: 10*be9962e2SThomas Veerman * 1. Redistributions of source code must retain the above copyright 11*be9962e2SThomas Veerman * notice, this list of conditions and the following disclaimer. 12*be9962e2SThomas Veerman * 2. Redistributions in binary form must reproduce the above copyright 13*be9962e2SThomas Veerman * notice, this list of conditions and the following disclaimer in the 14*be9962e2SThomas Veerman * documentation and/or other materials provided with the distribution. 15*be9962e2SThomas Veerman * 16*be9962e2SThomas Veerman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17*be9962e2SThomas Veerman * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18*be9962e2SThomas Veerman * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19*be9962e2SThomas Veerman * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20*be9962e2SThomas Veerman * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21*be9962e2SThomas Veerman * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22*be9962e2SThomas Veerman * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23*be9962e2SThomas Veerman * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24*be9962e2SThomas Veerman * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25*be9962e2SThomas Veerman * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26*be9962e2SThomas Veerman */ 27*be9962e2SThomas Veerman #ifndef _RMD160_H 28*be9962e2SThomas Veerman #define _RMD160_H 29*be9962e2SThomas Veerman 30*be9962e2SThomas Veerman #include <sys/cdefs.h> 31*be9962e2SThomas Veerman #include <sys/types.h> 32*be9962e2SThomas Veerman 33*be9962e2SThomas Veerman #define RMD160_DIGEST_LENGTH 20 34*be9962e2SThomas Veerman #define RMD160_DIGEST_STRING_LENGTH 41 35*be9962e2SThomas Veerman 36*be9962e2SThomas Veerman /* RMD160 context. */ 37*be9962e2SThomas Veerman typedef struct RMD160Context { 38*be9962e2SThomas Veerman uint32_t state[5]; /* state */ 39*be9962e2SThomas Veerman uint64_t count; /* number of bits, modulo 2^64 */ 40*be9962e2SThomas Veerman u_char buffer[64]; /* input buffer */ 41*be9962e2SThomas Veerman } RMD160_CTX; 42*be9962e2SThomas Veerman 43*be9962e2SThomas Veerman __BEGIN_DECLS 44*be9962e2SThomas Veerman void RMD160Init(RMD160_CTX *); 45*be9962e2SThomas Veerman void RMD160Transform(uint32_t [5], const u_char [64]); 46*be9962e2SThomas Veerman void RMD160Update(RMD160_CTX *, const u_char *, uint32_t); 47*be9962e2SThomas Veerman void RMD160Final(u_char [RMD160_DIGEST_LENGTH], RMD160_CTX *); 48*be9962e2SThomas Veerman #ifndef _KERNEL 49*be9962e2SThomas Veerman char *RMD160End(RMD160_CTX *, char *); 50*be9962e2SThomas Veerman char *RMD160FileChunk(const char *, char *, off_t, off_t); 51*be9962e2SThomas Veerman char *RMD160File(const char *, char *); 52*be9962e2SThomas Veerman char *RMD160Data(const u_char *, size_t, char *); 53*be9962e2SThomas Veerman #endif /* _KERNEL */ 54*be9962e2SThomas Veerman __END_DECLS 55*be9962e2SThomas Veerman 56*be9962e2SThomas Veerman #endif /* _RMD160_H */ 57