mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
a1cf573ee9
i.MX8 mScale SoC still use 32-bit addresses in its CAAM implmentation, so we can't rely on sizeof(dma_addr_t) to detemine CAAM pointer size. Convert the code to query CTPR and MCFGR for that during driver probing. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Chris Spencer <christopher.spencer@sea.co.uk> Cc: Cory Tusar <cory.tusar@zii.aero> Cc: Chris Healy <cphealy@gmail.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Horia Geantă <horia.geanta@nxp.com> Cc: Aymen Sghaier <aymen.sghaier@nxp.com> Cc: Leonard Crestez <leonard.crestez@nxp.com> Cc: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
73 lines
2.4 KiB
C
73 lines
2.4 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* caam - Freescale FSL CAAM support for Public Key Cryptography descriptors
|
|
*
|
|
* Copyright 2016 Freescale Semiconductor, Inc.
|
|
*
|
|
* There is no Shared Descriptor for PKC so that the Job Descriptor must carry
|
|
* all the desired key parameters, input and output pointers.
|
|
*/
|
|
#include "caampkc.h"
|
|
#include "desc_constr.h"
|
|
|
|
/* Descriptor for RSA Public operation */
|
|
void init_rsa_pub_desc(u32 *desc, struct rsa_pub_pdb *pdb)
|
|
{
|
|
init_job_desc_pdb(desc, 0, SIZEOF_RSA_PUB_PDB);
|
|
append_cmd(desc, pdb->sgf);
|
|
append_ptr(desc, pdb->f_dma);
|
|
append_ptr(desc, pdb->g_dma);
|
|
append_ptr(desc, pdb->n_dma);
|
|
append_ptr(desc, pdb->e_dma);
|
|
append_cmd(desc, pdb->f_len);
|
|
append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSAENC_PUBKEY);
|
|
}
|
|
|
|
/* Descriptor for RSA Private operation - Private Key Form #1 */
|
|
void init_rsa_priv_f1_desc(u32 *desc, struct rsa_priv_f1_pdb *pdb)
|
|
{
|
|
init_job_desc_pdb(desc, 0, SIZEOF_RSA_PRIV_F1_PDB);
|
|
append_cmd(desc, pdb->sgf);
|
|
append_ptr(desc, pdb->g_dma);
|
|
append_ptr(desc, pdb->f_dma);
|
|
append_ptr(desc, pdb->n_dma);
|
|
append_ptr(desc, pdb->d_dma);
|
|
append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY |
|
|
RSA_PRIV_KEY_FRM_1);
|
|
}
|
|
|
|
/* Descriptor for RSA Private operation - Private Key Form #2 */
|
|
void init_rsa_priv_f2_desc(u32 *desc, struct rsa_priv_f2_pdb *pdb)
|
|
{
|
|
init_job_desc_pdb(desc, 0, SIZEOF_RSA_PRIV_F2_PDB);
|
|
append_cmd(desc, pdb->sgf);
|
|
append_ptr(desc, pdb->g_dma);
|
|
append_ptr(desc, pdb->f_dma);
|
|
append_ptr(desc, pdb->d_dma);
|
|
append_ptr(desc, pdb->p_dma);
|
|
append_ptr(desc, pdb->q_dma);
|
|
append_ptr(desc, pdb->tmp1_dma);
|
|
append_ptr(desc, pdb->tmp2_dma);
|
|
append_cmd(desc, pdb->p_q_len);
|
|
append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY |
|
|
RSA_PRIV_KEY_FRM_2);
|
|
}
|
|
|
|
/* Descriptor for RSA Private operation - Private Key Form #3 */
|
|
void init_rsa_priv_f3_desc(u32 *desc, struct rsa_priv_f3_pdb *pdb)
|
|
{
|
|
init_job_desc_pdb(desc, 0, SIZEOF_RSA_PRIV_F3_PDB);
|
|
append_cmd(desc, pdb->sgf);
|
|
append_ptr(desc, pdb->g_dma);
|
|
append_ptr(desc, pdb->f_dma);
|
|
append_ptr(desc, pdb->c_dma);
|
|
append_ptr(desc, pdb->p_dma);
|
|
append_ptr(desc, pdb->q_dma);
|
|
append_ptr(desc, pdb->dp_dma);
|
|
append_ptr(desc, pdb->dq_dma);
|
|
append_ptr(desc, pdb->tmp1_dma);
|
|
append_ptr(desc, pdb->tmp2_dma);
|
|
append_cmd(desc, pdb->p_q_len);
|
|
append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY |
|
|
RSA_PRIV_KEY_FRM_3);
|
|
}
|