Function sgx_tcrypto::rsgx_aes_ctr_encrypt[][src]

pub fn rsgx_aes_ctr_encrypt(
    key: &sgx_aes_ctr_128bit_key_t,
    src: &[u8],
    ctr: &sgx_aes_ctr_128bit_ctr_t,
    ctr_inc_bits: u32,
    dst: &mut [u8]
) -> SgxError

rsgx_aes_ctr_encrypt performs a Rijndael AES-CTR encryption operation.

Only a 128bit key size is supported by this Intel(R) SGX SDK cryptography library.

Description

This function encrypts the input data stream of a variable length according to the CTR mode as specified in [NIST SP 800-38A]. The counter can be thought of as an IV which increments on successive encryption or decryption calls. For a given dataset or data stream, the incremented counter block should be used on successive calls of the encryption process for that given stream. However, for new or different datasets/streams, the same counter should not be reused, instead initialize the counter for the new data set.

It is recommended that the source, destination and counter data buffers are allocated within the enclave.

Parameters

key

A pointer to key to be used in the AES-CTR encryption operation. The size must be 128 bits.

src

A pointer to the input data stream to be encrypted.

ctr

A pointer to the initialization vector to be used in the AES-CTR calculation.

ctr_inc_bits

Specifies the number of bits in the counter to be incremented.

dst

A pointer to the output encrypted data buffer. This buffer should be allocated by the calling code.

Requirements

Library: libsgx_tcrypto.a

Errors

SGX_ERROR_INVALID_PARAMETER

The pointer is invalid.

SGX_ERROR_OUT_OF_MEMORY

Not enough memory is available to complete this operation.

SGX_ERROR_UNEXPECTED

An internal cryptography library failure occurred.