mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-12 02:43:42 +00:00
68d4991da1
This working implementation for the ATECCx08 family of cryptgraphic processors has random number generation and other needed supporting functions. It also includes a sample of how to connect it to the Go crypto/rand package. More cryptographic functions await a future interation. Signed-off-by: deadprogram <ron@hybridgroup.com>
40 lines
677 B
Go
40 lines
677 B
Go
package ateccx08
|
|
|
|
const (
|
|
// Address is default I2C address.
|
|
Address = 0x60
|
|
)
|
|
|
|
const (
|
|
ATECCNone = 0
|
|
ATECC508 = 0x5000
|
|
ATECC608 = 0x6000
|
|
)
|
|
|
|
const (
|
|
cmdAddress = 0x03
|
|
cmdCounter = 0x24
|
|
cmdGenKey = 0x40
|
|
cmdInfo = 0x30
|
|
cmdLock = 0x17
|
|
cmdNonce = 0x16
|
|
cmdRandom = 0x1B
|
|
cmdSHA = 0x47
|
|
cmdSign = 0x41
|
|
cmdWrite = 0x12
|
|
cmdRead = 0x02
|
|
)
|
|
|
|
const (
|
|
StatusSuccess = 0x00
|
|
StatusMiscompare = 0x01
|
|
StatusParseError = 0x03
|
|
StatusECCFault = 0x05
|
|
StatusSelfTestError = 0x07
|
|
StatusHealthTestError = 0x08
|
|
StatusExecutionError = 0x0f
|
|
StatusAfterWake = 0x11
|
|
StatusWatchdogExpire = 0xee
|
|
StatusCRCError = 0xff
|
|
)
|