1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

chore(crypto): Rename wordlist to slip39_wordlist and add include guards.

This commit is contained in:
Andrew Kozlik 2020-12-02 16:20:11 +01:00 committed by Andrew Kozlik
parent aeb021b159
commit e615fc6263
2 changed files with 9 additions and 4 deletions

View File

@ -37,7 +37,7 @@ const char* get_word(uint16_t index) {
return NULL;
}
return wordlist[index];
return slip39_wordlist[index];
}
/**
@ -51,13 +51,13 @@ bool word_index(uint16_t* index, const char* word, uint8_t word_length) {
while ((hi - lo) > 1) {
mid = (hi + lo) / 2;
if (strncmp(wordlist[mid], word, word_length) > 0) {
if (strncmp(slip39_wordlist[mid], word, word_length) > 0) {
hi = mid;
} else {
lo = mid;
}
}
if (strncmp(wordlist[lo], word, word_length) != 0) {
if (strncmp(slip39_wordlist[lo], word, word_length) != 0) {
return false;
}
*index = lo;

View File

@ -22,11 +22,14 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __SLIP39_WORDLIST_H__
#define __SLIP39_WORDLIST_H__
#include <stdint.h>
#define WORDS_COUNT 1024
static const char* const wordlist[WORDS_COUNT] = {
static const char* const slip39_wordlist[WORDS_COUNT] = {
"academic", "acid", "acne", "acquire", "acrobat", "activity",
"actress", "adapt", "adequate", "adjust", "admit", "adorn",
"adult", "advance", "advocate", "afraid", "again", "agency",
@ -1236,3 +1239,5 @@ static const uint16_t words_button_seq[WORDS_COUNT] = {
9641, // yoga
9376, // zero
};
#endif