xref: /openbmc/qemu/crypto/hashpriv.h (revision 7e3b6d8063f245d27eecce5aabe624b5785f2a77)
1aa8efad9SLongpeng(Mike) /*
2aa8efad9SLongpeng(Mike)  * QEMU Crypto hash driver supports
3aa8efad9SLongpeng(Mike)  *
4*190feb48SAlejandro Zeise  * Copyright (c) 2024 Seagate Technology LLC and/or its Affiliates
5aa8efad9SLongpeng(Mike)  * Copyright (c) 2017 HUAWEI TECHNOLOGIES CO., LTD.
6aa8efad9SLongpeng(Mike)  *
7aa8efad9SLongpeng(Mike)  * Authors:
8aa8efad9SLongpeng(Mike)  *    Longpeng(Mike) <longpeng2@huawei.com>
9aa8efad9SLongpeng(Mike)  *
10aa8efad9SLongpeng(Mike)  * This work is licensed under the terms of the GNU GPL, version 2 or
11aa8efad9SLongpeng(Mike)  * (at your option) any later version.  See the COPYING file in the
12aa8efad9SLongpeng(Mike)  * top-level directory.
13aa8efad9SLongpeng(Mike)  *
14aa8efad9SLongpeng(Mike)  */
15aa8efad9SLongpeng(Mike) 
16aa8efad9SLongpeng(Mike) #ifndef QCRYPTO_HASHPRIV_H
17aa8efad9SLongpeng(Mike) #define QCRYPTO_HASHPRIV_H
18aa8efad9SLongpeng(Mike) 
19*190feb48SAlejandro Zeise #include "crypto/hash.h"
20*190feb48SAlejandro Zeise 
21aa8efad9SLongpeng(Mike) typedef struct QCryptoHashDriver QCryptoHashDriver;
22aa8efad9SLongpeng(Mike) 
23aa8efad9SLongpeng(Mike) struct QCryptoHashDriver {
24*190feb48SAlejandro Zeise     QCryptoHash *(*hash_new)(QCryptoHashAlgo alg, Error **errp);
25*190feb48SAlejandro Zeise     int (*hash_update)(QCryptoHash *hash,
26*190feb48SAlejandro Zeise                        const struct iovec *iov,
27*190feb48SAlejandro Zeise                        size_t niov,
28*190feb48SAlejandro Zeise                        Error **errp);
29*190feb48SAlejandro Zeise     int (*hash_finalize)(QCryptoHash *hash,
30*190feb48SAlejandro Zeise                          uint8_t **result,
31*190feb48SAlejandro Zeise                          size_t *resultlen,
32*190feb48SAlejandro Zeise                          Error **errp);
33*190feb48SAlejandro Zeise     void (*hash_free)(QCryptoHash *hash);
34aa8efad9SLongpeng(Mike) };
35aa8efad9SLongpeng(Mike) 
36aa8efad9SLongpeng(Mike) extern QCryptoHashDriver qcrypto_hash_lib_driver;
37aa8efad9SLongpeng(Mike) 
389a059773SLongpeng(Mike) #ifdef CONFIG_AF_ALG
399a059773SLongpeng(Mike) 
409a059773SLongpeng(Mike) #include "afalgpriv.h"
419a059773SLongpeng(Mike) 
429a059773SLongpeng(Mike) extern QCryptoHashDriver qcrypto_hash_afalg_driver;
439a059773SLongpeng(Mike) 
449a059773SLongpeng(Mike) #endif
459a059773SLongpeng(Mike) 
46aa8efad9SLongpeng(Mike) #endif
47