mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-13 17:00:59 +00:00
update trezor-crypto, adapt firmware to to changes
This commit is contained in:
parent
7e382fb790
commit
c4e3596803
@ -63,12 +63,11 @@ CFLAGS += $(OPTFLAGS) \
|
|||||||
$(FPUFLAGS) \
|
$(FPUFLAGS) \
|
||||||
-DSTM32F2 \
|
-DSTM32F2 \
|
||||||
-DCONFIDENTIAL='__attribute__((section("confidential")))' \
|
-DCONFIDENTIAL='__attribute__((section("confidential")))' \
|
||||||
|
-DRAND_PLATFORM_INDEPENDENT=1 \
|
||||||
-I$(TOOLCHAIN_DIR)/include \
|
-I$(TOOLCHAIN_DIR)/include \
|
||||||
-I$(TOP_DIR) \
|
-I$(TOP_DIR) \
|
||||||
-I$(TOP_DIR)gen \
|
-I$(TOP_DIR)gen \
|
||||||
-I$(TOP_DIR)vendor/trezor-crypto \
|
-I$(TOP_DIR)vendor/trezor-crypto \
|
||||||
-I$(TOP_DIR)vendor/trezor-crypto/aes \
|
|
||||||
-I$(TOP_DIR)vendor/trezor-crypto/ed25519-donna \
|
|
||||||
-I$(TOP_DIR)vendor/trezor-qrenc
|
-I$(TOP_DIR)vendor/trezor-qrenc
|
||||||
|
|
||||||
LDFLAGS += -L$(TOP_DIR) \
|
LDFLAGS += -L$(TOP_DIR) \
|
||||||
|
@ -40,6 +40,7 @@ OBJS += ../vendor/trezor-crypto/ecdsa.o
|
|||||||
OBJS += ../vendor/trezor-crypto/curves.o
|
OBJS += ../vendor/trezor-crypto/curves.o
|
||||||
OBJS += ../vendor/trezor-crypto/secp256k1.o
|
OBJS += ../vendor/trezor-crypto/secp256k1.o
|
||||||
OBJS += ../vendor/trezor-crypto/nist256p1.o
|
OBJS += ../vendor/trezor-crypto/nist256p1.o
|
||||||
|
OBJS += ../vendor/trezor-crypto/rand.o
|
||||||
|
|
||||||
OBJS += ../vendor/trezor-crypto/ed25519-donna/curve25519-donna-32bit.o
|
OBJS += ../vendor/trezor-crypto/ed25519-donna/curve25519-donna-32bit.o
|
||||||
OBJS += ../vendor/trezor-crypto/ed25519-donna/curve25519-donna-helpers.o
|
OBJS += ../vendor/trezor-crypto/ed25519-donna/curve25519-donna-helpers.o
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "sha2.h"
|
#include "sha2.h"
|
||||||
#include "ripemd160.h"
|
#include "ripemd160.h"
|
||||||
#include "pbkdf2.h"
|
#include "pbkdf2.h"
|
||||||
#include "aes.h"
|
#include "aes/aes.h"
|
||||||
#include "hmac.h"
|
#include "hmac.h"
|
||||||
#include "bip32.h"
|
#include "bip32.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "signing.h"
|
#include "signing.h"
|
||||||
#include "aes.h"
|
#include "aes/aes.h"
|
||||||
#include "hmac.h"
|
#include "hmac.h"
|
||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
#include "base58.h"
|
#include "base58.h"
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "nem2.h"
|
#include "nem2.h"
|
||||||
|
|
||||||
#include "aes.h"
|
#include "aes/aes.h"
|
||||||
#include "fsm.h"
|
#include "fsm.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "layout2.h"
|
#include "layout2.h"
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "trezor.h"
|
#include "trezor.h"
|
||||||
#include "sha2.h"
|
#include "sha2.h"
|
||||||
#include "aes.h"
|
#include "aes/aes.h"
|
||||||
#include "pbkdf2.h"
|
#include "pbkdf2.h"
|
||||||
#include "bip32.h"
|
#include "bip32.h"
|
||||||
#include "bip39.h"
|
#include "bip39.h"
|
||||||
|
28
rng.c
28
rng.c
@ -36,31 +36,3 @@ uint32_t random32(void)
|
|||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t random_uniform(uint32_t n)
|
|
||||||
{
|
|
||||||
uint32_t x, max = 0xFFFFFFFF - (0xFFFFFFFF % n);
|
|
||||||
while ((x = random32()) >= max);
|
|
||||||
return x / (max / n);
|
|
||||||
}
|
|
||||||
|
|
||||||
void random_buffer(uint8_t *buf, size_t len)
|
|
||||||
{
|
|
||||||
uint32_t r = 0;
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
|
||||||
if (i % 4 == 0) {
|
|
||||||
r = random32();
|
|
||||||
}
|
|
||||||
buf[i] = (r >> ((i % 4) * 8)) & 0xFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void random_permute(char *str, size_t len)
|
|
||||||
{
|
|
||||||
for (int i = len - 1; i >= 1; i--) {
|
|
||||||
int j = random_uniform(i + 1);
|
|
||||||
char t = str[j];
|
|
||||||
str[j] = str[i];
|
|
||||||
str[i] = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
8
rng.h
8
rng.h
@ -20,12 +20,6 @@
|
|||||||
#ifndef __RNG_H__
|
#ifndef __RNG_H__
|
||||||
#define __RNG_H__
|
#define __RNG_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "rand.h"
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
uint32_t random32(void);
|
|
||||||
uint32_t random_uniform(uint32_t n);
|
|
||||||
void random_buffer(uint8_t *buf, size_t len);
|
|
||||||
void random_permute(char *buf, size_t len);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
2
vendor/trezor-crypto
vendored
2
vendor/trezor-crypto
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 74e74f5eed886ff871dc1fb36088e4b465917689
|
Subproject commit 0d8a3beeaf22af837f558a5b5e9ae98cdd47a767
|
Loading…
Reference in New Issue
Block a user