atmel-authenc.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #ifndef __ATMEL_AUTHENC_H__
  23. #define __ATMEL_AUTHENC_H__
  24. #if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
  25. #include <crypto/authenc.h>
  26. #include <crypto/hash.h>
  27. #include <crypto/sha.h>
  28. #include "atmel-sha-regs.h"
  29. struct atmel_aes_dev;
  30. typedef int (*atmel_aes_authenc_fn_t)(struct atmel_aes_dev *, int, bool);
  31. struct atmel_sha_authenc_ctx;
  32. bool atmel_sha_authenc_is_ready(void);
  33. unsigned int atmel_sha_authenc_get_reqsize(void);
  34. struct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode);
  35. void atmel_sha_authenc_free(struct atmel_sha_authenc_ctx *auth);
  36. int atmel_sha_authenc_setkey(struct atmel_sha_authenc_ctx *auth,
  37. const u8 *key, unsigned int keylen,
  38. u32 *flags);
  39. int atmel_sha_authenc_schedule(struct ahash_request *req,
  40. struct atmel_sha_authenc_ctx *auth,
  41. atmel_aes_authenc_fn_t cb,
  42. struct atmel_aes_dev *dd);
  43. int atmel_sha_authenc_init(struct ahash_request *req,
  44. struct scatterlist *assoc, unsigned int assoclen,
  45. unsigned int textlen,
  46. atmel_aes_authenc_fn_t cb,
  47. struct atmel_aes_dev *dd);
  48. int atmel_sha_authenc_final(struct ahash_request *req,
  49. u32 *digest, unsigned int digestlen,
  50. atmel_aes_authenc_fn_t cb,
  51. struct atmel_aes_dev *dd);
  52. void atmel_sha_authenc_abort(struct ahash_request *req);
  53. #endif /* CONFIG_CRYPTO_DEV_ATMEL_AUTHENC */
  54. #endif /* __ATMEL_AUTHENC_H__ */