1*1245c6d1SConrad Meyer /*- 2*1245c6d1SConrad Meyer * Copyright 2005 Colin Percival 3*1245c6d1SConrad Meyer * All rights reserved. 4*1245c6d1SConrad Meyer * 5*1245c6d1SConrad Meyer * Redistribution and use in source and binary forms, with or without 6*1245c6d1SConrad Meyer * modification, are permitted provided that the following conditions 7*1245c6d1SConrad Meyer * are met: 8*1245c6d1SConrad Meyer * 1. Redistributions of source code must retain the above copyright 9*1245c6d1SConrad Meyer * notice, this list of conditions and the following disclaimer. 10*1245c6d1SConrad Meyer * 2. Redistributions in binary form must reproduce the above copyright 11*1245c6d1SConrad Meyer * notice, this list of conditions and the following disclaimer in the 12*1245c6d1SConrad Meyer * documentation and/or other materials provided with the distribution. 13*1245c6d1SConrad Meyer * 14*1245c6d1SConrad Meyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15*1245c6d1SConrad Meyer * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*1245c6d1SConrad Meyer * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*1245c6d1SConrad Meyer * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18*1245c6d1SConrad Meyer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*1245c6d1SConrad Meyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*1245c6d1SConrad Meyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*1245c6d1SConrad Meyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*1245c6d1SConrad Meyer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*1245c6d1SConrad Meyer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*1245c6d1SConrad Meyer * SUCH DAMAGE. 25*1245c6d1SConrad Meyer */ 26*1245c6d1SConrad Meyer 27*1245c6d1SConrad Meyer #ifndef _SHA224_H_ 28*1245c6d1SConrad Meyer #define _SHA224_H_ 29*1245c6d1SConrad Meyer 30*1245c6d1SConrad Meyer #ifndef _KERNEL 31*1245c6d1SConrad Meyer #include <sys/types.h> 32*1245c6d1SConrad Meyer #endif 33*1245c6d1SConrad Meyer 34*1245c6d1SConrad Meyer #define SHA224_BLOCK_LENGTH 64 35*1245c6d1SConrad Meyer #define SHA224_DIGEST_LENGTH 28 36*1245c6d1SConrad Meyer #define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1) 37*1245c6d1SConrad Meyer 38*1245c6d1SConrad Meyer typedef struct SHA224Context { 39*1245c6d1SConrad Meyer uint32_t state[8]; 40*1245c6d1SConrad Meyer uint64_t count; 41*1245c6d1SConrad Meyer uint8_t buf[SHA224_BLOCK_LENGTH]; 42*1245c6d1SConrad Meyer } SHA224_CTX; 43*1245c6d1SConrad Meyer 44*1245c6d1SConrad Meyer __BEGIN_DECLS 45*1245c6d1SConrad Meyer 46*1245c6d1SConrad Meyer /* Ensure libmd symbols do not clash with libcrypto */ 47*1245c6d1SConrad Meyer 48*1245c6d1SConrad Meyer #ifndef SHA224_Init 49*1245c6d1SConrad Meyer #define SHA224_Init _libmd_SHA224_Init 50*1245c6d1SConrad Meyer #endif 51*1245c6d1SConrad Meyer #ifndef SHA224_Update 52*1245c6d1SConrad Meyer #define SHA224_Update _libmd_SHA224_Update 53*1245c6d1SConrad Meyer #endif 54*1245c6d1SConrad Meyer #ifndef SHA224_Final 55*1245c6d1SConrad Meyer #define SHA224_Final _libmd_SHA224_Final 56*1245c6d1SConrad Meyer #endif 57*1245c6d1SConrad Meyer #ifndef SHA224_End 58*1245c6d1SConrad Meyer #define SHA224_End _libmd_SHA224_End 59*1245c6d1SConrad Meyer #endif 60*1245c6d1SConrad Meyer #ifndef SHA224_Fd 61*1245c6d1SConrad Meyer #define SHA224_Fd _libmd_SHA224_Fd 62*1245c6d1SConrad Meyer #endif 63*1245c6d1SConrad Meyer #ifndef SHA224_FdChunk 64*1245c6d1SConrad Meyer #define SHA224_FdChunk _libmd_SHA224_FdChunk 65*1245c6d1SConrad Meyer #endif 66*1245c6d1SConrad Meyer #ifndef SHA224_File 67*1245c6d1SConrad Meyer #define SHA224_File _libmd_SHA224_File 68*1245c6d1SConrad Meyer #endif 69*1245c6d1SConrad Meyer #ifndef SHA224_FileChunk 70*1245c6d1SConrad Meyer #define SHA224_FileChunk _libmd_SHA224_FileChunk 71*1245c6d1SConrad Meyer #endif 72*1245c6d1SConrad Meyer #ifndef SHA224_Data 73*1245c6d1SConrad Meyer #define SHA224_Data _libmd_SHA224_Data 74*1245c6d1SConrad Meyer #endif 75*1245c6d1SConrad Meyer 76*1245c6d1SConrad Meyer void SHA224_Init(SHA224_CTX *); 77*1245c6d1SConrad Meyer void SHA224_Update(SHA224_CTX *, const void *, size_t); 78*1245c6d1SConrad Meyer void SHA224_Final(unsigned char [__min_size(SHA224_DIGEST_LENGTH)], 79*1245c6d1SConrad Meyer SHA224_CTX *); 80*1245c6d1SConrad Meyer #ifndef _KERNEL 81*1245c6d1SConrad Meyer char *SHA224_End(SHA224_CTX *, char *); 82*1245c6d1SConrad Meyer char *SHA224_Data(const void *, unsigned int, char *); 83*1245c6d1SConrad Meyer char *SHA224_Fd(int, char *); 84*1245c6d1SConrad Meyer char *SHA224_FdChunk(int, char *, off_t, off_t); 85*1245c6d1SConrad Meyer char *SHA224_File(const char *, char *); 86*1245c6d1SConrad Meyer char *SHA224_FileChunk(const char *, char *, off_t, off_t); 87*1245c6d1SConrad Meyer #endif 88*1245c6d1SConrad Meyer __END_DECLS 89*1245c6d1SConrad Meyer 90*1245c6d1SConrad Meyer #endif /* !_SHA224_H_ */ 91