1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

update trezor-crypto, adapt firmware to to changes

This commit is contained in:
Pavol Rusnak 2018-01-13 15:20:10 +01:00
parent 7e382fb790
commit c4e3596803
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
9 changed files with 8 additions and 42 deletions

View File

@ -63,12 +63,11 @@ CFLAGS += $(OPTFLAGS) \
$(FPUFLAGS) \
-DSTM32F2 \
-DCONFIDENTIAL='__attribute__((section("confidential")))' \
-DRAND_PLATFORM_INDEPENDENT=1 \
-I$(TOOLCHAIN_DIR)/include \
-I$(TOP_DIR) \
-I$(TOP_DIR)gen \
-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
LDFLAGS += -L$(TOP_DIR) \

View File

@ -40,6 +40,7 @@ OBJS += ../vendor/trezor-crypto/ecdsa.o
OBJS += ../vendor/trezor-crypto/curves.o
OBJS += ../vendor/trezor-crypto/secp256k1.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-helpers.o

View File

@ -22,7 +22,7 @@
#include "sha2.h"
#include "ripemd160.h"
#include "pbkdf2.h"
#include "aes.h"
#include "aes/aes.h"
#include "hmac.h"
#include "bip32.h"
#include "layout.h"

View File

@ -42,7 +42,7 @@
#include "usb.h"
#include "util.h"
#include "signing.h"
#include "aes.h"
#include "aes/aes.h"
#include "hmac.h"
#include "crypto.h"
#include "base58.h"

View File

@ -19,7 +19,7 @@
#include "nem2.h"
#include "aes.h"
#include "aes/aes.h"
#include "fsm.h"
#include "gettext.h"
#include "layout2.h"

View File

@ -26,7 +26,7 @@
#include "trezor.h"
#include "sha2.h"
#include "aes.h"
#include "aes/aes.h"
#include "pbkdf2.h"
#include "bip32.h"
#include "bip39.h"

28
rng.c
View File

@ -36,31 +36,3 @@ uint32_t random32(void)
return new;
}
#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
View File

@ -20,12 +20,6 @@
#ifndef __RNG_H__
#define __RNG_H__
#include <stdint.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);
#include "rand.h"
#endif

@ -1 +1 @@
Subproject commit 74e74f5eed886ff871dc1fb36088e4b465917689
Subproject commit 0d8a3beeaf22af837f558a5b5e9ae98cdd47a767