/*-1* Copyright 2005,2007,2009 Colin Percival2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12*13* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND14* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE17* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23* SUCH DAMAGE.24*25* $FreeBSD: src/lib/libmd/sha256_Y.h,v 1.2 2006/01/17 15:35:56 phk Exp $26*/2728#ifndef _SHA256_H_29#define _SHA256_H_3031#include <sys/types.h>3233#include <stdint.h>3435typedef struct SHA256Context {36uint32_t state[8];37uint32_t count[2];38unsigned char buf[64];39} SHA256_CTX_Y;4041typedef struct HMAC_SHA256Context {42SHA256_CTX_Y ictx;43SHA256_CTX_Y octx;44} HMAC_SHA256_CTX_Y;4546void SHA256_Init_Y(SHA256_CTX_Y *);47void SHA256_Update_Y(SHA256_CTX_Y *, const void *, size_t);48void SHA256_Final_Y(unsigned char [32], SHA256_CTX_Y *);49void HMAC_SHA256_Init_Y(HMAC_SHA256_CTX_Y *, const void *, size_t);50void HMAC_SHA256_Update_Y(HMAC_SHA256_CTX_Y *, const void *, size_t);51void HMAC_SHA256_Final_Y(unsigned char [32], HMAC_SHA256_CTX_Y *);5253/**54* PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):55* Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and56* write the output to buf. The value dkLen must be at most 32 * (2^32 - 1).57*/58void PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t,59uint64_t, uint8_t *, size_t);6061#endif /* !_SHA256_H_ */626364