162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * API for Atmel Secure Protocol Layers Improved Performances (SPLIP)
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2016 Atmel Corporation
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Author: Cyrille Pitchen <cyrille.pitchen@atmel.com>
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * This driver is based on drivers/mtd/spi-nor/fsl-quadspi.c from Freescale.
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#ifndef __ATMEL_AUTHENC_H__
1362306a36Sopenharmony_ci#define __ATMEL_AUTHENC_H__
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#include <crypto/authenc.h>
1862306a36Sopenharmony_ci#include <crypto/hash.h>
1962306a36Sopenharmony_ci#include <crypto/sha1.h>
2062306a36Sopenharmony_ci#include <crypto/sha2.h>
2162306a36Sopenharmony_ci#include "atmel-sha-regs.h"
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_cistruct atmel_aes_dev;
2462306a36Sopenharmony_citypedef int (*atmel_aes_authenc_fn_t)(struct atmel_aes_dev *, int, bool);
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cistruct atmel_sha_authenc_ctx;
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_cibool atmel_sha_authenc_is_ready(void);
2962306a36Sopenharmony_ciunsigned int atmel_sha_authenc_get_reqsize(void);
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_cistruct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode);
3262306a36Sopenharmony_civoid atmel_sha_authenc_free(struct atmel_sha_authenc_ctx *auth);
3362306a36Sopenharmony_ciint atmel_sha_authenc_setkey(struct atmel_sha_authenc_ctx *auth,
3462306a36Sopenharmony_ci			     const u8 *key, unsigned int keylen, u32 flags);
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciint atmel_sha_authenc_schedule(struct ahash_request *req,
3762306a36Sopenharmony_ci			       struct atmel_sha_authenc_ctx *auth,
3862306a36Sopenharmony_ci			       atmel_aes_authenc_fn_t cb,
3962306a36Sopenharmony_ci			       struct atmel_aes_dev *dd);
4062306a36Sopenharmony_ciint atmel_sha_authenc_init(struct ahash_request *req,
4162306a36Sopenharmony_ci			   struct scatterlist *assoc, unsigned int assoclen,
4262306a36Sopenharmony_ci			   unsigned int textlen,
4362306a36Sopenharmony_ci			   atmel_aes_authenc_fn_t cb,
4462306a36Sopenharmony_ci			   struct atmel_aes_dev *dd);
4562306a36Sopenharmony_ciint atmel_sha_authenc_final(struct ahash_request *req,
4662306a36Sopenharmony_ci			    u32 *digest, unsigned int digestlen,
4762306a36Sopenharmony_ci			    atmel_aes_authenc_fn_t cb,
4862306a36Sopenharmony_ci			    struct atmel_aes_dev *dd);
4962306a36Sopenharmony_civoid  atmel_sha_authenc_abort(struct ahash_request *req);
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#endif /* CONFIG_CRYPTO_DEV_ATMEL_AUTHENC */
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#endif /* __ATMEL_AUTHENC_H__ */
54