]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: BSD-2-Clause |
7f57883e DS |
2 | /*- |
3 | * Copyright 2005,2007,2009 Colin Percival | |
4 | * All rights reserved. | |
5 | * | |
7f57883e DS |
6 | * $FreeBSD: src/lib/libmd/sha256.h,v 1.2 2006/01/17 15:35:56 phk Exp $ |
7 | */ | |
8 | ||
9 | #ifndef _SHA256_H_ | |
10 | #define _SHA256_H_ | |
11 | ||
5e244469 RW |
12 | #ifdef __cplusplus |
13 | extern "C" { | |
14 | #endif | |
15 | ||
7f57883e | 16 | typedef struct SHA256Context { |
d62a17ae | 17 | uint32_t state[8]; |
18 | uint32_t count[2]; | |
19 | unsigned char buf[64]; | |
7f57883e DS |
20 | } SHA256_CTX; |
21 | ||
22 | typedef struct HMAC_SHA256Context { | |
d62a17ae | 23 | SHA256_CTX ictx; |
24 | SHA256_CTX octx; | |
7f57883e DS |
25 | } HMAC_SHA256_CTX; |
26 | ||
d62a17ae | 27 | void SHA256_Init(SHA256_CTX *); |
28 | void SHA256_Update(SHA256_CTX *, const void *, size_t); | |
29 | void SHA256_Final(unsigned char[32], SHA256_CTX *); | |
30 | void HMAC__SHA256_Init(HMAC_SHA256_CTX *, const void *, size_t); | |
31 | void HMAC__SHA256_Update(HMAC_SHA256_CTX *, const void *, size_t); | |
32 | void HMAC__SHA256_Final(unsigned char[32], HMAC_SHA256_CTX *); | |
7f57883e DS |
33 | |
34 | /** | |
35 | * PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): | |
36 | * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and | |
37 | * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). | |
38 | */ | |
d62a17ae | 39 | void PBKDF2_SHA256(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t, |
40 | uint8_t *, size_t); | |
7f57883e | 41 | |
5e244469 RW |
42 | #ifdef __cplusplus |
43 | } | |
44 | #endif | |
45 | ||
7f57883e | 46 | #endif /* !_SHA256_H_ */ |