1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-12 18:49:07 +00:00

Reduced buffer sizes, moved static info to flash

This commit is contained in:
Jochen Hoenicke 2016-04-26 22:57:46 +02:00
parent 1b8bd1852e
commit 01ddb3ff66
3 changed files with 12 additions and 16 deletions

View File

@ -41,7 +41,7 @@
// About 1/2 Second according to values used in protect.c
#define U2F_TIMEOUT 840000/2
#define U2F_OUT_PKT_BUFFER_LEN 128
#define U2F_OUT_PKT_BUFFER_LEN 16
// Initialise without a cid
static uint32_t cid = CID_BROADCAST;
@ -171,7 +171,7 @@ void u2fhid_read(const U2FHID_FRAME *f)
static uint8_t seq, cmd;
static uint32_t len;
static uint8_t *buf_ptr;
static uint8_t buf[7609];
static uint8_t buf[57+7*59];
if ((f->cid != CID_BROADCAST) && (f->cid != cid)) {
return; // Not for us
@ -291,7 +291,7 @@ void u2fhid_init(const U2FHID_INIT_REQ *init_req)
f.cid = CID_BROADCAST;
f.init.cmd = U2FHID_INIT;
f.init.bcnth = 0;
f.init.bcntl = sizeof(U2FHID_INIT_RESP);
f.init.bcntl = U2FHID_INIT_RESP_SIZE;
memcpy(resp->nonce, init_req->nonce, sizeof(init_req->nonce));
resp->cid = next_cid();

View File

@ -120,6 +120,8 @@ extern "C"
uint8_t capFlags; // Capabilities flags
} U2FHID_INIT_RESP;
#define U2FHID_INIT_RESP_SIZE 17
// Low-level error codes. Return as negatives.
#define ERR_NONE 0x00 // No error

View File

@ -3,20 +3,14 @@
#include <stdint.h>
uint8_t U2F_ATT_PRIV_KEY[] = {0x71, 0x26, 0xac, 0x2b, 0xf6, 0x44, 0xdc, 0x61,
0x86, 0xad, 0x83, 0xef, 0x1f, 0xcd, 0xf1, 0x2a,
0x57, 0xb5, 0xcf, 0xa2, 0x00, 0x0b, 0x8a, 0xd0,
0x27, 0xe9, 0x56, 0xe8, 0x54, 0xc5, 0x0a, 0x8b};
const uint8_t U2F_ATT_PRIV_KEY[] = {
0x71, 0x26, 0xac, 0x2b, 0xf6, 0x44, 0xdc, 0x61,
0x86, 0xad, 0x83, 0xef, 0x1f, 0xcd, 0xf1, 0x2a,
0x57, 0xb5, 0xcf, 0xa2, 0x00, 0x0b, 0x8a, 0xd0,
0x27, 0xe9, 0x56, 0xe8, 0x54, 0xc5, 0x0a, 0x8b
};
uint8_t U2F_ATT_PUB_KEY[] = {
0x04, 0xd9, 0x18, 0xbd, 0xfa, 0x8a, 0x54, 0xac, 0x92, 0xe9, 0x0d,
0xa9, 0x1f, 0xca, 0x7a, 0xa2, 0x64, 0x54, 0xc0, 0xd1, 0x73, 0x36,
0x31, 0x4d, 0xde, 0x83, 0xa5, 0x4b, 0x86, 0xb5, 0xdf, 0x4e, 0xf0,
0x52, 0x65, 0x9a, 0x1d, 0x6f, 0xfc, 0xb7, 0x46, 0x7f, 0x1a, 0xcd,
0xdb, 0x8a, 0x33, 0x08, 0x0b, 0x5e, 0xed, 0x91, 0x89, 0x13, 0xf4,
0x43, 0xa5, 0x26, 0x1b, 0xc7, 0x7b, 0x68, 0x60, 0x6f, 0xc1};
uint8_t U2F_ATT_CERT[] = {
const uint8_t U2F_ATT_CERT[] = {
0x30, 0x82, 0x01, 0x19, 0x30, 0x81, 0xC0, 0x02, 0x09, 0x00, 0x8B, 0x3F,
0xA6, 0x46, 0xDE, 0x01, 0xCB, 0xB8, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86,
0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11,