2020-12-29 17:15:51 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* Copyright (c) 2014 Pieter Wuille *
|
|
|
|
* Distributed under the MIT software license, see the accompanying *
|
|
|
|
* file COPYING or https://www.opensource.org/licenses/mit-license.php.*
|
|
|
|
***********************************************************************/
|
2015-10-26 14:54:21 +00:00
|
|
|
|
2018-07-09 11:17:44 +00:00
|
|
|
#ifndef SECP256K1_HASH_H
|
|
|
|
#define SECP256K1_HASH_H
|
2015-10-26 14:54:21 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef struct {
|
2018-07-09 11:17:44 +00:00
|
|
|
uint32_t s[8];
|
2022-12-20 21:11:14 +00:00
|
|
|
unsigned char buf[64];
|
|
|
|
uint64_t bytes;
|
2023-03-17 05:22:01 +00:00
|
|
|
} rustsecp256k1_v0_8_1_sha256;
|
2015-10-26 14:54:21 +00:00
|
|
|
|
2023-03-17 05:22:01 +00:00
|
|
|
static void rustsecp256k1_v0_8_1_sha256_initialize(rustsecp256k1_v0_8_1_sha256 *hash);
|
|
|
|
static void rustsecp256k1_v0_8_1_sha256_write(rustsecp256k1_v0_8_1_sha256 *hash, const unsigned char *data, size_t size);
|
|
|
|
static void rustsecp256k1_v0_8_1_sha256_finalize(rustsecp256k1_v0_8_1_sha256 *hash, unsigned char *out32);
|
2015-10-26 14:54:21 +00:00
|
|
|
|
|
|
|
typedef struct {
|
2023-03-17 05:22:01 +00:00
|
|
|
rustsecp256k1_v0_8_1_sha256 inner, outer;
|
|
|
|
} rustsecp256k1_v0_8_1_hmac_sha256;
|
2015-10-26 14:54:21 +00:00
|
|
|
|
2023-03-17 05:22:01 +00:00
|
|
|
static void rustsecp256k1_v0_8_1_hmac_sha256_initialize(rustsecp256k1_v0_8_1_hmac_sha256 *hash, const unsigned char *key, size_t size);
|
|
|
|
static void rustsecp256k1_v0_8_1_hmac_sha256_write(rustsecp256k1_v0_8_1_hmac_sha256 *hash, const unsigned char *data, size_t size);
|
|
|
|
static void rustsecp256k1_v0_8_1_hmac_sha256_finalize(rustsecp256k1_v0_8_1_hmac_sha256 *hash, unsigned char *out32);
|
2015-10-26 14:54:21 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char v[32];
|
|
|
|
unsigned char k[32];
|
|
|
|
int retry;
|
2023-03-17 05:22:01 +00:00
|
|
|
} rustsecp256k1_v0_8_1_rfc6979_hmac_sha256;
|
2015-10-26 14:54:21 +00:00
|
|
|
|
2023-03-17 05:22:01 +00:00
|
|
|
static void rustsecp256k1_v0_8_1_rfc6979_hmac_sha256_initialize(rustsecp256k1_v0_8_1_rfc6979_hmac_sha256 *rng, const unsigned char *key, size_t keylen);
|
|
|
|
static void rustsecp256k1_v0_8_1_rfc6979_hmac_sha256_generate(rustsecp256k1_v0_8_1_rfc6979_hmac_sha256 *rng, unsigned char *out, size_t outlen);
|
|
|
|
static void rustsecp256k1_v0_8_1_rfc6979_hmac_sha256_finalize(rustsecp256k1_v0_8_1_rfc6979_hmac_sha256 *rng);
|
2015-10-26 14:54:21 +00:00
|
|
|
|
2018-07-09 11:17:44 +00:00
|
|
|
#endif /* SECP256K1_HASH_H */
|