1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-20 10:37:24 -07:00

Move crypto_hash_sha256_state to the crypto_hash_sha256.h header file

This commit is contained in:
Frank Denis 2014-04-10 21:14:04 -07:00
parent 6c42962b57
commit 9fa62b38a4
4 changed files with 16 additions and 22 deletions

View File

@ -38,12 +38,6 @@
#include <stdlib.h>
#include <string.h>
typedef struct crypto_hash_sha256_state {
uint32_t state[8];
uint32_t count[2];
unsigned char buf[64];
} crypto_hash_sha256_state;
typedef struct crypto_hmac_sha256_state {
crypto_hash_sha256_state ictx;
crypto_hash_sha256_state octx;

View File

@ -37,12 +37,6 @@
#include <stdlib.h>
#include <string.h>
typedef struct crypto_hash_sha256_state {
uint32_t state[8];
uint32_t count[2];
unsigned char buf[64];
} crypto_hash_sha256_state;
void _SHA256_Init(crypto_hash_sha256_state *);
void _SHA256_Update(crypto_hash_sha256_state *, const void *, size_t);
void _SHA256_Final(unsigned char [32], crypto_hash_sha256_state *);

View File

@ -33,20 +33,17 @@
#include <stdint.h>
typedef struct SHA256Context {
uint32_t state[8];
uint32_t count[2];
unsigned char buf[64];
} SHA256_CTX;
#include "crypto_hash_sha256.h"
typedef struct HMAC_SHA256Context {
SHA256_CTX ictx;
SHA256_CTX octx;
crypto_hash_sha256_state ictx;
crypto_hash_sha256_state octx;
} HMAC_SHA256_CTX;
void _SHA256_Init(SHA256_CTX *);
void _SHA256_Update(SHA256_CTX *, const void *, size_t);
void _SHA256_Final(unsigned char [32], SHA256_CTX *);
void _SHA256_Init(crypto_hash_sha256_state *);
void _SHA256_Update(crypto_hash_sha256_state *, const void *, size_t);
void _SHA256_Final(unsigned char [32], crypto_hash_sha256_state *);
void HMAC__SHA256_Init(HMAC_SHA256_CTX *, const void *, size_t);
void HMAC__SHA256_Update(HMAC_SHA256_CTX *, const void *, size_t);
void HMAC__SHA256_Final(unsigned char [32], HMAC_SHA256_CTX *);

View File

@ -2,6 +2,9 @@
#define crypto_hash_sha256_H
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include "export.h"
#define crypto_hash_sha256_BYTES 32U
@ -14,6 +17,12 @@
extern "C" {
#endif
typedef struct crypto_hash_sha256_state {
uint32_t state[8];
uint32_t count[2];
unsigned char buf[64];
} crypto_hash_sha256_state;
SODIUM_EXPORT
size_t crypto_hash_sha256_bytes(void);