2 * Header file for SHA hardware acceleration
4 * Copyright (c) 2012 Samsung Electronics
6 * SPDX-License-Identifier: GPL-2.0+
13 * Computes hash value of input pbuf using h/w acceleration
15 * @param in_addr A pointer to the input buffer
16 * @param bufleni Byte length of input buffer
17 * @param out_addr A pointer to the output buffer. When complete
18 * 32 bytes are copied to pout[0]...pout[31]. Thus, a user
19 * should allocate at least 32 bytes at pOut in advance.
20 * @param chunk_size chunk size for sha256
22 void hw_sha256(const uchar * in_addr, uint buflen,
23 uchar * out_addr, uint chunk_size);
26 * Computes hash value of input pbuf using h/w acceleration
28 * @param in_addr A pointer to the input buffer
29 * @param bufleni Byte length of input buffer
30 * @param out_addr A pointer to the output buffer. When complete
31 * 32 bytes are copied to pout[0]...pout[31]. Thus, a user
32 * should allocate at least 32 bytes at pOut in advance.
33 * @param chunk_size chunk_size for sha1
35 void hw_sha1(const uchar * in_addr, uint buflen,
36 uchar * out_addr, uint chunk_size);
39 * Create the context for sha progressive hashing using h/w acceleration
41 * @algo: Pointer to the hash_algo struct
42 * @ctxp: Pointer to the pointer of the context for hashing
43 * @return 0 if ok, -ve on error
45 int hw_sha_init(struct hash_algo *algo, void **ctxp);
48 * Update buffer for sha progressive hashing using h/w acceleration
50 * The context is freed by this function if an error occurs.
52 * @algo: Pointer to the hash_algo struct
53 * @ctx: Pointer to the context for hashing
54 * @buf: Pointer to the buffer being hashed
55 * @size: Size of the buffer being hashed
56 * @is_last: 1 if this is the last update; 0 otherwise
57 * @return 0 if ok, -ve on error
59 int hw_sha_update(struct hash_algo *algo, void *ctx, const void *buf,
60 unsigned int size, int is_last);
63 * Copy sha hash result at destination location
65 * The context is freed after completion of hash operation or after an error.
67 * @algo: Pointer to the hash_algo struct
68 * @ctx: Pointer to the context for hashing
69 * @dest_buf: Pointer to the destination buffer where hash is to be copied
70 * @size: Size of the buffer being hashed
71 * @return 0 if ok, -ve on error
73 int hw_sha_finish(struct hash_algo *algo, void *ctx, void *dest_buf,