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