[][src]Struct Rusty_CryptoAuthLib::ATECC608A

pub struct ATECC608A<I2C, DELAY, TIMER> {
    pub i2c: I2C,
    pub delay: DELAY,
    pub timer: TIMER,
    pub dev_addr: u8,
    // some fields omitted
}

ATECC680A driver

Fields

i2c: I2C

i2c Instance

delay: DELAY

delay timer instance

timer: TIMER

time instance

dev_addr: u8

device address

Implementations

impl<I2C, DELAY, TIMER, E> ATECC608A<I2C, DELAY, TIMER> where
    I2C: Read<Error = E> + Write<Error = E>,
    DELAY: DelayMs<u32> + DelayUs<u32>,
    TIMER: CountDown<Time = u32>, 
[src]

pub fn new(i2c: I2C, delay: DELAY, timer: TIMER) -> Result<Self, E>[src]

Creates a new ATECC608a driver.

pub fn wake(&mut self) -> Result<(), E>[src]

This method just writes a zero byte to the bus without reading data back. Its required in the 'wake-up routine'. Note - the sendpacket method is used wake the device properly.

pub fn idle(&mut self) -> Result<(), E>[src]

This method just writes a byte 0x02 to the bus and puts the device into idle mode. In idle mode, all subsequent I/O transitions are ignored until the next wake flag. The contents of TempKey and RNG Seed registers are retained.

pub fn sleep(&mut self) -> Result<(), E>[src]

This method just writes a byte 0x01 to the bus which sends the device into the low power or sleep mode and ignores all subsequent I/O transitions until the next wake flag. The entire volatile state of the device is reset.

pub fn send_packet(
    &mut self,
    packet: &[u8],
    texec: ATECC608A_EXECUTION_TIME
) -> Result<[u8; 151], StatusError>
[src]

A method for sending commands to the ATECC608A and retrieving the associated response.

Method arguments:

  • packet: data as slice of bytes.
  • texec: An enum that holds the max-execution time for the command.

Returns:

  • Either an array of size [u8;151]
    1. If byte[0] is 0x00, it indicates the successful execution of a command
    2. If byte[0] is !=0x00, it includes the response associated with respective command
  • If an error is encountered, it returns a struct containing the status error.

pub fn atcab_info_base(&mut self, param1: u8) -> Vec<u8, U10>[src]

This method crafts a 'INFO command' packet. The Info command is used to read the status and state of the device. This information is useful in determining errors or to operate various commands.

Method arguments:

  • param1: mode byte deteremines what kind of info will be returned. This implementation uses Revision mode of the Info command to read back the silicon revision of the device. This information is hard coded into the device. This information may or may not be the same as what is read back in the Revision bytes shown in the Configuration zone.

Returns:

  • A heapless Vec containing the serialized command packet bytes.

pub fn atcab_info(&mut self) -> Result<[u8; 4], &'static str>[src]

Returns a single 4-byte word representing the revision number of the device. Software should not depend on this value as it may change from time to time.

At the time of writing this, the Info command will return 0x00 0x00 0x60 0x02. For all versions of the ECC608A the 3rd byte will always be 0x60. The fourth byte will indicate the silicon revision.

Method arguments:

  • Takes none (but method can be extended if required)

Returns:

  • 4-byte revision info [00 00 60 vv] indicated by ATECC608A. vv is the most recent silicon version.

pub fn atcab_sha_base(&mut self, mode: u8, data: &[u8]) -> Vec<u8, U74>[src]

This method crafts a 'SHA command' packet.

Method arguments:

  • mode: a single byte to indicate whether SHA init, update or finalize states.
    • SHA_MODE_SHA256_END - 0x00
    • SHA_MODE_SHA256_START - 0x01
    • SHA_MODE_SHA256_UPDATE - 0x02
  • data: data as a slice of bytes.

Returns:

  • A heapless Vec containing the serialized command packet bytes.

pub fn atcab_sha(&mut self, data: &[u8]) -> Result<[u8; 32], &'static str>[src]

Computes a SHA-256 digest for general purpose use by the system. Calculation of a SHA-256 digest occurs in the following three steps:

  1. Start: Initialization of the SHA-256 calculation engine and initialization of the SHA context in memory. This mode does not accept any message bytes.
  2. Update: The command can be called a variable number of times with this mode to add bytes to the message. Each iteration of this mode must include a message of 64 bytes.
  3. End: The SHA-256 calculation is completed, and the resulting digest is placed into the output buffer. From 0 bytes to 63 bytes may be passed to the device for this mode.
  • This method performs all three steps.

Method arguments:

  • data: data as a slice of bytes

Returns:

  • a 32 byte digest if successful
  • an error string describing the error.

pub fn atcab_genkey_base(
    &mut self,
    mode: u16,
    key_id: u16,
    other_data: [u8; 3]
) -> Vec<u8, U12>
[src]

This methods crafts a GENKEY command packet

Method arguments:

  • mode: mode of operation, possible values 0x04, 0x0C. Public key is generated and output on the bus (always).
  • key_id: slot id in the data zone
  • other_data: In the private key- stored in TEMPKEY mode, GenKey command can be used to generate an ephemeral ECC private key and place it in SRAM where there is no limit on writing to a memory location. This key cannot be read out but may be used by the ECDH command. In this mode, the private Key is stored in TempKey and requires other_data to be [0x00, 0x00, 0x00]. other_data is not included in all other modes.

Returns:

  • A heapless Vec containing the serialized command packet bytes.

pub fn atcab_genkey(&mut self, key_id: u16) -> Result<[u8; 64], &'static str>[src]

This method creates a new random private key and writes that key into the slot specified by the key_id parameter. Returns a 64 byte Public Key - X and Y coordinates (32 bytes each) or a failure error string.

The private key stored in the designated slot can never be read (i.e. never leaves the device).

Method arguments:

  • key_id: slot id in the data zone

Returns:

  • a 64 byte array containing public keys X and Y coordinates, indicating the command’s success
  • or an error string, describing the error.

pub fn atcab_get_pubkey(
    &mut self,
    key_id: u16
) -> Result<[u8; 64], &'static str>
[src]

Generates an ECC public key based upon the private key stored in the slot defined by the key_id parameter. This mode of the command may be used to avoid storing the public key on the device at the expense of the time required to regenerate it.

Method arguments:

  • key_id: slot id of data zone

Returns:

  • a 64 byte array containing public keys X and Y coordinates, indicating the command’s success
  • or an error string, describing the error.

pub fn atcab_base_nonce(
    &mut self,
    mode: u16,
    zero: u16,
    num_in: &[u8]
) -> Vec<u8, U74>
[src]

This method crafts a NONCE command packet

Method arguments:

  • mode: random mode or fixed mode
    • for random, values can be 0x00 or 0x01
    • for fixed, values can be 0x3, 0x43, 0x83, 0x23, 0x63
  • zero:
    • for random, values can be [0x00, 0x00] or [0x80, 0x00]
    • for fixed, value is always [0x00, 0x00]
  • num_in:
    • for random, input is always 20 random bytes
    • for fixed, input is either 32 or 64 bytes

Returns:

  • A heapless Vec containing the serialized command packet bytes.

pub fn atcab_nonce_load(
    &mut self,
    target: u16,
    num_in: &[u8]
) -> Result<[u8; 3], &'static str>
[src]

This method passes a fixed nonce (num_in) to the device and stores it in the Message Digest Buffer. The size of the nonce may be either 32 or 64 bytes. This mode of the Nonce command does not run a SHA256 calculation or generate a random number.

Method arguments -

  • target: where to load the fixed nonce - TEMPKEY or Message Digest Buffer
  • num_in: The size of the nonce may be either 32 or 64 bytes. This mode of the Nonce command does not run a SHA256 calculation or generate a random number.

Returns:

  • a 1-byte response - 0x00 (along with 2 CRC bytes) if the command is completed successfully.
  • Otherwise an error string is received.

pub fn atcab_nonce(&mut self, num_in: &[u8]) -> Result<[u8; 3], &'static str>[src]

The Nonce command generates a nonce (Number used Once) for use by a subsequent command by combining a random number (which can be generated internally or externally) with an input value from the system. The resulting nonce is stored internally in three possible buffers: TempKey, Message Digest Buffer, and Alternate Key Buffer. Instead of generating a nonce, a value may be passed to the device if so desired.

This method passes a fixed nonce (num_in) to the device and stores it in TempKey buffer. The size of the nonce should be 32 bytes. This mode of the Nonce command does not run a SHA256 calculation or generate a random number.

Method arguments -

  • num_in: The size of the nonce may be either 32 bytes. This mode of the Nonce command does not run a SHA256 calculation or generate a random number.

Returns:

  • a 1-byte response - 0x00 (along with 2 CRC bytes) if the command is completed successfully.
  • Otherwise an error string is received.

pub fn atcab_challenge(
    &mut self,
    num_in: &[u8]
) -> Result<[u8; 3], &'static str>
[src]

Same as atcab_nonce(..) i.e. fixed nonce.

pub fn atcab_nonce_rand(
    &mut self,
    out_type: u16,
    num_in: &[u8]
) -> Result<[u8; 32], &'static str>
[src]

When the Nonce command is run in Random mode, it generates a new nonce based on the input values. If out_type is 0x0000, then a new random number is generated based on the internal RNG. If out_type is 0x0080, a value stored in TempKey is used to generate a new nonce instead and the random number generator is not run. TempKey must be valid prior to running the Nonce command in this case.

This method passes a random 20-byte (num_in) number to the ATECC device and 16-bit u8 which can only assume one of 2 values. (i.e. valid out_type can either be 0x0000 or 0x0080). The device combines it with an internally generated random number or the previous TEMPKEY (depending on the out_type) value. This combined value along with the following NONCE command parameters - OPCODE, MODE, LSB of out_type are hashed (SHA256) to produce the random nonce. This result is stored in TEMPKEY.

Method arguments:

  • out_type: If out_type is 0x0000, then a new random number is generated based on the internal RNG. If out_type is 0x0080, a value stored in TempKey is used to generate a new nonce instead and the random number generator is not run.
  • num_in: a random 20-byte number is passed to the ATECC device

Returns:

  • if the out_type is 0x0000, it returns the 32-byte random number used to calculate the nonce.
  • if the out_type is 0x0080, it returns the 32-byte Nonce (i.e. new TEMPKEY value)

pub fn atcab_challenge_seed_update(
    &mut self,
    num_in: &[u8]
) -> Result<[u8; 32], &'static str>
[src]

Same as atcab_nonce_rand(..), except for the response. This method does not take a out_type parameter. So, the response is a 32 byte random number used to calculate the nonce (assuming the NONCE command executes successfully).

pub fn atcab_sign_base(&mut self, mode: u16, key_id: u16) -> Vec<u8, U10>[src]

This method crafts a SIGN command packet

Method arguments:

  • mode: byte to determine if the command will sign internally generated or externally generated messages.
    • External messages: values can be 0x80, 0xC0, 0xA0, or 0xD0
    • Internal messages: values can be 0x00, 0x20, 0x40, or 0x60
  • key_id: slot id in the data zone

Returns:

  • A heapless Vec containing the serialized command packet bytes.

pub fn atcab_sign(
    &mut self,
    key_id: u16,
    digest: &[u8]
) -> Result<[u8; 64], &'static str>
[src]

This method is used to sign the digest of an external message by an ECC private key. It takes

Method arguments:

  • The ECC private key in the slot specified by key_id is used to generate the signature.
  • A digest of the message generated by the host system. The message can be loaded into either the TempKey or Message Digest Buffer via the Nonce command run in fixed mode and is always 32 bytes in length. The Sign command generates a signature using the ECDSA algorithm. Note- the digest can also be generated via the SHA command.

Returns:

  • a 64-byte response containing the signature - composed of R and S values.
  • or an error string descrbing the error.

pub fn atcab_sign_internal(
    &mut self,
    key_id: u16,
    is_invalidate: bool,
    is_full_sn: bool
) -> Result<[u8; 64], &'static str>
[src]

The Sign command in the Internal Message mode is used to sign a message that was internally generated. The command calculates the internal message digest and then signs the digest using the ECDSA sign algorithm with the private ECC key specified in key_id. Internally generated messages must always reside in TempKey. The value in TempKey must be generated using either the GenDig or the GenKey command. If TempKey is not valid an error will occur.

Method arguments:

  • key_id: The ECC private key in the slot specified by key_id is used to generate the signature.
  • is_invalidate: if the resulting signature is intended to be used by Verify(Validate or Invalidate) i.e. mode-bit6 is zero if its verify(validate) and 1 if its verify(invalidate)
  • is_full_sn: if the Serial number is to be included in the message digest calculation.

Returns:

  • a 64-byte response containing the signature - composed of R and S values.
  • or an error string describing the error.

Typical uses include:

  • Signing an internally generated random key. This is typically generated by the GenKey command.
  • The output of a GenKey or GenDig commands, provided the output is located in TempKey.

pub fn atcab_verify(
    &mut self,
    mode: u16,
    key_id: u16,
    signature: &[u8],
    public_key: &[u8],
    other_data: &[u8],
    _mac: &[u8]
) -> Vec<u8, U151>
[src]

The Verify command takes an ECDSA [R,S] signature and verifies that it is correctly generated given an input message digest and public key. In all cases, the signature is an input to the command.

This method crafts a VERIFY command packet. The Verify command can operate in four different modes:

  • External Mode: The public key to be used is an input to the command. Prior to this command being run, the message should be written to TempKey using the Nonce command. In this mode the device merely accelerates the public key computation and returns a boolean result.
    • key_id is (always) 0x0004 for the external mode
  • Stored Mode: The public key to be used is found in the key_id EEPROM slot. The message should have been previously stored in TempKey. All required configuration checks for the public key at key_id must succeed. Post which, the public key verification computation is performed and a boolean result is returned to the system; otherwise, the command returns an execution error.
    • key_id is the slotID for the stored mode
  • Validate and Invalidate Modes: The Verify command can be used to validate or invalidate a public key. Only those public keys whose access policies require validation need to go through this process. Prior to a public key being used to verify a signature, it must be validated. If a validated public key needs to be updated, then it needs to be invalidated prior to being written. Only internally stored public keys can be validated or invalidated. The status of a public key is stored in the most significant nibble of byte 0 of the public key slot.
  • ValidateExternal Mode: The ValidateExternal mode is used to validate the public key stored in the EEPROM at key_id when X.509 format certificates are to be used.

An optional MAC can be returned from the Verify command to defeat any man-in-the-middle attacks.

Method arguments:

  • mode: see above for the different modes.
  • key_id: slot id in data zone
  • signature: 64 byte signature to be verified
  • public_key: 64 byte signature to be used to verify the signature in external mode.
  • other_data: 19 bytes of other data required when validating or invalidating a public key.
  • mac: A 32-byte MAC, if specified by the mode (only required in stored mode)

Returns:

  • A heapless Vec containing the serialized command packet bytes.

pub fn atcab_verify_extern(
    &mut self,
    message: &[u8],
    signature: &[u8],
    pub_key: &[u8]
) -> Result<[u8; 3], &'static str>
[src]

The Verify command may be used to verify a message generated externally to the device with a public key that is passed to the command. The output of the command will either be a code indicating success, failure or error or a 32-byte MAC. Prior to this command being run, the message should be written using the Nonce command in Fixed mode to either TempKey or the Message Digest Buffer. In this mode, the device merely accelerates the public key computation and returns a boolean result.

Method arguments:

  • message: message to be signed. This is a sha256 digest of the message as a slice of bytes
  • signature: the 64 byte signature to be verified as a slice of bytes
  • pub_key: the 64 byte public key used to verify the signature as a slice of bytes.

Returns:

  • a 3 byte array if the signature is verified
  • if the signature does not match or if there is a failure due to some other reason, an error string describing the error.

pub fn atcab_verify_stored(
    &mut self,
    message: &[u8],
    signature: &[u8],
    key_id: u16
) -> Result<[u8; 3], &'static str>
[src]

When using the Verify command in Stored mode, the public key to be used is stored in a data slot and does not need to be passed. Prior to this command being run, the message should be written to TempKey or the Message Digest Buffer using the Nonce command.

Method arguments:

  • message: message to be signed. This is a sha256 digest of the message as a slice of bytes
  • signature: the 64 byte signature to be verified as a slice of bytes

Returns:

  • a 3 byte array if the signature is verified
  • if the signature does not match or if there is a failure due to some other reason, an error string describing the error.

pub fn atcab_lock(&mut self, mode: u8, crc: [u8; 2]) -> Vec<u8, U10>[src]

This method crafts a 'LOCK command' packet.

Method arguments:

  • mode: byte to indicate which zone is to be locked (0x00 - for config, 0x01 - for data and OTP )
  • crc: a 2 byte checksum (optional)

Returns:

  • A heapless Vec containing the serialized command packet bytes.

pub fn atcab_lock_config_zone(&mut self) -> Result<[u8; 3], &'static str>[src]

This method uses the Lock command to prevent future modification of the Configuration zone.

The Lock command fails if the designated area is already locked. Upon successful execution, the device returns a value of zero.

Method arguments:

  • None

Returns:

  • a 3 byte array with byte[0] =0x00, indicating success
  • or an error string, describing the error.

pub fn atcab_lock_config_zone_crc(
    &mut self,
    crc: [u8; 2]
) -> Result<[u8; 3], &'static str>
[src]

Prior to locking the configuration zone, the device can optionally use the CRC-16 algorithm to verify the contents of the designated zone(s). The CRC is calculated over all 128 bytes within the Configuration zone using the current value of LockConfig at address 87. If the compare succeeds, then LockConfig will be set to a value of 00.

The calculation uses the same algorithm as the CRC computed over the input and output groups. The value of the 7th bit of the 'mode parameter' (called summary check bit) is important.

  • 0 = The summary value is verified before the zone is locked.
  • 1 = Check of the zone summary is ignored and the zone is locked regardless of the contents of the zone.

Method argument:

  • crc: a 2 byte checksum (see above for more info)

Returns:

  • a 3 byte array with byte[0] =0x00, indicating success
  • or an error string, describing the error.

pub fn crc(&self, src: &[u8], length: usize) -> [u8; 2][src]

A method to calculate a 2 byte checksum value. The input to this method is a slice of u8s
along with its length.

pub fn atcab_read_zone(
    &mut self,
    zone: u16,
    slot: u16,
    block: u16,
    offset: u16,
    length: u16
) -> Result<[u8; 151], StatusError>
[src]

This method crafts and sends a 'READ command' packet to the device. Upon successful execution of the command, it returns 32 (or 4) bytes. If the command fails, it returns the error in a StatusError struct.

Method arguments:

  • zone: memory zone of EEPROM to read from
  • slot: if data zone, ID of slot to read from
  • block: each memory is divided in blocks of 32 bytes. This param indicate which block in a given zone
  • offset: is a 4 byte or 1 word offset into a block.
  • length: lenght of size of data to read

Returns:

  • an max size array of 151 bytes containing read response
  • or an error string describing the error

pub fn atcab_read_bytes_zone(
    &mut self,
    zone: u16,
    slot: u16,
    _block: u16,
    offset: u16,
    length: u16
) -> Result<[[u8; 151]; 4], &'static str>
[src]

This method reads words (one four byte word or an 8-word block of 32 bytes) from one of the memory zones of the device. Returns an array of 4 max-cmd-bytes arrays.

Method arguments:

  • zone: memory zone of EEPROM to read from
  • slot: if data zone, ID of slot to read from
  • block: each memory is divided in blocks of 32 bytes. This param indicate which block in a given zone
  • offset: is a 4 byte or 1 word offset into a block.
  • length: lenght of size of data to read

Returns:

  • an array of 4 max-cmd-bytes arrays containing the full read response
  • or an error string describing the error

pub fn atcab_is_locked(&mut self, zone: u16) -> bool[src]

Method arguments:

  • Zone ID (0x00 - Config zone or 0x01 - Data Zone) (to check to see if the zone is locked.)

Returns

  • a bool indicating True if the zone is locked.

pub fn atcab_read_config_zone(&mut self) -> Result<[u8; 128], &'static str>[src]

Dumps the contents of Config zone. Zone of 128 bytes (1,024-bit) EEPROM that contains the serial number and other ID information, as well as, access policy information for each slot of the data memory.

The values programmed into the configuration zone will determine the access policy of how each data slot will respond. The configuration zone can be modified until it has been locked (LockConfig set to !=0x55).

In order to enable the access policies, the LockValue byte must be set.

Method arguments:

  • None

Returns

  • An array containing 128 bytes i.e. contents of config zone
  • or an error string describing the error.

pub fn atcab_get_addr(
    &mut self,
    zone: u16,
    slot: u16,
    block: u16,
    offset: u16
) -> u16
[src]

Address of first word to be read/written within the zone. The Read and Write commands include a single 16 bit address in Param2, which indicates the memory location to be accessed. In all cases, data is accessed on 4 byte word boundaries. Address Encoding for Config and OTP Zones (Param2).

Byte 1 is unused and Byte 0 is used as follows

===========Byte 0 info ===========

  • Unused - Bits 7-5 (drop the 3 most significant bits by left shifting)
  • Block - Bits 4-3 (the config zone has 4 blocks in total 0-3 and is 128 bytes in length)
  • Offset - Bits 2-0 (offset into the block)

Method arguments:

  • zone: is the zone_id - config zone 0x00, data zone 0x02, OTP zone 0x01
  • slot: is the slot_id - can be of 16 slots
  • block: each zone's memory is divided in blocks of 32 bytes. block is the index of a block for a given zone
  • offset: is the 4-byte (or word) offset into a block

Returns:

  • u16: Address of first word to be read/written within the zone

pub fn atcab_get_zone_size(&mut self, zone: u16, slot: u16) -> u16[src]

Method arguments:

  • zone: is the zone_id - config zone 0x00, data zone 0x02, OTP zone 0x01
  • slot: is the slot_id - can be of 16 slots

Returns:

  • u16: Size of the zone

pub fn atcab_write(
    &mut self,
    zone: u16,
    address: u16,
    data: &[u8],
    mac: &[u8; 32]
) -> Result<[u8; 3], &'static str>
[src]

The Write command writes either one 4 byte word or an 8-word block of 32 bytes to one of the EEPROM zones on the device.

  • Configuration Zone: If the configuration zone is locked or Zone is set, then this command returns an error; otherwise the bytes are written as requested
  • OTP Zone: If the OTP zone is unlocked, then all bytes can be written with this command.
  • Data Zone: If the data zone is unlocked, then all bytes in all zones can be written with either plain text or encrypted data

Notes

  • Prior to EEPROM locking of config zone, all bytes (except the first 16 and bytes [84..87]) in the config zone are writable. Data and OTP zones cannot be read or written to
  • After locking the config zone, data and OTP zone are writable, depending on the configuration of slot access policies. However, policies are not strictly enforced while in this state i.e. some commands like 'write or genkey' will still work even though a slot is configured to be (permanently) not writable.
  • After locking the data zones byte [86]. All access policies for each slot are strictly enforced.

Locking is an irreversible operation.

Method arguments:

  • addr: Address of first word to be written within the zone.
  • data: Information to be written to the zone. May be encrypted.
  • mac: Message authentication code to validate address and data.(only if data is encrypted)

Returns:

  • an 3-byte success array, where index [0] == 0x00 indicating a successful write or
  • an error string describing the error.

pub fn atcab_write_zone(
    &mut self,
    zone: u16,
    slot: u16,
    block: u16,
    offset: u16,
    data: &[u8]
) -> Result<[u8; 3], &'static str>
[src]

pub fn atcab_write_bytes_zone(
    &mut self,
    zone: u16,
    slot: u16,
    offset: u16,
    data: &[u8]
) -> Vec<[u8; 3], U20>
[src]

This method takes the following arguments Method arguments:

  • zone_id: Config zone - 0x00, Data zone - 0x02, OTP zone- 0x01.
  • slotID: If zone is 0x02, then slot can be one of 16 slots.
  • offset: is an integer offset into a zone.
  • data: Information to be written to the zone. May be encrypted.

Returns

  • a heapless Vec of status_packets i.e. each element is a 3 byte array.

pub fn atcab_write_pubkey()[src]

Not implemented

pub fn atcab_write_config_zone(&mut self, config_data: &[u8]) -> [[u8; 3]; 15][src]

This method takes a slice of 128 bytes, writes bytes[16-128] to the config zone and an returns array containing 15 3-byte responses. Details of 15 writes are as follows

  • 4 4-byte writes followed
  • 1 1 32-byte write
  • 7 4-byte writes (i.e. skip block 2, word_count == 5)
  • 1 1 32-byte write
  • 2 updateextra cmds for config bytes [84] and [85]

Details of 3-byte response are as follows

  • Byte 1 => 00 means success, anything else is an error.
  • Byte 2-3 => checksum of 4 bytes i.e. CRC((length byte == 4) + byte 1). For a successful write, this is always == [0x03, 0x40]

pub fn atcab_write_enc()[src]

Not implemented

pub fn atcab_write_config_counter()[src]

Not implemented

pub fn atcab_updateextra(
    &mut self,
    mode: u16,
    value: u16
) -> Result<[u8; 3], &'static str>
[src]

The UpdateExtra command is used to update the UpdateExtra and UpdateExtraAdd bytes, bytes 84 and 85 respectively in the Configuration zone. These bytes can only be updated by this command. These bytes are one-time updatable bytes and can only be updated if the current value is 0x00. Trying to update this byte if the value is not 0x00 will result in an error.

Method arguments:

  • mode: 0x00 to update byte [84] or 0x01 to update byte [85]
  • value: LSB of 2-byte value to write contains the byte to write

Returns

  • a 3-byte response.
    • Byte 1 => 00 means success, anything else is an error.
    • Byte 2-3 => checksum of 4 bytes i.e. CRC((length byte == 4) + byte 1). For a successful write, this is always == [0x03, 0x40]
  • or an error string describing the error.

Trait Implementations

impl<I2C: Clone, DELAY: Clone, TIMER: Clone> Clone for ATECC608A<I2C, DELAY, TIMER>[src]

impl<I2C: Copy, DELAY: Copy, TIMER: Copy> Copy for ATECC608A<I2C, DELAY, TIMER>[src]

impl<I2C: Debug, DELAY: Debug, TIMER: Debug> Debug for ATECC608A<I2C, DELAY, TIMER>[src]

impl<I2C: PartialEq, DELAY: PartialEq, TIMER: PartialEq> PartialEq<ATECC608A<I2C, DELAY, TIMER>> for ATECC608A<I2C, DELAY, TIMER>[src]

impl<I2C, DELAY, TIMER> StructuralPartialEq for ATECC608A<I2C, DELAY, TIMER>[src]

Auto Trait Implementations

impl<I2C, DELAY, TIMER> Send for ATECC608A<I2C, DELAY, TIMER> where
    DELAY: Send,
    I2C: Send,
    TIMER: Send

impl<I2C, DELAY, TIMER> Sync for ATECC608A<I2C, DELAY, TIMER> where
    DELAY: Sync,
    I2C: Sync,
    TIMER: Sync

impl<I2C, DELAY, TIMER> Unpin for ATECC608A<I2C, DELAY, TIMER> where
    DELAY: Unpin,
    I2C: Unpin,
    TIMER: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.