^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * API for Atmel Secure Protocol Layers Improved Performances (SPLIP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2016 Atmel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Author: Cyrille Pitchen <cyrille.pitchen@atmel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * This driver is based on drivers/mtd/spi-nor/fsl-quadspi.c from Freescale.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #ifndef __ATMEL_AUTHENC_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define __ATMEL_AUTHENC_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <crypto/authenc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <crypto/hash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <crypto/sha.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "atmel-sha-regs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct atmel_aes_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) typedef int (*atmel_aes_authenc_fn_t)(struct atmel_aes_dev *, int, bool);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct atmel_sha_authenc_ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) bool atmel_sha_authenc_is_ready(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) unsigned int atmel_sha_authenc_get_reqsize(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) void atmel_sha_authenc_free(struct atmel_sha_authenc_ctx *auth);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) int atmel_sha_authenc_setkey(struct atmel_sha_authenc_ctx *auth,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) const u8 *key, unsigned int keylen, u32 flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int atmel_sha_authenc_schedule(struct ahash_request *req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct atmel_sha_authenc_ctx *auth,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) atmel_aes_authenc_fn_t cb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct atmel_aes_dev *dd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int atmel_sha_authenc_init(struct ahash_request *req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct scatterlist *assoc, unsigned int assoclen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) unsigned int textlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) atmel_aes_authenc_fn_t cb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct atmel_aes_dev *dd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) int atmel_sha_authenc_final(struct ahash_request *req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) u32 *digest, unsigned int digestlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) atmel_aes_authenc_fn_t cb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct atmel_aes_dev *dd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) void atmel_sha_authenc_abort(struct ahash_request *req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #endif /* CONFIG_CRYPTO_DEV_ATMEL_AUTHENC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #endif /* __ATMEL_AUTHENC_H__ */