signatures working

vtcsec_summit
conor 2016-02-23 00:48:20 -05:00
rodzic 15c5f3e303
commit c922daff09
2 zmienionych plików z 25 dodań i 9 usunięć

Wyświetl plik

@ -59,11 +59,22 @@
// P2 is CRC or 0
#define ATECC_CMD_GENKEY 0x40
// P1
#define ATECC_GENKEY_PRIVATE 0x04
#define ATECC_GENKEY_PUBDIGEST 0x08
#define ATECC_GENKEY_PUBDIGEST2 0x10
// P2 is keyid
#define ATECC_CMD_NONCE 0x16
// P1
#define ATECC_NONCE_RNG_UPDATE 0x0
#define ATECC_NONCE_TEMP_UPDATE 0x3
// P2 is 0
#define ATECC_CMD_SIGN 0x41
// P1
#define ATECC_SIGN_INTERNAL 0x00
#define ATECC_SIGN_EXTERNAL 0x80
// P2 is keyid
struct atecc_response

Wyświetl plik

@ -49,12 +49,20 @@ int8_t test_ecc508a()
{
struct atecc_response res;
uint8_t buf[72];
atecc_send_recv(ATECC_CMD_RNG,
ATECC_RNG_P1, ATECC_RNG_P2, NULL, 0,
buf, sizeof(buf), &res);
flush_messages();
u2f_print("recv %bd bytes\r\n", res.len);
char digest[] = "4b3ed9de7155981804626b02432ad25e78003ce82ee61abe1b699b90bc195942";
atecc_send_recv(ATECC_CMD_NONCE,
ATECC_NONCE_TEMP_UPDATE, 0, digest, 32,
buf, sizeof(buf), &res);
dump_hex(res.buf, res.len);
atecc_send_recv(ATECC_CMD_SIGN,
ATECC_SIGN_EXTERNAL, 0, NULL, 0,
buf, sizeof(buf), &res);
dump_hex(res.buf, res.len);
return 0;
}
#define ms_since(ms,num) (((uint16_t)get_ms() - (ms)) >= num ? (1|(ms=(uint16_t)get_ms())):0)
@ -80,11 +88,7 @@ int16_t main(void) {
// Enable interrupts
IE_EA = 1;
u2f_print("U2F ZERO\r\n");
// smb_write(0, zeros, sizeof(zeros));
while (1) {
@ -133,6 +137,7 @@ int16_t main(void) {
winks = 0;
appdata.state = APP_NOTHING;
}
break;
case APP_ERROR:
u2f_print("error: %bx\r\n", appdata.error);
appdata.state = APP_NOTHING;