Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed_DS28EC20_GPIO
DS28C36 Class Reference
Interface to the DS28C36 authenticator. More...
#include <DS28C36_DS2476.hpp>
Inherited by DS2476.
Data Structures | |
| class | ComputeSecretData |
| Format compute secret input data. More... | |
| class | EncryptionHmacData |
| Format encryption or decryption HMAC input data. More... | |
| class | GpioControl |
| Access fields in the GPIO Control page. More... | |
| class | PageAuthenticationData |
| Format page authentication input data. More... | |
| class | RomOptions |
| Access fields in the ROM Options page. More... | |
| class | WriteAuthenticationData |
| Format authenticated write input data. More... | |
Public Types | |
| enum | ErrorValue { , InvalidResponseError = 0x101 } |
Device command results. More... | |
| enum | KeyNum |
Available keys for ECDSA operations. More... | |
| enum | SecretNum |
Available secrets for HMAC operations. More... | |
| enum | HashType { HashInBuffer = 0, DataInBuffer = 1, THASH = 2 } |
Data hash type when verifying an ECDSA signature. More... | |
| enum | PioState |
Available PIO states when verifying an ECDSA signature. More... | |
| enum | PageProtectionType { RP = 0x01, WP = 0x02, EM = 0x04, APH = 0x08, EPH = 0x10, AUTH = 0x20, ECH = 0x40, ECW = 0x80 } |
Page protection types. More... | |
| typedef array_span < uint_least8_t, 32 > | Page |
| Holds a device memory page. | |
| typedef array_span < uint_least8_t, 8 > | EncryptionChallenge |
| Challenge for an encrypted device memory page. | |
Public Member Functions | |
| MaximInterface_EXPORT error_code | writeMemory (int pageNum, Page::const_span page) |
| Write memory with no protection. | |
| MaximInterface_EXPORT error_code | readMemory (int pageNum, Page::span page) |
| Read memory with no protection. | |
| MaximInterface_EXPORT error_code | writeBuffer (span< const uint_least8_t > data) |
| Write the temporary buffer. | |
| MaximInterface_EXPORT error_code | readBuffer (std::vector< uint_least8_t > &data) |
| Read the temporary buffer. | |
| MaximInterface_EXPORT error_code | readPageProtection (int pageNum, PageProtection &protection) |
| Read the protection settings of a page. | |
| MaximInterface_EXPORT error_code | setPageProtection (int pageNum, const PageProtection &protection) |
| Set the protection settings of a page. | |
| MaximInterface_EXPORT error_code | decrementCounter () |
| Decrement the decrement-only counter. | |
| MaximInterface_EXPORT error_code | readRng (span< uint_least8_t > data) |
| Read a block of random data from the RNG. | |
| MaximInterface_EXPORT error_code | encryptedReadMemory (int pageNum, SecretNum secretNum, EncryptionChallenge::span challenge, Page::span data) |
| Read memory with encryption. | |
| MaximInterface_EXPORT error_code | computeAndReadPageAuthentication (int pageNum, KeyNum keyNum, Ecc256::Signature::span signature) |
| Compute and read page authentication with ECDSA. | |
| MaximInterface_EXPORT error_code | computeAndReadPageAuthentication (int pageNum, SecretNum secretNum, Sha256::Hash::span hmac) |
| Compute and read page authentication with HMAC. | |
| MaximInterface_EXPORT error_code | authenticatedSha2WriteMemory (int pageNum, SecretNum secretNum, Page::const_span page) |
| Write with SHA2 authentication. | |
| MaximInterface_EXPORT error_code | computeAndLockSha2Secret (int pageNum, SecretNum msecretNum, SecretNum dsecretNum, bool writeProtectEnable) |
| Compute SHA2 secret and optionally lock. | |
| MaximInterface_EXPORT error_code | generateEcc256KeyPair (KeyNum keyNum, bool writeProtectEnable) |
| Generate a new ECDSA key pair. | |
| MaximInterface_EXPORT error_code | computeMultiblockHash (bool firstBlock, bool lastBlock, span< const uint_least8_t > data) |
| Compute a hash over multiple blocks. | |
| MaximInterface_EXPORT error_code | verifyEcdsaSignature (KeyNum keyNum, HashType hashType, Ecc256::Signature::const_span signature, PioState pioa=Unchanged, PioState piob=Unchanged) |
| Verify ECDSA signature. | |
| MaximInterface_EXPORT error_code | authenticateEcdsaPublicKey (bool authWrites, bool ecdh, KeyNum keyNum, int csOffset, Ecc256::Signature::const_span signature) |
| Authenticate a public key for authenticated writes or encrypted reads with ECDH. | |
| MaximInterface_EXPORT error_code | authenticatedEcdsaWriteMemory (int pageNum, Page::const_span page) |
| Write with ECDSA authentication. | |
Static Public Attributes | |
| static const int | memoryPages = 32 |
| Number of memory pages on the device. | |
Device memory pages | |
| static const int | publicKeyAxPage = 16 |
| static const int | publicKeyAyPage = 17 |
| static const int | publicKeyBxPage = 18 |
| static const int | publicKeyByPage = 19 |
| static const int | publicKeyCxPage = 20 |
| static const int | publicKeyCyPage = 21 |
| static const int | privateKeyAPage = 22 |
| static const int | privateKeyBPage = 23 |
| static const int | privateKeyCPage = 24 |
| static const int | secretAPage = 25 |
| static const int | secretBPage = 26 |
| static const int | decrementCounterPage = 27 |
| static const int | romOptionsPage = 28 |
| static const int | gpioControlPage = 29 |
| static const int | publicKeySxPage = 30 |
| static const int | publicKeySyPage = 31 |
Detailed Description
Interface to the DS28C36 authenticator.
Definition at line 52 of file DS28C36_DS2476.hpp.
Member Typedef Documentation
| typedef array_span<uint_least8_t, 8> EncryptionChallenge |
Challenge for an encrypted device memory page.
Definition at line 140 of file DS28C36_DS2476.hpp.
| typedef array_span<uint_least8_t, 32> Page |
Holds a device memory page.
Definition at line 106 of file DS28C36_DS2476.hpp.
Member Enumeration Documentation
| enum ErrorValue |
Device command results.
Definition at line 55 of file DS28C36_DS2476.hpp.
| enum HashType |
Data hash type when verifying an ECDSA signature.
- Enumerator:
HashInBuffer Hash is loaded in the buffer.
DataInBuffer Compute hash from data loaded in the buffer.
THASH Use THASH from Compute Multiblock Hash command.
Definition at line 96 of file DS28C36_DS2476.hpp.
| enum KeyNum |
Available keys for ECDSA operations.
Definition at line 90 of file DS28C36_DS2476.hpp.
| enum PageProtectionType |
Page protection types.
- Enumerator:
Definition at line 127 of file DS28C36_DS2476.hpp.
| enum PioState |
Available PIO states when verifying an ECDSA signature.
Definition at line 103 of file DS28C36_DS2476.hpp.
| enum SecretNum |
Available secrets for HMAC operations.
Definition at line 93 of file DS28C36_DS2476.hpp.
Member Function Documentation
| error_code authenticatedEcdsaWriteMemory | ( | int | pageNum, |
| Page::const_span | page | ||
| ) |
Write with ECDSA authentication.
- Parameters:
-
pageNum Number of page to write. page Data to write.
Definition at line 452 of file DS28C36_DS2476.cpp.
| error_code authenticatedSha2WriteMemory | ( | int | pageNum, |
| SecretNum | secretNum, | ||
| Page::const_span | page | ||
| ) |
Write with SHA2 authentication.
- Parameters:
-
pageNum Number of page to write. secretNum Secret to use for authentication. page Data to write.
Definition at line 295 of file DS28C36_DS2476.cpp.
| error_code authenticateEcdsaPublicKey | ( | bool | authWrites, |
| bool | ecdh, | ||
| KeyNum | keyNum, | ||
| int | csOffset, | ||
| Ecc256::Signature::const_span | signature | ||
| ) |
Authenticate a public key for authenticated writes or encrypted reads with ECDH.
- Parameters:
-
authWrites True to select authentication for writes. ecdh True to select ECDH key exchange. keyNum Private key to use for ECDH key exchange. Key A or B can be selected. csOffset Certificate customization field ending offset in buffer. signature Signature to use for authentication of public key S.
Definition at line 422 of file DS28C36_DS2476.cpp.
| error_code computeAndLockSha2Secret | ( | int | pageNum, |
| SecretNum | msecretNum, | ||
| SecretNum | dsecretNum, | ||
| bool | writeProtectEnable | ||
| ) |
Compute SHA2 secret and optionally lock.
- Parameters:
-
pageNum Number of page to use in computation. msecretNum Master secret to use in computation. dsecretNum Destination secret to receive the computation result. writeProtectEnable True to lock the destination secret against further writes.
Definition at line 316 of file DS28C36_DS2476.cpp.
| error_code computeAndReadPageAuthentication | ( | int | pageNum, |
| KeyNum | keyNum, | ||
| Ecc256::Signature::span | signature | ||
| ) |
Compute and read page authentication with ECDSA.
- Parameters:
-
pageNum Number of page to authenticate. keyNum Private key to use for authentication. Key S cannot be used with this command. [out] signature Computed page signature.
Definition at line 231 of file DS28C36_DS2476.cpp.
| error_code computeAndReadPageAuthentication | ( | int | pageNum, |
| SecretNum | secretNum, | ||
| Sha256::Hash::span | hmac | ||
| ) |
Compute and read page authentication with HMAC.
- Parameters:
-
pageNum Number of page to authenticate. secretNum Secret to use for authentication. [out] hmac Computed page HMAC.
Definition at line 265 of file DS28C36_DS2476.cpp.
| error_code computeMultiblockHash | ( | bool | firstBlock, |
| bool | lastBlock, | ||
| span< const uint_least8_t > | data | ||
| ) |
Compute a hash over multiple blocks.
- Parameters:
-
firstBlock True if this is the first block being hashed. lastBlock True if this is the last block being hashed. data Data block to hash. Should be 64 bytes unless this is the last block.
Definition at line 361 of file DS28C36_DS2476.cpp.
| error_code decrementCounter | ( | ) |
Decrement the decrement-only counter.
Definition at line 167 of file DS28C36_DS2476.cpp.
| error_code encryptedReadMemory | ( | int | pageNum, |
| SecretNum | secretNum, | ||
| EncryptionChallenge::span | challenge, | ||
| Page::span | data | ||
| ) |
Read memory with encryption.
- Parameters:
-
pageNum Number of page to read from. secretNum Secret to use for encryption. [out] challenge Encryption challenge that was read. [out] data Encrypted page data that was read.
Definition at line 194 of file DS28C36_DS2476.cpp.
| error_code generateEcc256KeyPair | ( | KeyNum | keyNum, |
| bool | writeProtectEnable | ||
| ) |
Generate a new ECDSA key pair.
- Parameters:
-
keyNum Key to generate. Key S cannot be used with this command. writeProtectEnable True to lock the key against further writes.
Definition at line 340 of file DS28C36_DS2476.cpp.
| error_code readBuffer | ( | std::vector< uint_least8_t > & | data ) |
Read the temporary buffer.
- Parameters:
-
[out] data Data that was read.
Definition at line 115 of file DS28C36_DS2476.cpp.
| error_code readMemory | ( | int | pageNum, |
| Page::span | page | ||
| ) |
Read memory with no protection.
- Parameters:
-
pageNum Number of page to read. [out] page Data that was read.
Definition at line 92 of file DS28C36_DS2476.cpp.
| error_code readPageProtection | ( | int | pageNum, |
| PageProtection & | protection | ||
| ) |
Read the protection settings of a page.
- Parameters:
-
pageNum Number of page to read. [out] protection Protection that was read.
Definition at line 130 of file DS28C36_DS2476.cpp.
| error_code readRng | ( | span< uint_least8_t > | data ) |
Read a block of random data from the RNG.
- Parameters:
-
[out] data Random data from RNG with length from 1 to 64.
Definition at line 180 of file DS28C36_DS2476.cpp.
| error_code setPageProtection | ( | int | pageNum, |
| const PageProtection & | protection | ||
| ) |
Set the protection settings of a page.
- Parameters:
-
pageNum Number of page to write. protection Protection to write.
Definition at line 148 of file DS28C36_DS2476.cpp.
| error_code verifyEcdsaSignature | ( | KeyNum | keyNum, |
| HashType | hashType, | ||
| Ecc256::Signature::const_span | signature, | ||
| PioState | pioa = Unchanged, |
||
| PioState | piob = Unchanged |
||
| ) |
Verify ECDSA signature.
- Parameters:
-
keyNum Public key to use for verification. hashType Source of the data hash input. signature Signature to verify. pioa New state of PIOA if verification successful. piob New state of PIOB if verification successful.
Definition at line 389 of file DS28C36_DS2476.cpp.
| error_code writeBuffer | ( | span< const uint_least8_t > | data ) |
Write the temporary buffer.
- Parameters:
-
data Data to write.
Definition at line 111 of file DS28C36_DS2476.cpp.
| error_code writeMemory | ( | int | pageNum, |
| Page::const_span | page | ||
| ) |
Write memory with no protection.
- Parameters:
-
pageNum Number of page to write. page Data to write.
Definition at line 73 of file DS28C36_DS2476.cpp.
Field Documentation
const int memoryPages = 32 [static] |
Number of memory pages on the device.
Definition at line 87 of file DS28C36_DS2476.hpp.
Generated on Tue Jul 12 2022 23:29:45 by
1.7.2