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 * $FreeBSD$ 27*1245c6d1SConrad Meyer */ 28*1245c6d1SConrad Meyer 29*1245c6d1SConrad Meyer #ifndef _SHA224_H_ 30*1245c6d1SConrad Meyer #define _SHA224_H_ 31*1245c6d1SConrad Meyer 32*1245c6d1SConrad Meyer #ifndef _KERNEL 33*1245c6d1SConrad Meyer #include <sys/types.h> 34*1245c6d1SConrad Meyer #endif 35*1245c6d1SConrad Meyer 36*1245c6d1SConrad Meyer #define SHA224_BLOCK_LENGTH 64 37*1245c6d1SConrad Meyer #define SHA224_DIGEST_LENGTH 28 38*1245c6d1SConrad Meyer #define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1) 39*1245c6d1SConrad Meyer 40*1245c6d1SConrad Meyer typedef struct SHA224Context { 41*1245c6d1SConrad Meyer uint32_t state[8]; 42*1245c6d1SConrad Meyer uint64_t count; 43*1245c6d1SConrad Meyer uint8_t buf[SHA224_BLOCK_LENGTH]; 44*1245c6d1SConrad Meyer } SHA224_CTX; 45*1245c6d1SConrad Meyer 46*1245c6d1SConrad Meyer __BEGIN_DECLS 47*1245c6d1SConrad Meyer 48*1245c6d1SConrad Meyer /* Ensure libmd symbols do not clash with libcrypto */ 49*1245c6d1SConrad Meyer 50*1245c6d1SConrad Meyer #ifndef SHA224_Init 51*1245c6d1SConrad Meyer #define SHA224_Init _libmd_SHA224_Init 52*1245c6d1SConrad Meyer #endif 53*1245c6d1SConrad Meyer #ifndef SHA224_Update 54*1245c6d1SConrad Meyer #define SHA224_Update _libmd_SHA224_Update 55*1245c6d1SConrad Meyer #endif 56*1245c6d1SConrad Meyer #ifndef SHA224_Final 57*1245c6d1SConrad Meyer #define SHA224_Final _libmd_SHA224_Final 58*1245c6d1SConrad Meyer #endif 59*1245c6d1SConrad Meyer #ifndef SHA224_End 60*1245c6d1SConrad Meyer #define SHA224_End _libmd_SHA224_End 61*1245c6d1SConrad Meyer #endif 62*1245c6d1SConrad Meyer #ifndef SHA224_Fd 63*1245c6d1SConrad Meyer #define SHA224_Fd _libmd_SHA224_Fd 64*1245c6d1SConrad Meyer #endif 65*1245c6d1SConrad Meyer #ifndef SHA224_FdChunk 66*1245c6d1SConrad Meyer #define SHA224_FdChunk _libmd_SHA224_FdChunk 67*1245c6d1SConrad Meyer #endif 68*1245c6d1SConrad Meyer #ifndef SHA224_File 69*1245c6d1SConrad Meyer #define SHA224_File _libmd_SHA224_File 70*1245c6d1SConrad Meyer #endif 71*1245c6d1SConrad Meyer #ifndef SHA224_FileChunk 72*1245c6d1SConrad Meyer #define SHA224_FileChunk _libmd_SHA224_FileChunk 73*1245c6d1SConrad Meyer #endif 74*1245c6d1SConrad Meyer #ifndef SHA224_Data 75*1245c6d1SConrad Meyer #define SHA224_Data _libmd_SHA224_Data 76*1245c6d1SConrad Meyer #endif 77*1245c6d1SConrad Meyer 78*1245c6d1SConrad Meyer #ifndef SHA224_version 79*1245c6d1SConrad Meyer #define SHA224_version _libmd_SHA224_version 80*1245c6d1SConrad Meyer #endif 81*1245c6d1SConrad Meyer 82*1245c6d1SConrad Meyer void SHA224_Init(SHA224_CTX *); 83*1245c6d1SConrad Meyer void SHA224_Update(SHA224_CTX *, const void *, size_t); 84*1245c6d1SConrad Meyer void SHA224_Final(unsigned char [__min_size(SHA224_DIGEST_LENGTH)], 85*1245c6d1SConrad Meyer SHA224_CTX *); 86*1245c6d1SConrad Meyer #ifndef _KERNEL 87*1245c6d1SConrad Meyer char *SHA224_End(SHA224_CTX *, char *); 88*1245c6d1SConrad Meyer char *SHA224_Data(const void *, unsigned int, char *); 89*1245c6d1SConrad Meyer char *SHA224_Fd(int, char *); 90*1245c6d1SConrad Meyer char *SHA224_FdChunk(int, char *, off_t, off_t); 91*1245c6d1SConrad Meyer char *SHA224_File(const char *, char *); 92*1245c6d1SConrad Meyer char *SHA224_FileChunk(const char *, char *, off_t, off_t); 93*1245c6d1SConrad Meyer #endif 94*1245c6d1SConrad Meyer __END_DECLS 95*1245c6d1SConrad Meyer 96*1245c6d1SConrad Meyer #endif /* !_SHA224_H_ */ 97