gaurav rana | ef20159 | 2015-02-20 12:51:46 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Freescale Semiconductor, Inc. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef _SHA_H |
| 9 | #define _SHA_H |
| 10 | |
| 11 | #include <fsl_sec.h> |
| 12 | #include <hash.h> |
| 13 | #include "jr.h" |
| 14 | |
| 15 | /* We support at most 32 Scatter/Gather Entries.*/ |
| 16 | #define MAX_SG_32 32 |
| 17 | |
| 18 | /* |
| 19 | * Hash context contains the following fields |
| 20 | * @sha_desc: Sha Descriptor |
| 21 | * @sg_num: number of entries in sg table |
| 22 | * @len: total length of buffer |
| 23 | * @sg_tbl: sg entry table |
| 24 | * @hash: index to the hash calculated |
| 25 | */ |
| 26 | struct sha_ctx { |
| 27 | uint32_t sha_desc[64]; |
| 28 | uint32_t sg_num; |
| 29 | uint32_t len; |
| 30 | struct sg_entry sg_tbl[MAX_SG_32]; |
| 31 | u8 hash[HASH_MAX_DIGEST_SIZE]; |
| 32 | }; |
| 33 | |
| 34 | #endif |