/src/barebox/include/crypto/pbl-sha.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | | #ifndef __PBL_SHA_H_ |
3 | | |
4 | | #define __PBL_SHA_H_ |
5 | | |
6 | | #include <crypto/sha.h> |
7 | | #include <digest.h> |
8 | | #include <types.h> |
9 | | |
10 | | int sha256_init(struct digest *desc); |
11 | | int sha256_update(struct digest *desc, const void *data, unsigned long len); |
12 | | int sha256_final(struct digest *desc, u8 *out); |
13 | | |
14 | | /* One-shot SHA-256 that picks the best transform available in the PBL. */ |
15 | | void pbl_sha256(const void *buf, size_t len, u8 out[SHA256_DIGEST_SIZE]); |
16 | | |
17 | | #ifdef CONFIG_DIGEST_SHA256_ARM64_CE |
18 | | /* ARMv8 Crypto Extensions transform; returns -EOPNOTSUPP if unavailable. */ |
19 | | int pbl_sha256_ce(const void *buf, size_t len, u8 out[SHA256_DIGEST_SIZE]); |
20 | | #else |
21 | | static inline int pbl_sha256_ce(const void *buf, size_t len, u8 out[SHA256_DIGEST_SIZE]) |
22 | 0 | { |
23 | 0 | return -EOPNOTSUPP; |
24 | 0 | } Unexecuted instantiation: sha2.c:pbl_sha256_ce Unexecuted instantiation: sha4.c:pbl_sha256_ce Unexecuted instantiation: sha.c:pbl_sha256_ce |
25 | | #endif |
26 | | |
27 | | int sha512_init(struct digest *desc); |
28 | | int sha512_update(struct digest *desc, const void *data, unsigned long len); |
29 | | int sha512_final(struct digest *desc, u8 *out); |
30 | | |
31 | | /* One-shot SHA-512 that picks the best transform available in the PBL. */ |
32 | | void pbl_sha512(const void *buf, size_t len, u8 out[SHA512_DIGEST_SIZE]); |
33 | | |
34 | | int sha384_init(struct digest *desc); |
35 | | int sha384_final(struct digest *desc, u8 *out); |
36 | | |
37 | | /* One-shot SHA-384 that picks the best transform available in the PBL. */ |
38 | | void pbl_sha384(const void *buf, size_t len, u8 out[SHA384_DIGEST_SIZE]); |
39 | | |
40 | | #endif /* __PBL-SHA_H_ */ |