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