atmel-authenc.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * API for Atmel Secure Protocol Layers Improved Performances (SPLIP)
  4. *
  5. * Copyright (C) 2016 Atmel Corporation
  6. *
  7. * Author: Cyrille Pitchen <[email protected]>
  8. *
  9. * This driver is based on drivers/mtd/spi-nor/fsl-quadspi.c from Freescale.
  10. */
  11. #ifndef __ATMEL_AUTHENC_H__
  12. #define __ATMEL_AUTHENC_H__
  13. #if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
  14. #include <crypto/authenc.h>
  15. #include <crypto/hash.h>
  16. #include <crypto/sha1.h>
  17. #include <crypto/sha2.h>
  18. #include "atmel-sha-regs.h"
  19. struct atmel_aes_dev;
  20. typedef int (*atmel_aes_authenc_fn_t)(struct atmel_aes_dev *, int, bool);
  21. struct atmel_sha_authenc_ctx;
  22. bool atmel_sha_authenc_is_ready(void);
  23. unsigned int atmel_sha_authenc_get_reqsize(void);
  24. struct atmel_sha_authenc_ctx *atmel_sha_authenc_spawn(unsigned long mode);
  25. void atmel_sha_authenc_free(struct atmel_sha_authenc_ctx *auth);
  26. int atmel_sha_authenc_setkey(struct atmel_sha_authenc_ctx *auth,
  27. const u8 *key, unsigned int keylen, u32 flags);
  28. int atmel_sha_authenc_schedule(struct ahash_request *req,
  29. struct atmel_sha_authenc_ctx *auth,
  30. atmel_aes_authenc_fn_t cb,
  31. struct atmel_aes_dev *dd);
  32. int atmel_sha_authenc_init(struct ahash_request *req,
  33. struct scatterlist *assoc, unsigned int assoclen,
  34. unsigned int textlen,
  35. atmel_aes_authenc_fn_t cb,
  36. struct atmel_aes_dev *dd);
  37. int atmel_sha_authenc_final(struct ahash_request *req,
  38. u32 *digest, unsigned int digestlen,
  39. atmel_aes_authenc_fn_t cb,
  40. struct atmel_aes_dev *dd);
  41. void atmel_sha_authenc_abort(struct ahash_request *req);
  42. #endif /* CONFIG_CRYPTO_DEV_ATMEL_AUTHENC */
  43. #endif /* __ATMEL_AUTHENC_H__ */