Updated: October 26, 2022

Cipher algorithm arguments


#include <qcrypto/qcrypto.h>
typedef struct _qcrypto_cipher_args {
    qcrypto_cipher_action_t    action;
    const uint8_t*             iv;
    size_t                     ivsize;
    qcrypto_cipher_padding_t   padding;
    union {
        union {
            struct {
                size_t            tagsize;
                const uint8_t    *tag;
            } gcm;
            struct {
                size_t            tagsize;
                const uint8_t    *tag;
                size_t            inputsize;
                size_t            aadsize;
            } ccm;
            struct {
                size_t            tagsize;
                const uint8_t    *tag;
            } ocb;
        } aes;
        void*             private;
} qcrypto_cipher_args_t;


qcrypto_cipher_action_t action

The cipher action (encryption or decryption).

uint8_t* iv

The initialization vector (IV) buffer.

size_t ivsize

The IV size.

qcrypto_cipher_padding_t padding

The padding mode.

size_t unitsize

The unit size (usually the block size). Maximum is 16 MiB.

size_t tagsize

The tag (or MAC) size.

uint8_t* tag

The decryption tag.

size_t inputsize

The plaintext or ciphertext size.

size_t aadsize

The AAD size.

void* private

Private arguments to pass for other types of ciphers.




The arguments are organized based on the algorithm name. Some modes of operation require extra parameters to set up the algorithm.

The padding value can be a value other than QCRYPTO_CIPHER_PADDING_NONE if the cipher is a block cipher; otherwise, an error is returned. See qcrypto_cipher_padding_t.

The private field can be used for custom plugins that implement custom algorithms that the QNX cryptography library API does not support.

For more information, see qcrypto_cipher_init().