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