Tudor Ambarus | 820684c | 2018-08-21 16:36:09 +0300 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Cyrille Pitchen | 89a82ef | 2017-01-26 17:07:56 +0100 | [diff] [blame] | 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 | * |
Cyrille Pitchen | 89a82ef | 2017-01-26 17:07:56 +0100 | [diff] [blame] | 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 | |
Herbert Xu | 1520c72 | 2019-10-28 15:39:07 +0800 | [diff] [blame] | 15 | #if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) |
Cyrille Pitchen | 89a82ef | 2017-01-26 17:07:56 +0100 | [diff] [blame] | 16 | |
| 17 | #include <crypto/authenc.h> |
| 18 | #include <crypto/hash.h> |
Eric Biggers | a24d22b | 2020-11-12 21:20:21 -0800 | [diff] [blame] | 19 | #include <crypto/sha1.h> |
| 20 | #include <crypto/sha2.h> |
Cyrille Pitchen | 89a82ef | 2017-01-26 17:07:56 +0100 | [diff] [blame] | 21 | #include "atmel-sha-regs.h" |
| 22 | |
| 23 | struct atmel_aes_dev; |
| 24 | typedef int (*atmel_aes_authenc_fn_t)(struct atmel_aes_dev *, int, bool); |
| 25 | |
| 26 | struct atmel_sha_authenc_ctx; |
| 27 | |
| 28 | bool atmel_sha_authenc_is_ready(void); |
| 29 | unsigned int atmel_sha_authenc_get_reqsize(void); |
| 30 | |
| 31 | struct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode); |
| 32 | void atmel_sha_authenc_free(struct atmel_sha_authenc_ctx *auth); |
| 33 | int atmel_sha_authenc_setkey(struct atmel_sha_authenc_ctx *auth, |
Eric Biggers | af5034e | 2019-12-30 21:19:38 -0600 | [diff] [blame] | 34 | const u8 *key, unsigned int keylen, u32 flags); |
Cyrille Pitchen | 89a82ef | 2017-01-26 17:07:56 +0100 | [diff] [blame] | 35 | |
| 36 | int atmel_sha_authenc_schedule(struct ahash_request *req, |
| 37 | struct atmel_sha_authenc_ctx *auth, |
| 38 | atmel_aes_authenc_fn_t cb, |
| 39 | struct atmel_aes_dev *dd); |
| 40 | int atmel_sha_authenc_init(struct ahash_request *req, |
| 41 | struct scatterlist *assoc, unsigned int assoclen, |
| 42 | unsigned int textlen, |
| 43 | atmel_aes_authenc_fn_t cb, |
| 44 | struct atmel_aes_dev *dd); |
| 45 | int atmel_sha_authenc_final(struct ahash_request *req, |
| 46 | u32 *digest, unsigned int digestlen, |
| 47 | atmel_aes_authenc_fn_t cb, |
| 48 | struct atmel_aes_dev *dd); |
| 49 | void atmel_sha_authenc_abort(struct ahash_request *req); |
| 50 | |
| 51 | #endif /* CONFIG_CRYPTO_DEV_ATMEL_AUTHENC */ |
| 52 | |
| 53 | #endif /* __ATMEL_AUTHENC_H__ */ |