Path: blob/master/external/source/exploits/CVE-2017-13861/sha256.h
19591 views
/*********************************************************************1* Filename: sha256.h2* Author: Brad Conte (brad AT bradconte.com)3* Copyright:4* Disclaimer: This code is presented "as is" without any guarantees.5* Details: Defines the API for the corresponding SHA1 implementation.6*********************************************************************/78#ifndef SHA256_H9#define SHA256_H1011/*************************** HEADER FILES ***************************/12#include <stddef.h>1314/****************************** MACROS ******************************/15#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest1617/**************************** DATA TYPES ****************************/18typedef unsigned char BYTE; // 8-bit byte19typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines2021typedef struct {22BYTE data[64];23WORD datalen;24unsigned long long bitlen;25WORD state[8];26} SHA256_CTX;2728/*********************** FUNCTION DECLARATIONS **********************/29void sha256_init(SHA256_CTX *ctx);30void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len);31void sha256_final(SHA256_CTX *ctx, BYTE hash[]);3233#endif // SHA256_H3435