View Source ATECC508A.DataZone (atecc508a v1.3.0)
This module handles operations on the data zone.
Summary
Functions
Lock the data and OTP zones.
Pad the passed in data to a multiple of 32-bytes
Pad the specified data to the exact size of the slot.
Read a slot
Return the size in bytes of the specified slot.
Write a slot in the data zone.
Write a slot in the data zone and pad to a multiple of 32-bytes
Functions
@spec lock(ATECC508A.Transport.t(), ATECC508A.crc16()) :: :ok | {:error, atom()}
Lock the data and OTP zones.
The expected contents concatenated together for the non-private key data slots and the OTP need to be passed for a CRC calculation. They are not written by design. The logic is that this is a final chance before it's too late to check that the device is programmed correctly.
Pad the passed in data to a multiple of 32-bytes
This is useful when 4-byte writes aren't allowed.
@spec pad_to_slot_size(ATECC508A.Request.slot(), binary()) :: binary()
Pad the specified data to the exact size of the slot.
@spec read(ATECC508A.Transport.t(), ATECC508A.Request.slot()) :: {:ok, binary()} | {:error, atom()}
Read a slot
@spec slot_size(ATECC508A.Request.slot()) :: 36 | 72 | 416
Return the size in bytes of the specified slot.
@spec write(ATECC508A.Transport.t(), ATECC508A.Request.slot(), binary()) :: :ok | {:error, atom()}
Write a slot in the data zone.
This can use 4 byte writes if the data is not a multiple of 32 bytes. These are only allowed under some conditions. Most notably, 4-byte writes aren't allowed when the data zone is UNLOCKED.
@spec write_padded(ATECC508A.Transport.t(), ATECC508A.Request.slot(), binary()) :: :ok | {:error, atom()}
Write a slot in the data zone and pad to a multiple of 32-bytes
This is useful to get around 32-byte write limitations. The padded bytes are set to 0.