static void test_cipher(const void *opaque)

{

    const QCryptoCipherTestData *data = opaque;



    QCryptoCipher *cipher;

    Error *err = NULL;

    uint8_t *key, *iv, *ciphertext, *plaintext, *outtext;

    size_t nkey, niv, nciphertext, nplaintext;

    char *outtexthex;



    g_test_message("foo");

    nkey = unhex_string(data->key, &key);

    niv = unhex_string(data->iv, &iv);

    nciphertext = unhex_string(data->ciphertext, &ciphertext);

    nplaintext = unhex_string(data->plaintext, &plaintext);



    g_assert(nciphertext == nplaintext);



    outtext = g_new0(uint8_t, nciphertext);



    cipher = qcrypto_cipher_new(

        data->alg, data->mode,

        key, nkey,

        &err);

    g_assert(cipher != NULL);

    g_assert(err == NULL);





    if (iv) {

        g_assert(qcrypto_cipher_setiv(cipher,

                                      iv, niv,

                                      &err) == 0);

        g_assert(err == NULL);

    }

    g_assert(qcrypto_cipher_encrypt(cipher,

                                    plaintext,

                                    outtext,

                                    nplaintext,

                                    &err) == 0);

    g_assert(err == NULL);



    outtexthex = hex_string(outtext, nciphertext);



    g_assert_cmpstr(outtexthex, ==, data->ciphertext);



    g_free(outtext);

    g_free(outtexthex);

    g_free(key);

    g_free(iv);

    g_free(ciphertext);

    g_free(plaintext);

    qcrypto_cipher_free(cipher);

}

static void test_cipher(const void *opaque)

{

    const QCryptoCipherTestData *data = opaque;



    QCryptoCipher *cipher;

    Error *err = NULL;

    uint8_t *key, *iv, *ciphertext, *plaintext, *outtext;

    size_t nkey, niv, nciphertext, nplaintext;

    char *outtexthex;



    g_test_message("foo");

    nkey = unhex_string(data->key, &key);

    niv = unhex_string(data->iv, &iv);

    nciphertext = unhex_string(data->ciphertext, &ciphertext);

    nplaintext = unhex_string(data->plaintext, &plaintext);



    g_assert(nciphertext == nplaintext);



    outtext = g_new0(uint8_t, nciphertext);



    cipher = qcrypto_cipher_new(

        data->alg, data->mode,

        key, nkey,

        &err);

    g_assert(cipher != NULL);

    g_assert(err == NULL);





    if (iv) {

        g_assert(qcrypto_cipher_setiv(cipher,

                                      iv, niv,

                                      &err) == 0);

        g_assert(err == NULL);

    }

    g_assert(qcrypto_cipher_encrypt(cipher,

                                    plaintext,

                                    outtext,

                                    nplaintext,

                                    &err) == 0);

    g_assert(err == NULL);



    outtexthex = hex_string(outtext, nciphertext);



    g_assert_cmpstr(outtexthex, ==, data->ciphertext);



    g_free(outtext);

    g_free(outtexthex);

    g_free(key);

    g_free(iv);

    g_free(ciphertext);

    g_free(plaintext);

    qcrypto_cipher_free(cipher);

}

    Error *err = NULL;     g_test_message("foo");         &err);     g_assert(err == NULL);                                       &err) == 0);         g_assert(err == NULL);                                     &err) == 0);     g_assert(err == NULL);
static void FUNC_0(const void *VAR_0)

{

    const QCryptoCipherTestData *VAR_1 = VAR_0;



    QCryptoCipher *cipher;

    Error *err = NULL;

    uint8_t *key, *iv, *ciphertext, *plaintext, *outtext;

    size_t nkey, niv, nciphertext, nplaintext;

    char *VAR_2;



    g_test_message("foo");

    nkey = unhex_string(VAR_1->key, &key);

    niv = unhex_string(VAR_1->iv, &iv);

    nciphertext = unhex_string(VAR_1->ciphertext, &ciphertext);

    nplaintext = unhex_string(VAR_1->plaintext, &plaintext);



    g_assert(nciphertext == nplaintext);



    outtext = g_new0(uint8_t, nciphertext);



    cipher = qcrypto_cipher_new(

        VAR_1->alg, VAR_1->mode,

        key, nkey,

        &err);

    g_assert(cipher != NULL);

    g_assert(err == NULL);





    if (iv) {

        g_assert(qcrypto_cipher_setiv(cipher,

                                      iv, niv,

                                      &err) == 0);

        g_assert(err == NULL);

    }

    g_assert(qcrypto_cipher_encrypt(cipher,

                                    plaintext,

                                    outtext,

                                    nplaintext,

                                    &err) == 0);

    g_assert(err == NULL);



    VAR_2 = hex_string(outtext, nciphertext);



    g_assert_cmpstr(VAR_2, ==, VAR_1->ciphertext);



    g_free(outtext);

    g_free(VAR_2);

    g_free(key);

    g_free(iv);

    g_free(ciphertext);

    g_free(plaintext);

    qcrypto_cipher_free(cipher);

}

static void FUNC_0(const void *VAR_0)
{ const QCryptoCipherTestData *VAR_1 = VAR_0; QCryptoCipher *cipher; Error *err = NULL; uint8_t *key, *iv, *ciphertext, *plaintext, *outtext; size_t nkey, niv, nciphertext, nplaintext; char *VAR_2; g_test_message("foo"); nkey = unhex_string(VAR_1->key, &key); niv = unhex_string(VAR_1->iv, &iv); nciphertext = unhex_string(VAR_1->ciphertext, &ciphertext); nplaintext = unhex_string(VAR_1->plaintext, &plaintext); g_assert(nciphertext == nplaintext); outtext = g_new0(uint8_t, nciphertext); cipher = qcrypto_cipher_new(
VAR_1->alg, VAR_1->mode,
key, nkey,
&err); g_assert(cipher != NULL); g_assert(err == NULL); if (iv) { g_assert(qcrypto_cipher_setiv(cipher,
iv, niv,
&err) == 0); g_assert(err == NULL); } g_assert(qcrypto_cipher_encrypt(cipher,
plaintext,
outtext,
nplaintext,
&err) == 0); g_assert(err == NULL); VAR_2 = hex_string(outtext, nciphertext); g_assert_cmpstr(VAR_2, ==, VAR_1->ciphertext); g_free(outtext); g_free(VAR_2); g_free(key); g_free(iv); g_free(ciphertext); g_free(plaintext); qcrypto_cipher_free(cipher); }