From 7e7b40b434aef2a6eeb7337044699572211ed79a Mon Sep 17 00:00:00 2001 From: Jochen Hoenicke Date: Sat, 14 Feb 2015 12:00:44 +0100 Subject: [PATCH] Make word list const This makes the pointers to the words constant. It moves 8kb from ram to flash. It changes the return type of mnemonic_wordlist() to reflect this change. Everyone calling it should also change the type to `const char * const *`. --- bip39.c | 2 +- bip39.h | 2 +- bip39_english.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bip39.c b/bip39.c index 019259386..7c7858580 100644 --- a/bip39.c +++ b/bip39.c @@ -155,7 +155,7 @@ void mnemonic_to_seed(const char *mnemonic, const char *passphrase, uint8_t seed pbkdf2_hmac_sha512((const uint8_t *)mnemonic, strlen(mnemonic), salt, saltlen, BIP39_PBKDF2_ROUNDS, seed, 512 / 8, progress_callback); } -const char **mnemonic_wordlist(void) +const char * const *mnemonic_wordlist(void) { return wordlist; } diff --git a/bip39.h b/bip39.h index cad7a66d3..fe4d99e8a 100644 --- a/bip39.h +++ b/bip39.h @@ -36,6 +36,6 @@ int mnemonic_check(const char *mnemonic); void mnemonic_to_seed(const char *mnemonic, const char *passphrase, uint8_t seed[512 / 8], void (*progress_callback)(uint32_t current, uint32_t total)); -const char **mnemonic_wordlist(void); +const char * const *mnemonic_wordlist(void); #endif diff --git a/bip39_english.h b/bip39_english.h index 4ecddba4b..233acc2f8 100644 --- a/bip39_english.h +++ b/bip39_english.h @@ -21,7 +21,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -const char *wordlist[] = { +const char * const wordlist[] = { "abandon", "ability", "able",