2018-06-05 19:22:40 +00:00
|
|
|
#ifndef BASE_HASH_CTXT_H
|
|
|
|
#define BASE_HASH_CTXT_H
|
|
|
|
|
|
|
|
#include "hash.h"
|
2020-07-08 14:59:32 +00:00
|
|
|
#include "system.h"
|
2018-06-05 19:22:40 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#if defined(CONF_OPENSSL)
|
2019-04-06 00:46:56 +00:00
|
|
|
#include <openssl/md5.h>
|
2018-06-05 19:22:40 +00:00
|
|
|
#include <openssl/sha.h>
|
2019-04-06 00:46:56 +00:00
|
|
|
#else
|
|
|
|
#include <engine/external/md5/md5.h>
|
2018-06-05 19:22:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONF_OPENSSL)
|
|
|
|
// SHA256_CTX is defined in <openssl/sha.h>
|
|
|
|
#else
|
|
|
|
typedef struct
|
|
|
|
{
|
2021-06-23 05:05:49 +00:00
|
|
|
uint64_t length;
|
2020-09-26 19:41:58 +00:00
|
|
|
uint32_t state[8];
|
|
|
|
uint32_t curlen;
|
|
|
|
unsigned char buf[64];
|
2018-06-05 19:22:40 +00:00
|
|
|
} SHA256_CTX;
|
2019-04-06 00:46:56 +00:00
|
|
|
typedef md5_state_t MD5_CTX;
|
2018-06-05 19:22:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void sha256_init(SHA256_CTX *ctxt);
|
|
|
|
void sha256_update(SHA256_CTX *ctxt, const void *data, size_t data_len);
|
|
|
|
SHA256_DIGEST sha256_finish(SHA256_CTX *ctxt);
|
|
|
|
|
2019-04-06 00:46:56 +00:00
|
|
|
void md5_init(MD5_CTX *ctxt);
|
|
|
|
void md5_update(MD5_CTX *ctxt, const void *data, size_t data_len);
|
|
|
|
MD5_DIGEST md5_finish(MD5_CTX *ctxt);
|
|
|
|
|
2018-06-05 19:22:40 +00:00
|
|
|
#endif // BASE_HASH_CTXT_H
|