xref: /openbmc/qemu/crypto/cipher-stub.c.inc (revision 4589acc17ae1a8e8c4c530e249353c929850858a)
1/*
2 * SPDX-License-Identifier: GPL-2.0-or-later
3 *
4 * QEMU Crypto cipher impl stub
5 *
6 * Copyright (c) 2025 Red Hat, Inc.
7 *
8 */
9
10bool qcrypto_cipher_supports(QCryptoCipherAlgo alg,
11                             QCryptoCipherMode mode)
12{
13    return false;
14}
15
16static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgo alg,
17                                             QCryptoCipherMode mode,
18                                             const uint8_t *key,
19                                             size_t nkey,
20                                             Error **errp)
21{
22    if (!qcrypto_cipher_validate_key_length(alg, mode, nkey, errp)) {
23        return NULL;
24    }
25
26    error_setg(errp,
27               "Unsupported cipher algorithm %s, no crypto library enabled in build",
28               QCryptoCipherAlgo_str(alg));
29    return NULL;
30}
31