pkc_desc.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * caam - Freescale FSL CAAM support for Public Key Cryptography descriptors
  3. *
  4. * Copyright 2016 Freescale Semiconductor, Inc.
  5. *
  6. * There is no Shared Descriptor for PKC so that the Job Descriptor must carry
  7. * all the desired key parameters, input and output pointers.
  8. */
  9. #include "caampkc.h"
  10. #include "desc_constr.h"
  11. /* Descriptor for RSA Public operation */
  12. void init_rsa_pub_desc(u32 *desc, struct rsa_pub_pdb *pdb)
  13. {
  14. init_job_desc_pdb(desc, 0, sizeof(*pdb));
  15. append_cmd(desc, pdb->sgf);
  16. append_ptr(desc, pdb->f_dma);
  17. append_ptr(desc, pdb->g_dma);
  18. append_ptr(desc, pdb->n_dma);
  19. append_ptr(desc, pdb->e_dma);
  20. append_cmd(desc, pdb->f_len);
  21. append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSAENC_PUBKEY);
  22. }
  23. /* Descriptor for RSA Private operation - Private Key Form #1 */
  24. void init_rsa_priv_f1_desc(u32 *desc, struct rsa_priv_f1_pdb *pdb)
  25. {
  26. init_job_desc_pdb(desc, 0, sizeof(*pdb));
  27. append_cmd(desc, pdb->sgf);
  28. append_ptr(desc, pdb->g_dma);
  29. append_ptr(desc, pdb->f_dma);
  30. append_ptr(desc, pdb->n_dma);
  31. append_ptr(desc, pdb->d_dma);
  32. append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY |
  33. RSA_PRIV_KEY_FRM_1);
  34. }