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

vendor: update trezor-crypto, adapt codebase to changes

This commit is contained in:
Pavol Rusnak 2018-01-13 15:28:35 +01:00
parent d11bbde2e1
commit 1530afe4ad
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
7 changed files with 4 additions and 46 deletions

View File

@ -11,8 +11,6 @@ SOURCE_MOD = []
CCFLAGS_MOD += '-Wno-sequence-point '
CPPPATH_MOD += [
'vendor/trezor-crypto',
'vendor/trezor-crypto/aes',
'vendor/trezor-crypto/ed25519-donna',
]
CPPDEFINES_MOD += [
'AES_128',

View File

@ -11,8 +11,6 @@ SOURCE_MOD = []
CCFLAGS_MOD += '-Wno-sequence-point '
CPPPATH_MOD += [
'vendor/trezor-crypto',
'vendor/trezor-crypto/aes',
'vendor/trezor-crypto/ed25519-donna',
]
CPPDEFINES_MOD += [
'AES_128',

View File

@ -18,12 +18,11 @@ SOURCE_MOD += [
CCFLAGS_MOD += '-Wno-sequence-point '
CPPPATH_MOD += [
'vendor/trezor-crypto',
'vendor/trezor-crypto/aes',
'vendor/trezor-crypto/ed25519-donna',
]
CPPDEFINES_MOD += [
'AES_128',
'AES_192',
'RAND_PLATFORM_INDEPENDENT',
('USE_KECCAK', '1'),
('USE_ETHEREUM', '1'),
]
@ -63,6 +62,7 @@ SOURCE_MOD += [
'vendor/trezor-crypto/hmac.c',
'vendor/trezor-crypto/nist256p1.c',
'vendor/trezor-crypto/pbkdf2.c',
'vendor/trezor-crypto/rand.c',
'vendor/trezor-crypto/ripemd160.c',
'vendor/trezor-crypto/secp256k1.c',
'vendor/trezor-crypto/sha2.c',

View File

@ -19,8 +19,6 @@ SOURCE_MOD += [
CCFLAGS_MOD += '-Wno-sequence-point '
CPPPATH_MOD += [
'vendor/trezor-crypto',
'vendor/trezor-crypto/aes',
'vendor/trezor-crypto/ed25519-donna',
]
CPPDEFINES_MOD += [
'AES_128',
@ -31,7 +29,6 @@ CPPDEFINES_MOD += [
SOURCE_MOD += [
'embed/extmod/modtrezorcrypto/modtrezorcrypto.c',
'embed/extmod/modtrezorcrypto/crc.c',
'embed/extmod/modtrezorcrypto/rand.c',
'vendor/trezor-crypto/address.c',
'vendor/trezor-crypto/aes/aescrypt.c',
'vendor/trezor-crypto/aes/aeskey.c',
@ -64,6 +61,7 @@ SOURCE_MOD += [
'vendor/trezor-crypto/hmac.c',
'vendor/trezor-crypto/nist256p1.c',
'vendor/trezor-crypto/pbkdf2.c',
'vendor/trezor-crypto/rand.c',
'vendor/trezor-crypto/ripemd160.c',
'vendor/trezor-crypto/secp256k1.c',
'vendor/trezor-crypto/sha2.c',

View File

@ -12,21 +12,3 @@ uint32_t random32(void)
{
return rng_get();
}
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;
}
}

View File

@ -1,18 +0,0 @@
/*
* Copyright (c) Pavol Rusnak, SatoshiLabs
*
* Licensed under TREZOR License
* see LICENSE file for details
*/
#ifndef __RAND_H__
#define __RAND_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);
#endif

@ -1 +1 @@
Subproject commit 8d8bc9c762b504ee8c66f94d93600d417d92841e
Subproject commit 0d8a3beeaf22af837f558a5b5e9ae98cdd47a767