linux/drivers/crypto/atmel-authenc.h
<<
>>
Prefs
   1/*
   2 * API for Atmel Secure Protocol Layers Improved Performances (SPLIP)
   3 *
   4 * Copyright (C) 2016 Atmel Corporation
   5 *
   6 * Author: Cyrille Pitchen <cyrille.pitchen@atmel.com>
   7 *
   8 * This program is free software; you can redistribute it and/or modify
   9 * it under the terms of the GNU General Public License version 2 as
  10 * published by the Free Software Foundation.
  11 *
  12 * This program is distributed in the hope that it will be useful, but WITHOUT
  13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  15 * more details.
  16 *
  17 * You should have received a copy of the GNU General Public License along with
  18 * this program.  If not, see <http://www.gnu.org/licenses/>.
  19 *
  20 * This driver is based on drivers/mtd/spi-nor/fsl-quadspi.c from Freescale.
  21 */
  22
  23#ifndef __ATMEL_AUTHENC_H__
  24#define __ATMEL_AUTHENC_H__
  25
  26#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC
  27
  28#include <crypto/authenc.h>
  29#include <crypto/hash.h>
  30#include <crypto/sha.h>
  31#include "atmel-sha-regs.h"
  32
  33struct atmel_aes_dev;
  34typedef int (*atmel_aes_authenc_fn_t)(struct atmel_aes_dev *, int, bool);
  35
  36struct atmel_sha_authenc_ctx;
  37
  38bool atmel_sha_authenc_is_ready(void);
  39unsigned int atmel_sha_authenc_get_reqsize(void);
  40
  41struct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode);
  42void atmel_sha_authenc_free(struct atmel_sha_authenc_ctx *auth);
  43int atmel_sha_authenc_setkey(struct atmel_sha_authenc_ctx *auth,
  44                             const u8 *key, unsigned int keylen,
  45                             u32 *flags);
  46
  47int atmel_sha_authenc_schedule(struct ahash_request *req,
  48                               struct atmel_sha_authenc_ctx *auth,
  49                               atmel_aes_authenc_fn_t cb,
  50                               struct atmel_aes_dev *dd);
  51int atmel_sha_authenc_init(struct ahash_request *req,
  52                           struct scatterlist *assoc, unsigned int assoclen,
  53                           unsigned int textlen,
  54                           atmel_aes_authenc_fn_t cb,
  55                           struct atmel_aes_dev *dd);
  56int atmel_sha_authenc_final(struct ahash_request *req,
  57                            u32 *digest, unsigned int digestlen,
  58                            atmel_aes_authenc_fn_t cb,
  59                            struct atmel_aes_dev *dd);
  60void  atmel_sha_authenc_abort(struct ahash_request *req);
  61
  62#endif /* CONFIG_CRYPTO_DEV_ATMEL_AUTHENC */
  63
  64#endif /* __ATMEL_AUTHENC_H__ */
  65