1*ebfedea0SLionel Sambuc /*- 2*ebfedea0SLionel Sambuc * Copyright (c) 2005-2011 Alistair Crooks <agc@NetBSD.org> 3*ebfedea0SLionel Sambuc * All rights reserved. 4*ebfedea0SLionel Sambuc * 5*ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without 6*ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions 7*ebfedea0SLionel Sambuc * are met: 8*ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 9*ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer. 10*ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 11*ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 12*ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution. 13*ebfedea0SLionel Sambuc * 14*ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15*ebfedea0SLionel Sambuc * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16*ebfedea0SLionel Sambuc * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17*ebfedea0SLionel Sambuc * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18*ebfedea0SLionel Sambuc * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19*ebfedea0SLionel Sambuc * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20*ebfedea0SLionel Sambuc * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21*ebfedea0SLionel Sambuc * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22*ebfedea0SLionel Sambuc * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23*ebfedea0SLionel Sambuc * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24*ebfedea0SLionel Sambuc */ 25*ebfedea0SLionel Sambuc #ifndef TIGER_H_ 26*ebfedea0SLionel Sambuc #define TIGER_H_ 27*ebfedea0SLionel Sambuc 28*ebfedea0SLionel Sambuc #include <sys/types.h> 29*ebfedea0SLionel Sambuc 30*ebfedea0SLionel Sambuc #include <inttypes.h> 31*ebfedea0SLionel Sambuc 32*ebfedea0SLionel Sambuc #ifndef __BEGIN_DECLS 33*ebfedea0SLionel Sambuc # if defined(__cplusplus) 34*ebfedea0SLionel Sambuc # define __BEGIN_DECLS extern "C" { 35*ebfedea0SLionel Sambuc # define __END_DECLS } 36*ebfedea0SLionel Sambuc # else 37*ebfedea0SLionel Sambuc # define __BEGIN_DECLS 38*ebfedea0SLionel Sambuc # define __END_DECLS 39*ebfedea0SLionel Sambuc # endif 40*ebfedea0SLionel Sambuc #endif 41*ebfedea0SLionel Sambuc 42*ebfedea0SLionel Sambuc __BEGIN_DECLS 43*ebfedea0SLionel Sambuc 44*ebfedea0SLionel Sambuc #define TIGER_DIGEST_LENGTH 24 45*ebfedea0SLionel Sambuc #define TIGER_DIGEST_STRING_LENGTH ((TIGER_DIGEST_LENGTH * 2) + 1) 46*ebfedea0SLionel Sambuc 47*ebfedea0SLionel Sambuc typedef struct TIGER_CTX { 48*ebfedea0SLionel Sambuc uint64_t ctx[3]; 49*ebfedea0SLionel Sambuc int init; 50*ebfedea0SLionel Sambuc uint8_t pad; 51*ebfedea0SLionel Sambuc } TIGER_CTX; 52*ebfedea0SLionel Sambuc 53*ebfedea0SLionel Sambuc void TIGER_Init(TIGER_CTX *); 54*ebfedea0SLionel Sambuc void TIGER2_Init(TIGER_CTX *); 55*ebfedea0SLionel Sambuc void TIGER_Update(TIGER_CTX *, const void *, size_t); 56*ebfedea0SLionel Sambuc void TIGER_Final(uint8_t *, TIGER_CTX *); 57*ebfedea0SLionel Sambuc 58*ebfedea0SLionel Sambuc char *TIGER_End(TIGER_CTX *, char *); 59*ebfedea0SLionel Sambuc 60*ebfedea0SLionel Sambuc char *TIGER_File(char *, char *, int); 61*ebfedea0SLionel Sambuc char *TIGER_Data(const uint8_t *, size_t, char *, int); 62*ebfedea0SLionel Sambuc 63*ebfedea0SLionel Sambuc __END_DECLS 64*ebfedea0SLionel Sambuc 65*ebfedea0SLionel Sambuc #endif 66