int qcrypto_cipher_encrypt(QCryptoCipher *cipher,

                           const void *in,

                           void *out,

                           size_t len,

                           Error **errp)

{

    QCryptoCipherNettle *ctx = cipher->opaque;



    switch (cipher->mode) {

    case QCRYPTO_CIPHER_MODE_ECB:

        ctx->alg_encrypt(ctx->ctx_encrypt, len, out, in);

        break;



    case QCRYPTO_CIPHER_MODE_CBC:

        cbc_encrypt(ctx->ctx_encrypt, ctx->alg_encrypt,

                    ctx->niv, ctx->iv,

                    len, out, in);

        break;

    default:

        error_setg(errp, "Unsupported cipher algorithm %d",

                   cipher->alg);

        return -1;

    }

    return 0;

}

int qcrypto_cipher_encrypt(QCryptoCipher *cipher,

                           const void *in,

                           void *out,

                           size_t len,

                           Error **errp)

{

    QCryptoCipherNettle *ctx = cipher->opaque;



    switch (cipher->mode) {

    case QCRYPTO_CIPHER_MODE_ECB:

        ctx->alg_encrypt(ctx->ctx_encrypt, len, out, in);

        break;



    case QCRYPTO_CIPHER_MODE_CBC:

        cbc_encrypt(ctx->ctx_encrypt, ctx->alg_encrypt,

                    ctx->niv, ctx->iv,

                    len, out, in);

        break;

    default:

        error_setg(errp, "Unsupported cipher algorithm %d",

                   cipher->alg);

        return -1;

    }

    return 0;

}

                    ctx->niv, ctx->iv,
int FUNC_0(QCryptoCipher *VAR_0,

                           const void *VAR_1,

                           void *VAR_2,

                           size_t VAR_3,

                           Error **VAR_4)

{

    QCryptoCipherNettle *ctx = VAR_0->opaque;



    switch (VAR_0->mode) {

    case QCRYPTO_CIPHER_MODE_ECB:

        ctx->alg_encrypt(ctx->ctx_encrypt, VAR_3, VAR_2, VAR_1);

        break;



    case QCRYPTO_CIPHER_MODE_CBC:

        cbc_encrypt(ctx->ctx_encrypt, ctx->alg_encrypt,

                    ctx->niv, ctx->iv,

                    VAR_3, VAR_2, VAR_1);

        break;

    default:

        error_setg(VAR_4, "Unsupported VAR_0 algorithm %d",

                   VAR_0->alg);

        return -1;

    }

    return 0;

}

int FUNC_0(QCryptoCipher *VAR_0,
const void *VAR_1,
void *VAR_2,
size_t VAR_3,
Error **VAR_4)
{ QCryptoCipherNettle *ctx = VAR_0->opaque; switch (VAR_0->mode) { case QCRYPTO_CIPHER_MODE_ECB:
ctx->alg_encrypt(ctx->ctx_encrypt, VAR_3, VAR_2, VAR_1); break; case QCRYPTO_CIPHER_MODE_CBC:
cbc_encrypt(ctx->ctx_encrypt, ctx->alg_encrypt,
ctx->niv, ctx->iv,
VAR_3, VAR_2, VAR_1); break; default:
error_setg(VAR_4, "Unsupported VAR_0 algorithm %d",
VAR_0->alg); return -1; } return 0; }