bip39 updates + tweaks
This commit is contained in:
@@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#if USE_BIP39_CACHE
|
#if USE_BIP39_CACHE
|
||||||
|
|
||||||
|
int BIP39_WORDS = 2048;
|
||||||
|
|
||||||
static int bip39_cache_index = 0;
|
static int bip39_cache_index = 0;
|
||||||
|
|
||||||
static CONFIDENTIAL struct {
|
static CONFIDENTIAL struct {
|
||||||
|
|||||||
@@ -24,10 +24,8 @@
|
|||||||
#ifndef __BIP39_H__
|
#ifndef __BIP39_H__
|
||||||
#define __BIP39_H__
|
#define __BIP39_H__
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define BIP39_WORDS 2048
|
|
||||||
#define BIP39_PBKDF2_ROUNDS 2048
|
#define BIP39_PBKDF2_ROUNDS 2048
|
||||||
|
|
||||||
const char *mnemonic_generate(int strength); // strength in bits
|
const char *mnemonic_generate(int strength); // strength in bits
|
||||||
@@ -39,14 +37,8 @@ int mnemonic_check(const char *mnemonic);
|
|||||||
int mnemonic_to_entropy(const char *mnemonic, uint8_t *entropy);
|
int mnemonic_to_entropy(const char *mnemonic, uint8_t *entropy);
|
||||||
|
|
||||||
// passphrase must be at most 256 characters otherwise it would be truncated
|
// passphrase must be at most 256 characters otherwise it would be truncated
|
||||||
void mnemonic_to_seed(const char *mnemonic, const char *passphrase,
|
void mnemonic_to_seed(const char *mnemonic, const char *passphrase, uint8_t seed[512 / 8], void (*progress_callback)(uint32_t current, uint32_t total));
|
||||||
uint8_t seed[512 / 8],
|
|
||||||
void (*progress_callback)(uint32_t current,
|
|
||||||
uint32_t total));
|
|
||||||
|
|
||||||
int mnemonic_find_word(const char *word);
|
const char * const *mnemonic_wordlist(void);
|
||||||
const char *mnemonic_complete_word(const char *prefix, int len);
|
|
||||||
const char *mnemonic_get_word(int index);
|
|
||||||
uint32_t mnemonic_word_completion_mask(const char *prefix, int len);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -37,24 +37,16 @@ typedef struct _HMAC_SHA512_CTX {
|
|||||||
SHA512_CTX ctx;
|
SHA512_CTX ctx;
|
||||||
} HMAC_SHA512_CTX;
|
} HMAC_SHA512_CTX;
|
||||||
|
|
||||||
void hmac_sha256_Init(HMAC_SHA256_CTX *hctx, const uint8_t *key,
|
void hmac_sha256_Init(HMAC_SHA256_CTX *hctx, const uint8_t *key, const uint32_t keylen);
|
||||||
const uint32_t keylen);
|
void hmac_sha256_Update(HMAC_SHA256_CTX *hctx, const uint8_t *msg, const uint32_t msglen);
|
||||||
void hmac_sha256_Update(HMAC_SHA256_CTX *hctx, const uint8_t *msg,
|
|
||||||
const uint32_t msglen);
|
|
||||||
void hmac_sha256_Final(HMAC_SHA256_CTX *hctx, uint8_t *hmac);
|
void hmac_sha256_Final(HMAC_SHA256_CTX *hctx, uint8_t *hmac);
|
||||||
void hmac_sha256(const uint8_t *key, const uint32_t keylen, const uint8_t *msg,
|
void hmac_sha256(const uint8_t *key, const uint32_t keylen, const uint8_t *msg, const uint32_t msglen, uint8_t *hmac);
|
||||||
const uint32_t msglen, uint8_t *hmac);
|
void hmac_sha256_prepare(const uint8_t *key, const uint32_t keylen, uint32_t *opad_digest, uint32_t *ipad_digest);
|
||||||
void hmac_sha256_prepare(const uint8_t *key, const uint32_t keylen,
|
|
||||||
uint32_t *opad_digest, uint32_t *ipad_digest);
|
|
||||||
|
|
||||||
void hmac_sha512_Init(HMAC_SHA512_CTX *hctx, const uint8_t *key,
|
void hmac_sha512_Init(HMAC_SHA512_CTX *hctx, const uint8_t *key, const uint32_t keylen);
|
||||||
const uint32_t keylen);
|
void hmac_sha512_Update(HMAC_SHA512_CTX *hctx, const uint8_t *msg, const uint32_t msglen);
|
||||||
void hmac_sha512_Update(HMAC_SHA512_CTX *hctx, const uint8_t *msg,
|
|
||||||
const uint32_t msglen);
|
|
||||||
void hmac_sha512_Final(HMAC_SHA512_CTX *hctx, uint8_t *hmac);
|
void hmac_sha512_Final(HMAC_SHA512_CTX *hctx, uint8_t *hmac);
|
||||||
void hmac_sha512(const uint8_t *key, const uint32_t keylen, const uint8_t *msg,
|
void hmac_sha512(const uint8_t *key, const uint32_t keylen, const uint8_t *msg, const uint32_t msglen, uint8_t *hmac);
|
||||||
const uint32_t msglen, uint8_t *hmac);
|
void hmac_sha512_prepare(const uint8_t *key, const uint32_t keylen, uint64_t *opad_digest, uint64_t *ipad_digest);
|
||||||
void hmac_sha512_prepare(const uint8_t *key, const uint32_t keylen,
|
|
||||||
uint64_t *opad_digest, uint64_t *ipad_digest);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,24 +43,14 @@ typedef struct _PBKDF2_HMAC_SHA512_CTX {
|
|||||||
char first;
|
char first;
|
||||||
} PBKDF2_HMAC_SHA512_CTX;
|
} PBKDF2_HMAC_SHA512_CTX;
|
||||||
|
|
||||||
void pbkdf2_hmac_sha256_Init(PBKDF2_HMAC_SHA256_CTX *pctx, const uint8_t *pass,
|
void pbkdf2_hmac_sha256_Init(PBKDF2_HMAC_SHA256_CTX *pctx, const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen, uint32_t blocknr);
|
||||||
int passlen, const uint8_t *salt, int saltlen,
|
void pbkdf2_hmac_sha256_Update(PBKDF2_HMAC_SHA256_CTX *pctx, uint32_t iterations);
|
||||||
uint32_t blocknr);
|
|
||||||
void pbkdf2_hmac_sha256_Update(PBKDF2_HMAC_SHA256_CTX *pctx,
|
|
||||||
uint32_t iterations);
|
|
||||||
void pbkdf2_hmac_sha256_Final(PBKDF2_HMAC_SHA256_CTX *pctx, uint8_t *key);
|
void pbkdf2_hmac_sha256_Final(PBKDF2_HMAC_SHA256_CTX *pctx, uint8_t *key);
|
||||||
void pbkdf2_hmac_sha256(const uint8_t *pass, int passlen, const uint8_t *salt,
|
void pbkdf2_hmac_sha256(const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key, int keylen);
|
||||||
int saltlen, uint32_t iterations, uint8_t *key,
|
|
||||||
int keylen);
|
|
||||||
|
|
||||||
void pbkdf2_hmac_sha512_Init(PBKDF2_HMAC_SHA512_CTX *pctx, const uint8_t *pass,
|
void pbkdf2_hmac_sha512_Init(PBKDF2_HMAC_SHA512_CTX *pctx, const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen, uint32_t blocknr);
|
||||||
int passlen, const uint8_t *salt, int saltlen,
|
void pbkdf2_hmac_sha512_Update(PBKDF2_HMAC_SHA512_CTX *pctx, uint32_t iterations);
|
||||||
uint32_t blocknr);
|
|
||||||
void pbkdf2_hmac_sha512_Update(PBKDF2_HMAC_SHA512_CTX *pctx,
|
|
||||||
uint32_t iterations);
|
|
||||||
void pbkdf2_hmac_sha512_Final(PBKDF2_HMAC_SHA512_CTX *pctx, uint8_t *key);
|
void pbkdf2_hmac_sha512_Final(PBKDF2_HMAC_SHA512_CTX *pctx, uint8_t *key);
|
||||||
void pbkdf2_hmac_sha512(const uint8_t *pass, int passlen, const uint8_t *salt,
|
void pbkdf2_hmac_sha512(const uint8_t *pass, int passlen, const uint8_t *salt, int saltlen, uint32_t iterations, uint8_t *key, int keylen);
|
||||||
int saltlen, uint32_t iterations, uint8_t *key,
|
|
||||||
int keylen);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user