Class desfire::esp32::crypto_2k3des

Inheritance Relationships

Base Type

Class Documentation

class crypto_2k3des : public desfire::crypto_2k3des_base

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

Public Functions

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_2k3des()
~crypto_2k3des() override

Protected Functions

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

Subclasses should implement this instead of setup_with_key, to the same effect.

This method is called by the custom implementation of setup_with_key provided in this class, with the same parameters, right after detecting whether the key is degenerate and updating is_degenerate, and storing the key version.

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.