Increase buffer size for non-pico.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-02-25 19:33:28 +01:00
parent 6b483029a5
commit 1be3691a95
5 changed files with 20 additions and 5 deletions

View File

@@ -21,6 +21,11 @@
#include "mbedtls/cmac.h"
#include "asn1.h"
#include "apdu.h"
#ifdef ENABLE_EMULATION
#include "usb/emulation/emulation.h"
#else
#include "usb/usb.h"
#endif
static uint8_t sm_nonce[8];
static uint8_t sm_kmac[16];
@@ -144,7 +149,7 @@ int sm_wrap() {
if (sm_indicator == 0) {
return PICOKEY_OK;
}
uint8_t input[2048];
uint8_t input[USB_BUFFER_SIZE];
size_t input_len = 0;
memset(input, 0, sizeof(input));
mbedtls_mpi ssc;
@@ -232,7 +237,7 @@ void sm_update_iv() {
}
int sm_verify() {
uint8_t input[2048];
uint8_t input[USB_BUFFER_SIZE];
memset(input, 0, sizeof(input));
uint16_t input_len = 0;
int r = 0;

View File

@@ -22,7 +22,11 @@
#if !defined(PICO_PLATFORM)
#define XIP_BASE 0
#define FLASH_SECTOR_SIZE 4096
#ifdef ENABLE_EMULATION
#define FLASH_SECTOR_SIZE 0x4000
#else
#define FLASH_SECTOR_SIZE 0x1000
#endif
#ifdef ESP_PLATFORM
uint32_t FLASH_SIZE_BYTES = (1 * 1024 * 1024);
#else

View File

@@ -58,7 +58,11 @@
#endif
#include "queue.h"
#endif
#define FLASH_SECTOR_SIZE 4096
#ifdef ENABLE_EMULATION
#define FLASH_SECTOR_SIZE 0x4000
#else
#define FLASH_SECTOR_SIZE 0x1000
#endif
#define XIP_BASE 0
int fd_map = 0;
uint8_t *map = NULL;

View File

@@ -24,7 +24,7 @@
#include "board.h"
#include <stdbool.h>
#define USB_BUFFER_SIZE 2048
#define USB_BUFFER_SIZE 4096
extern int emul_init(char *host, uint16_t port);
extern uint8_t emul_rx[USB_BUFFER_SIZE];
extern uint16_t emul_rx_size, emul_tx_size;

View File

@@ -106,7 +106,9 @@ extern void driver_exec_finished_emul(uint8_t itf, uint16_t size_next);
extern void driver_exec_finished_cont_emul(uint8_t itf, uint16_t size_next, uint16_t offset);
#endif
#ifndef USB_BUFFER_SIZE
#define USB_BUFFER_SIZE 2048
#endif
PACK(
typedef struct {