diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-09-28 23:46:17 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-09-28 23:46:38 +0800 |
commit | 1d20b0247c35f440d3fdc3d21de19b2d5256c3cf (patch) | |
tree | be0bce533d5d476e4f408d1d7757b9ac416463ae /crypto/secp256k1/libsecp256k1/src/hash.h | |
parent | 7977e87ce1e9ec46a8e8275f4cf53b6281c412c7 (diff) | |
download | go-tangerine-1d20b0247c35f440d3fdc3d21de19b2d5256c3cf.tar go-tangerine-1d20b0247c35f440d3fdc3d21de19b2d5256c3cf.tar.gz go-tangerine-1d20b0247c35f440d3fdc3d21de19b2d5256c3cf.tar.bz2 go-tangerine-1d20b0247c35f440d3fdc3d21de19b2d5256c3cf.tar.lz go-tangerine-1d20b0247c35f440d3fdc3d21de19b2d5256c3cf.tar.xz go-tangerine-1d20b0247c35f440d3fdc3d21de19b2d5256c3cf.tar.zst go-tangerine-1d20b0247c35f440d3fdc3d21de19b2d5256c3cf.zip |
Update libsecp256k1
Diffstat (limited to 'crypto/secp256k1/libsecp256k1/src/hash.h')
-rw-r--r-- | crypto/secp256k1/libsecp256k1/src/hash.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/crypto/secp256k1/libsecp256k1/src/hash.h b/crypto/secp256k1/libsecp256k1/src/hash.h new file mode 100644 index 000000000..0ff01e63f --- /dev/null +++ b/crypto/secp256k1/libsecp256k1/src/hash.h @@ -0,0 +1,41 @@ +/********************************************************************** + * Copyright (c) 2014 Pieter Wuille * + * Distributed under the MIT software license, see the accompanying * + * file COPYING or http://www.opensource.org/licenses/mit-license.php.* + **********************************************************************/ + +#ifndef _SECP256K1_HASH_ +#define _SECP256K1_HASH_ + +#include <stdlib.h> +#include <stdint.h> + +typedef struct { + uint32_t s[32]; + uint32_t buf[16]; /* In big endian */ + size_t bytes; +} secp256k1_sha256_t; + +static void secp256k1_sha256_initialize(secp256k1_sha256_t *hash); +static void secp256k1_sha256_write(secp256k1_sha256_t *hash, const unsigned char *data, size_t size); +static void secp256k1_sha256_finalize(secp256k1_sha256_t *hash, unsigned char *out32); + +typedef struct { + secp256k1_sha256_t inner, outer; +} secp256k1_hmac_sha256_t; + +static void secp256k1_hmac_sha256_initialize(secp256k1_hmac_sha256_t *hash, const unsigned char *key, size_t size); +static void secp256k1_hmac_sha256_write(secp256k1_hmac_sha256_t *hash, const unsigned char *data, size_t size); +static void secp256k1_hmac_sha256_finalize(secp256k1_hmac_sha256_t *hash, unsigned char *out32); + +typedef struct { + unsigned char v[32]; + unsigned char k[32]; + int retry; +} secp256k1_rfc6979_hmac_sha256_t; + +static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256_t *rng, const unsigned char *key, size_t keylen); +static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256_t *rng, unsigned char *out, size_t outlen); +static void secp256k1_rfc6979_hmac_sha256_finalize(secp256k1_rfc6979_hmac_sha256_t *rng); + +#endif |