mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-03-26 00:28:15 -04:00
Introduce syscalls to change preloaded app
Introduce syscalls: - TK1_SYSCALL_PRELOAD_STORE - TK1_SYSCALL_PRELOAD_STORE_FIN - TK1_SYSCALL_PRELOAD_DELETE - TK1_SYSCALL_REG_MGMT = 11 Change preload_store_finalize() not to take USS arg. Unused for preloaded apps.
This commit is contained in:
parent
970668a47b
commit
dd147657a4
@ -75,8 +75,7 @@ int preload_store(struct partition_table *part_table, uint32_t offset,
|
||||
return flash_write_data(address, data, size);
|
||||
}
|
||||
|
||||
int preload_store_finalize(struct partition_table *part_table, bool use_uss,
|
||||
uint8_t *uss, size_t app_size, uint8_t to_slot)
|
||||
int preload_store_finalize(struct partition_table *part_table, size_t app_size, uint8_t to_slot)
|
||||
{
|
||||
/* Check if we are allowed to store */
|
||||
if (!mgmt_app_authenticate(&part_table->mgmt_app_data)) {
|
||||
@ -88,8 +87,6 @@ int preload_store_finalize(struct partition_table *part_table, bool use_uss,
|
||||
return -1;
|
||||
}
|
||||
|
||||
// TODO: Maybe add the uss fields
|
||||
|
||||
if (app_size == 0 || app_size > SIZE_PRE_LOADED_APP) {
|
||||
return -2;
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ bool preload_check_valid_app(struct partition_table *part_table,
|
||||
int preload_load(struct partition_table *part_table, uint8_t from_slot);
|
||||
int preload_store(struct partition_table *part_table, uint32_t offset,
|
||||
uint8_t *data, size_t size, uint8_t to_slot);
|
||||
int preload_store_finalize(struct partition_table *part_table, bool use_uss,
|
||||
uint8_t *uss, size_t app_size, uint8_t to_slot);
|
||||
int preload_store_finalize(struct partition_table *part_table, size_t app_size, uint8_t to_slot);
|
||||
int preload_delete(struct partition_table *part_table, uint8_t slot);
|
||||
|
||||
#endif
|
||||
|
@ -9,7 +9,9 @@
|
||||
#include <tkey/led.h>
|
||||
#include <tkey/lib.h>
|
||||
|
||||
#include "mgmt_app.h"
|
||||
#include "partition_table.h"
|
||||
#include "preload_app.h"
|
||||
#include "storage.h"
|
||||
|
||||
#include "../tk1/resetinfo.h"
|
||||
@ -71,6 +73,25 @@ int32_t syscall_handler(uint32_t number, uint32_t arg1, uint32_t arg2,
|
||||
// first word. Serial is kept secret to the device
|
||||
// app.
|
||||
return udi[0];
|
||||
|
||||
case TK1_SYSCALL_PRELOAD_DELETE:
|
||||
return preload_delete(&part_table, 1);
|
||||
|
||||
case TK1_SYSCALL_PRELOAD_STORE:
|
||||
// arg1 offset
|
||||
// arg2 data
|
||||
// arg3 size
|
||||
// always using slot 1
|
||||
return preload_store(&part_table, arg1, (uint8_t *)arg2, arg3, 1);
|
||||
|
||||
case TK1_SYSCALL_PRELOAD_STORE_FIN:
|
||||
// arg1 app_size
|
||||
// always using slot 1
|
||||
return preload_store_finalize(&part_table, arg1, 1);
|
||||
|
||||
case TK1_SYSCALL_REG_MGMT:
|
||||
return mgmt_app_register(&part_table);
|
||||
|
||||
default:
|
||||
assert(1 == 2);
|
||||
}
|
||||
|
@ -12,7 +12,11 @@ enum syscall_num {
|
||||
TK1_SYSCALL_READ_DATA = 5,
|
||||
TK1_SYSCALL_ERASE_DATA = 6,
|
||||
TK1_SYSCALL_GET_VIDPID = 7,
|
||||
TK1_SYSCALL_SET_LED = 10,
|
||||
TK1_SYSCALL_PRELOAD_STORE = 8,
|
||||
TK1_SYSCALL_PRELOAD_STORE_FIN = 9,
|
||||
TK1_SYSCALL_PRELOAD_DELETE = 10,
|
||||
TK1_SYSCALL_REG_MGMT = 11,
|
||||
TK1_SYSCALL_SET_LED = 30,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user