Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * API for Atmel Secure Protocol Layers Improved Performances (SPLIP)
0004  *
0005  * Copyright (C) 2016 Atmel Corporation
0006  *
0007  * Author: Cyrille Pitchen <cyrille.pitchen@atmel.com>
0008  *
0009  * This driver is based on drivers/mtd/spi-nor/fsl-quadspi.c from Freescale.
0010  */
0011 
0012 #ifndef __ATMEL_AUTHENC_H__
0013 #define __ATMEL_AUTHENC_H__
0014 
0015 #if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
0016 
0017 #include <crypto/authenc.h>
0018 #include <crypto/hash.h>
0019 #include <crypto/sha1.h>
0020 #include <crypto/sha2.h>
0021 #include "atmel-sha-regs.h"
0022 
0023 struct atmel_aes_dev;
0024 typedef int (*atmel_aes_authenc_fn_t)(struct atmel_aes_dev *, int, bool);
0025 
0026 struct atmel_sha_authenc_ctx;
0027 
0028 bool atmel_sha_authenc_is_ready(void);
0029 unsigned int atmel_sha_authenc_get_reqsize(void);
0030 
0031 struct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode);
0032 void atmel_sha_authenc_free(struct atmel_sha_authenc_ctx *auth);
0033 int atmel_sha_authenc_setkey(struct atmel_sha_authenc_ctx *auth,
0034                  const u8 *key, unsigned int keylen, u32 flags);
0035 
0036 int atmel_sha_authenc_schedule(struct ahash_request *req,
0037                    struct atmel_sha_authenc_ctx *auth,
0038                    atmel_aes_authenc_fn_t cb,
0039                    struct atmel_aes_dev *dd);
0040 int atmel_sha_authenc_init(struct ahash_request *req,
0041                struct scatterlist *assoc, unsigned int assoclen,
0042                unsigned int textlen,
0043                atmel_aes_authenc_fn_t cb,
0044                struct atmel_aes_dev *dd);
0045 int atmel_sha_authenc_final(struct ahash_request *req,
0046                 u32 *digest, unsigned int digestlen,
0047                 atmel_aes_authenc_fn_t cb,
0048                 struct atmel_aes_dev *dd);
0049 void  atmel_sha_authenc_abort(struct ahash_request *req);
0050 
0051 #endif /* CONFIG_CRYPTO_DEV_ATMEL_AUTHENC */
0052 
0053 #endif /* __ATMEL_AUTHENC_H__ */