Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * caam - Freescale FSL CAAM support for Public Key Cryptography descriptors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright 2016 Freescale Semiconductor, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * There is no Shared Descriptor for PKC so that the Job Descriptor must carry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * all the desired key parameters, input and output pointers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "caampkc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "desc_constr.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /* Descriptor for RSA Public operation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) void init_rsa_pub_desc(u32 *desc, struct rsa_pub_pdb *pdb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	init_job_desc_pdb(desc, 0, SIZEOF_RSA_PUB_PDB);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	append_cmd(desc, pdb->sgf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	append_ptr(desc, pdb->f_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	append_ptr(desc, pdb->g_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	append_ptr(desc, pdb->n_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	append_ptr(desc, pdb->e_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	append_cmd(desc, pdb->f_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSAENC_PUBKEY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* Descriptor for RSA Private operation - Private Key Form #1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) void init_rsa_priv_f1_desc(u32 *desc, struct rsa_priv_f1_pdb *pdb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	init_job_desc_pdb(desc, 0, SIZEOF_RSA_PRIV_F1_PDB);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	append_cmd(desc, pdb->sgf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	append_ptr(desc, pdb->g_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	append_ptr(desc, pdb->f_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	append_ptr(desc, pdb->n_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	append_ptr(desc, pdb->d_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 			 RSA_PRIV_KEY_FRM_1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) /* Descriptor for RSA Private operation - Private Key Form #2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void init_rsa_priv_f2_desc(u32 *desc, struct rsa_priv_f2_pdb *pdb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	init_job_desc_pdb(desc, 0, SIZEOF_RSA_PRIV_F2_PDB);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	append_cmd(desc, pdb->sgf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	append_ptr(desc, pdb->g_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	append_ptr(desc, pdb->f_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	append_ptr(desc, pdb->d_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	append_ptr(desc, pdb->p_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	append_ptr(desc, pdb->q_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	append_ptr(desc, pdb->tmp1_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	append_ptr(desc, pdb->tmp2_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	append_cmd(desc, pdb->p_q_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 			 RSA_PRIV_KEY_FRM_2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /* Descriptor for RSA Private operation - Private Key Form #3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) void init_rsa_priv_f3_desc(u32 *desc, struct rsa_priv_f3_pdb *pdb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	init_job_desc_pdb(desc, 0, SIZEOF_RSA_PRIV_F3_PDB);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	append_cmd(desc, pdb->sgf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	append_ptr(desc, pdb->g_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	append_ptr(desc, pdb->f_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	append_ptr(desc, pdb->c_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	append_ptr(desc, pdb->p_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	append_ptr(desc, pdb->q_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	append_ptr(desc, pdb->dp_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	append_ptr(desc, pdb->dq_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	append_ptr(desc, pdb->tmp1_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	append_ptr(desc, pdb->tmp2_dma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	append_cmd(desc, pdb->p_q_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 			 RSA_PRIV_KEY_FRM_3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }