aboutsummaryrefslogtreecommitdiff
path: root/crypto/cipher-stub.c.inc
blob: 1b7ea81eac4b74b65df328d7d474d62d1f503ef4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * QEMU Crypto cipher impl stub
 *
 * Copyright (c) 2025 Red Hat, Inc.
 *
 */

bool qcrypto_cipher_supports(QCryptoCipherAlgo alg,
                             QCryptoCipherMode mode)
{
    return false;
}

static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgo alg,
                                             QCryptoCipherMode mode,
                                             const uint8_t *key,
                                             size_t nkey,
                                             Error **errp)
{
    if (!qcrypto_cipher_validate_key_length(alg, mode, nkey, errp)) {
        return NULL;
    }

    error_setg(errp,
               "Unsupported cipher algorithm %s, no crypto library enabled in build",
               QCryptoCipherAlgo_str(alg));
    return NULL;
}