Skip to main content
Version: 0.1.25

ARIA - CTR

ARIA in CTR (Counter) mode: a counter block is encrypted to produce a keystream, which is XORed with the plaintext. Same semantics as AES CTR. The IV/nonce must be unique per encryption (no reuse with the same key).

API

noxtls_aria_encrypt_ctr

noxtls_return_t noxtls_aria_encrypt_ctr(const uint8_t* key, const uint8_t* data, uint32_t data_len, const uint8_t* iv, uint8_t* output, noxtls_aria_type_t type);

Encrypts data in ARIA CTR mode. IV is the initial counter (16 bytes); must be unique per encryption.

Parameters: key — encryption key; data — plaintext; data_len — length; iv — 16-byte initial counter/nonce (unique per encryption); output — ciphertext buffer; type — ARIA key type.

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success; otherwise a specific return code.

noxtls_aria_decrypt_ctr

noxtls_return_t noxtls_aria_decrypt_ctr(const uint8_t* key, const uint8_t* data, uint32_t data_len, const uint8_t* iv, uint8_t* output, noxtls_aria_type_t type);

Decrypts data in ARIA CTR mode (same keystream as encrypt; XOR with ciphertext). Use the same IV that was used for encryption.

Parameters: key — decryption key; data — ciphertext; data_len — length; iv — 16-byte initial counter used for this ciphertext; output — plaintext buffer; type — ARIA key type.

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success; otherwise a specific return code.