Class desfire::esp32::crypto_des

Inheritance Relationships

Base Type

Class Documentation

class crypto_des : public desfire::crypto_des_base

ESP32-specific implementation of crypto_des_base. Uses MbedTLS or WolfSSL depending on whether LIBSPOOKY_USE_MBEDTLS or LIBSPOOKY_USE_WOLFSSL is set.

Public Functions

virtual void setup_with_key(range<std::uint8_t const*> key) override

Sets the key to be used from now onwards in this cryptographic implementation.

This method should do all the setup needed for further operations, i.e. setting the key in the internal cryptographic primitives, resetting or setting initialization vectors, deriving CMAC keys where needed. This method should be called by init_session as soon as it has derived the key from the random data.

Parameters:

key – Range of bytes containing the key to use for the following operations. This is specified as a range on raw bytes for convenience, as the underlying cryptographic functions are likely low level.

virtual void do_crypto(range<std::uint8_t*> data, range<std::uint8_t*> iv, crypto_operation op) override

Performs a supported cryptographic operation on the given data and initialization vector.

Parameters:
  • data – Input data (plaintext for crypto_operation::encrypt and crypto_operation::mac, and ciphertext for crypto_operation::decrypt). This data is modified and upon exit will contain the resulting ciphertext or plaintext, respectively, therefore this must be already padded and resized to the next multiple of the block size according to cipher_type.

  • iv – Initialization vector to use during the cryptographic operation. This must the the right size depending on the block size of this implementation’s cipher_type, and will be overwritten by the cryptographic algorithm (i.e. upon exit it is transformed).

  • op – Cryptographic operation to perform.

crypto_des()
~crypto_des() override