Path: blob/master/drivers/crypto/inside-secure/eip93/eip93-hash.h
26285 views
/* SPDX-License-Identifier: GPL-2.01*2* Copyright (C) 2019 - 20213*4* Richard van Schagen <[email protected]>5* Christian Marangi <[email protected]6*/7#ifndef _EIP93_HASH_H_8#define _EIP93_HASH_H_910#include <crypto/sha2.h>1112#include "eip93-main.h"13#include "eip93-regs.h"1415struct eip93_hash_ctx {16struct eip93_device *eip93;17u32 flags;1819u8 ipad[SHA256_BLOCK_SIZE] __aligned(sizeof(u32));20u8 opad[SHA256_DIGEST_SIZE] __aligned(sizeof(u32));21};2223struct eip93_hash_reqctx {24/* Placement is important for DMA align */25struct {26struct sa_record sa_record;27struct sa_record sa_record_hmac;28struct sa_state sa_state;29} __aligned(CRYPTO_DMA_ALIGN);3031dma_addr_t sa_record_base;32dma_addr_t sa_record_hmac_base;33dma_addr_t sa_state_base;3435/* Don't enable HASH_FINALIZE when last block is sent */36bool partial_hash;3738/* Set to signal interrupt is for final packet */39bool finalize;4041/*42* EIP93 requires data to be accumulated in block of 64 bytes43* for intermediate hash calculation.44*/45u64 len;46u32 data_used;4748u8 data[SHA256_BLOCK_SIZE] __aligned(sizeof(u32));49dma_addr_t data_dma;5051struct list_head blocks;52};5354struct mkt_hash_block {55struct list_head list;56u8 data[SHA256_BLOCK_SIZE] __aligned(sizeof(u32));57dma_addr_t data_dma;58};5960struct eip93_hash_export_state {61u64 len;62u32 data_used;6364u32 state_len[2];65u8 state_hash[SHA256_DIGEST_SIZE] __aligned(sizeof(u32));6667u8 data[SHA256_BLOCK_SIZE] __aligned(sizeof(u32));68};6970void eip93_hash_handle_result(struct crypto_async_request *async, int err);7172extern struct eip93_alg_template eip93_alg_md5;73extern struct eip93_alg_template eip93_alg_sha1;74extern struct eip93_alg_template eip93_alg_sha224;75extern struct eip93_alg_template eip93_alg_sha256;76extern struct eip93_alg_template eip93_alg_hmac_md5;77extern struct eip93_alg_template eip93_alg_hmac_sha1;78extern struct eip93_alg_template eip93_alg_hmac_sha224;79extern struct eip93_alg_template eip93_alg_hmac_sha256;8081#endif /* _EIP93_HASH_H_ */828384