Documentation ¶
Overview ¶
Package atecc608 supports communication with Microchip ATECC608A and ATECC608B secure elements.
Index ¶
Constants ¶
const ( CmdAddress = 0x03 CRC16Poly uint16 = 0x8005 )
const CmdMaxExecutionTime = (200 + 50) * time.Millisecond
Max command execution time in ms considering a Clock-Divider set to the default/recommended value of 0x00, (p66, Table 10-5, ATECC608A Full Datasheet).
Variables ¶
var ( I2CBus = 0 I2CAddress = 0x60 )
var Cmd = map[string]byte{
"AES": 0x51,
"CheckMac": 0x28,
"Counter": 0x24,
"DeriveKey": 0x1C,
"ECDH": 0x43,
"GenDig": 0x15,
"GenKey": 0x40,
"Info": 0x30,
"KDF": 0x56,
"Lock": 0x17,
"MAC": 0x08,
"Nonce": 0x16,
"PrivWrite": 0x46,
"Random": 0x1B,
"Read": 0x02,
"SecureBoot": 0x80,
"SelfTest": 0x77,
"Sign": 0x41,
"SHA": 0x47,
"UpdateExtra": 0x20,
"Verify": 0x45,
"Write": 0x12,
}
Cmd represents the list of supported command codes, (p65, 10.4.1. Command Summary, ATECC608A Full Datasheet).
var CmdExecutionTime = CmdMaxExecutionTime
CmdExecutionTime sets the wait time between command execution and result retrieval.
var Status = map[byte]string{
0x00: "successful command execution",
0x01: "checkmac or verify miscompare",
0x03: "parse error",
0x05: "ECC fault",
0x07: "self test error",
0x08: "health test error",
0x0f: "execution error",
0x11: "after wake, prior to first command",
0xee: "watchdog about to expire",
0xff: "CRC or other communications error",
}
Status represents the device status/error codes, (p64-65, Tab 10-3, ATECC608A Full Datasheet).
Functions ¶
func ExecuteCmd ¶
func ExecuteCmd(opcode byte, param1 [1]byte, param2 [2]byte, data []byte, wake bool) (res []byte, err error)
ExecuteCmd issues an ATECC command conforming to:
- p55, Table 9-1, ATECC508A Full Datasheet
- p63, Table 10-1, ATECC608A Full Datasheet
The wake flag results in the executed command to be issued individually within a Wake() and Idle() cycle, when the flag is false the caller must take care of waking/idling/sleeping according to its desired command sequence.
func Idle ¶
func Idle()
Idle puts the device in idle mode, (p50, Table 7-2, ATECC608A Full Datasheet).
func Info ¶
Info executes the info command and returns the device serial number and software revision.
Types ¶
This section is empty.