/** Decrypt the 16 byte block using AES in XEX mode. This uses an arbitrary * encryption key. * \param out The resulting plaintext will be written to here. This must be * a byte array with space for 16 bytes. * \param in The source ciphertext. This must be a byte array containing the * 16 byte ciphertext. * \param n See xexEncryptInternal(). * \param seq See xexEncryptInternal(). * \param tweak_key See xexEncryptInternal(). * \param encrypt_key See xexEncryptInternal(). */ static void xexDecryptInternal(uint8_t *out, uint8_t *in, uint8_t *n, uint8_t seq, uint8_t *tweak_key, uint8_t *encrypt_key) { xexEnDecrypt(out, in, n, seq, tweak_key, encrypt_key, true); }
/** Encrypt one 16 byte block using AES in XEX mode. * \param out The resulting ciphertext will be written to here. This must be * a byte array with space for 16 bytes. * \param in The source plaintext. This must be a byte array containing the * 16 byte plaintext. * \param n A 128 bit number which specifies the number of the data * unit (whatever a data unit is defined to be). This should be a * byte array of 16 bytes, with the 128 bit number in unsigned, * little-endian multi-precision format. * \param seq Specifies the block within the data unit. * \param tweak_key A 128 bit AES key. * \param encrypt_key Another 128 bit AES key. This must be independent of * tweak_key. * \warning Don't use seq = 0, as this presents a security * vulnerability (albeit a convoluted one). For more details about * the seq = 0 issue, see section 6 ("Security of XEX") of * Rogaway's paper (reference at the top of this file). */ static void xexEncrypt(uint8_t *out, uint8_t *in, uint8_t *n, uint8_t seq, uint8_t *tweak_key, uint8_t *encrypt_key) { xexEnDecrypt(out, in, n, seq, tweak_key, encrypt_key, 0); }