5cd7d8564a
The aspeed ast2600 accumulative mode is described in datasheet ast2600v10.pdf section 25.6.4: 1. Allocating and initiating accumulative hash digest write buffer with initial state. * Since QEMU crypto/hash api doesn't provide the API to set initial state of hash library, and the initial state is already set by crypto library (gcrypt/glib/...), so skip this step. 2. Calculating accumulative hash digest. (a) When receiving the last accumulative data, software need to add padding message at the end of the accumulative data. Padding message described in specific of MD5, SHA-1, SHA224, SHA256, SHA512, SHA512/224, SHA512/256. * Since the crypto library (gcrypt/glib) already pad the padding message internally. * This patch is to remove the padding message which fed byguest machine driver. Signed-off-by: Troy Lee <troy_lee@aspeedtech.com> Signed-off-by: Steven Lee <steven_lee@aspeedtech.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20220426021120.28255-3-steven_lee@aspeedtech.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
49 lines
1.0 KiB
C
49 lines
1.0 KiB
C
/*
|
|
* ASPEED Hash and Crypto Engine
|
|
*
|
|
* Copyright (C) 2021 IBM Corp.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef ASPEED_HACE_H
|
|
#define ASPEED_HACE_H
|
|
|
|
#include "hw/sysbus.h"
|
|
|
|
#define TYPE_ASPEED_HACE "aspeed.hace"
|
|
#define TYPE_ASPEED_AST2400_HACE TYPE_ASPEED_HACE "-ast2400"
|
|
#define TYPE_ASPEED_AST2500_HACE TYPE_ASPEED_HACE "-ast2500"
|
|
#define TYPE_ASPEED_AST2600_HACE TYPE_ASPEED_HACE "-ast2600"
|
|
OBJECT_DECLARE_TYPE(AspeedHACEState, AspeedHACEClass, ASPEED_HACE)
|
|
|
|
#define ASPEED_HACE_NR_REGS (0x64 >> 2)
|
|
#define ASPEED_HACE_MAX_SG 256 /* max number of entries */
|
|
|
|
struct AspeedHACEState {
|
|
SysBusDevice parent;
|
|
|
|
MemoryRegion iomem;
|
|
qemu_irq irq;
|
|
|
|
struct iovec iov_cache[ASPEED_HACE_MAX_SG];
|
|
uint32_t regs[ASPEED_HACE_NR_REGS];
|
|
uint32_t total_req_len;
|
|
uint32_t iov_count;
|
|
|
|
MemoryRegion *dram_mr;
|
|
AddressSpace dram_as;
|
|
};
|
|
|
|
|
|
struct AspeedHACEClass {
|
|
SysBusDeviceClass parent_class;
|
|
|
|
uint32_t src_mask;
|
|
uint32_t dest_mask;
|
|
uint32_t key_mask;
|
|
uint32_t hash_mask;
|
|
};
|
|
|
|
#endif /* _ASPEED_HACE_H_ */
|