X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcommon%2Fcpt%2Fcpt_ucode_asym.h;h=a67ded642aceeb65b77cc0fbcace4b65a2229310;hb=3f95dfb9c4ed6a026112330af78f8e3bae7156fc;hp=5d1c7b5f0233359b81a08bfc87b8153399649474;hpb=e3866e73555091d56b33b4d8916e0e484ccae114;p=dpdk.git diff --git a/drivers/common/cpt/cpt_ucode_asym.h b/drivers/common/cpt/cpt_ucode_asym.h index 5d1c7b5f02..a67ded642a 100644 --- a/drivers/common/cpt/cpt_ucode_asym.h +++ b/drivers/common/cpt/cpt_ucode_asym.h @@ -234,7 +234,6 @@ cpt_modex_prep(struct asym_op_params *modex_params, struct rte_crypto_op **op; vq_cmd_word0_t vq_cmd_w0; uint64_t total_key_len; - opcode_info_t opcode; uint32_t dlen, rlen; uint32_t base_len; buf_ptr_t caddr; @@ -265,9 +264,8 @@ cpt_modex_prep(struct asym_op_params *modex_params, rlen = mod_len; /* Setup opcodes */ - opcode.s.major = CPT_MAJOR_OP_MODEX; - opcode.s.minor = CPT_MINOR_OP_MODEX; - vq_cmd_w0.s.opcode = opcode.flags; + vq_cmd_w0.s.opcode.major = CPT_MAJOR_OP_MODEX; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_MODEX; /* GP op header */ vq_cmd_w0.s.param1 = mod_len; @@ -307,7 +305,6 @@ cpt_rsa_prep(struct asym_op_params *rsa_params, struct rte_crypto_op **op; vq_cmd_word0_t vq_cmd_w0; uint64_t total_key_len; - opcode_info_t opcode; uint32_t dlen, rlen; uint32_t in_size; buf_ptr_t caddr; @@ -334,16 +331,16 @@ cpt_rsa_prep(struct asym_op_params *rsa_params, if (rsa_op.pad == RTE_CRYPTO_RSA_PADDING_NONE) { /* Use mod_exp operation for no_padding type */ - opcode.s.minor = CPT_MINOR_OP_MODEX; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_MODEX; vq_cmd_w0.s.param2 = exp_len; } else { if (rsa_op.op_type == RTE_CRYPTO_ASYM_OP_ENCRYPT) { - opcode.s.minor = CPT_MINOR_OP_PKCS_ENC; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_PKCS_ENC; /* Public key encrypt, use BT2*/ vq_cmd_w0.s.param2 = CPT_BLOCK_TYPE2 | ((uint16_t)(exp_len) << 1); } else if (rsa_op.op_type == RTE_CRYPTO_ASYM_OP_VERIFY) { - opcode.s.minor = CPT_MINOR_OP_PKCS_DEC; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_PKCS_DEC; /* Public key decrypt, use BT1 */ vq_cmd_w0.s.param2 = CPT_BLOCK_TYPE1; /* + 2 for decrypted len */ @@ -351,9 +348,7 @@ cpt_rsa_prep(struct asym_op_params *rsa_params, } } - /* Setup opcodes */ - opcode.s.major = CPT_MAJOR_OP_MODEX; - vq_cmd_w0.s.opcode = opcode.flags; + vq_cmd_w0.s.opcode.major = CPT_MAJOR_OP_MODEX; /* GP op header */ vq_cmd_w0.s.param1 = mod_len; @@ -395,7 +390,6 @@ cpt_rsa_crt_prep(struct asym_op_params *rsa_params, struct rte_crypto_op **op; vq_cmd_word0_t vq_cmd_w0; uint64_t total_key_len; - opcode_info_t opcode; uint32_t dlen, rlen; uint32_t in_size; buf_ptr_t caddr; @@ -422,14 +416,14 @@ cpt_rsa_crt_prep(struct asym_op_params *rsa_params, if (rsa_op.pad == RTE_CRYPTO_RSA_PADDING_NONE) { /*Use mod_exp operation for no_padding type */ - opcode.s.minor = CPT_MINOR_OP_MODEX_CRT; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_MODEX_CRT; } else { if (rsa_op.op_type == RTE_CRYPTO_ASYM_OP_SIGN) { - opcode.s.minor = CPT_MINOR_OP_PKCS_ENC_CRT; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_PKCS_ENC_CRT; /* Private encrypt, use BT1 */ vq_cmd_w0.s.param2 = CPT_BLOCK_TYPE1; } else if (rsa_op.op_type == RTE_CRYPTO_ASYM_OP_DECRYPT) { - opcode.s.minor = CPT_MINOR_OP_PKCS_DEC_CRT; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_PKCS_DEC_CRT; /* Private decrypt, use BT2 */ vq_cmd_w0.s.param2 = CPT_BLOCK_TYPE2; /* + 2 for decrypted len */ @@ -437,9 +431,7 @@ cpt_rsa_crt_prep(struct asym_op_params *rsa_params, } } - /* Setup opcodes */ - opcode.s.major = CPT_MAJOR_OP_MODEX; - vq_cmd_w0.s.opcode = opcode.flags; + vq_cmd_w0.s.opcode.major = CPT_MAJOR_OP_MODEX; /* GP op header */ vq_cmd_w0.s.param1 = mod_len; @@ -494,117 +486,150 @@ cpt_enqueue_rsa_op(struct rte_crypto_op *op, static const struct cpt_ec_group ec_grp[CPT_EC_ID_PMAX] = { { .prime = { - .data = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + .data = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, + .length = 24, }, - .length = 24, - }, - .order = { - .data = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0x99, 0xDE, 0xF8, 0x36, - 0x14, 0x6B, 0xC9, 0xB1, 0xB4, 0xD2, 0x28, 0x31 - }, - .length = 24 - }, + .order = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x99, 0xDE, 0xF8, 0x36, 0x14, 0x6B, + 0xC9, 0xB1, 0xB4, 0xD2, 0x28, 0x31}, + .length = 24}, + .consta = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC}, + .length = 24}, + .constb = {.data = {0x64, 0x21, 0x05, 0x19, 0xE5, 0x9C, + 0x80, 0xE7, 0x0F, 0xA7, 0xE9, 0xAB, + 0x72, 0x24, 0x30, 0x49, 0xFE, 0xB8, + 0xDE, 0xEC, 0xC1, 0x46, 0xB9, 0xB1}, + .length = 24}, }, { - .prime = { - .data = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01 - }, - .length = 28 - }, - .order = { - .data = { - 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, - 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0X16, 0XA2, - 0XE0, 0XB8, 0XF0, 0X3E, 0X13, 0XDD, 0X29, 0X45, - 0X5C, 0X5C, 0X2A, 0X3D - }, - .length = 28 - }, + .prime = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, + .length = 28}, + .order = {.data = {0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, + 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, + 0X16, 0XA2, 0XE0, 0XB8, 0XF0, 0X3E, 0X13, + 0XDD, 0X29, 0X45, 0X5C, 0X5C, 0X2A, 0X3D}, + .length = 28}, + .consta = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}, + .length = 28}, + .constb = {.data = {0xB4, 0x05, 0x0A, 0x85, 0x0C, 0x04, 0xB3, + 0xAB, 0xF5, 0x41, 0x32, 0x56, 0x50, 0x44, + 0xB0, 0xB7, 0xD7, 0xBF, 0xD8, 0xBA, 0x27, + 0x0B, 0x39, 0x43, 0x23, 0x55, 0xFF, 0xB4}, + .length = 28}, }, { - .prime = { - .data = { - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - }, - .length = 32 - }, - .order = { - .data = { - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xBC, 0xE6, 0xFA, 0xAD, 0xA7, 0x17, 0x9E, 0x84, - 0xF3, 0xB9, 0xCA, 0xC2, 0xFC, 0x63, 0x25, 0x51 - }, - .length = 32 - }, + .prime = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF}, + .length = 32}, + .order = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xBC, 0xE6, 0xFA, 0xAD, 0xA7, + 0x17, 0x9E, 0x84, 0xF3, 0xB9, 0xCA, 0xC2, + 0xFC, 0x63, 0x25, 0x51}, + .length = 32}, + .consta = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFC}, + .length = 32}, + .constb = {.data = {0x5A, 0xC6, 0x35, 0xD8, 0xAA, 0x3A, 0x93, + 0xE7, 0xB3, 0xEB, 0xBD, 0x55, 0x76, 0x98, + 0x86, 0xBC, 0x65, 0x1D, 0x06, 0xB0, 0xCC, + 0x53, 0xB0, 0xF6, 0x3B, 0xCE, 0x3C, 0x3E, + 0x27, 0xD2, 0x60, 0x4B}, + .length = 32}, }, { - .prime = { - .data = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF - }, - .length = 48 - }, - .order = { - .data = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xC7, 0x63, 0x4D, 0x81, 0xF4, 0x37, 0x2D, 0xDF, - 0x58, 0x1A, 0x0D, 0xB2, 0x48, 0xB0, 0xA7, 0x7A, - 0xEC, 0xEC, 0x19, 0x6A, 0xCC, 0xC5, 0x29, 0x73 - }, - .length = 48 - } + .prime = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, + 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF}, + .length = 48}, + .order = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xC7, 0x63, 0x4D, 0x81, + 0xF4, 0x37, 0x2D, 0xDF, 0x58, 0x1A, 0x0D, + 0xB2, 0x48, 0xB0, 0xA7, 0x7A, 0xEC, 0xEC, + 0x19, 0x6A, 0xCC, 0xC5, 0x29, 0x73}, + .length = 48}, + .consta = {.data = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, + 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFC}, + .length = 48}, + .constb = {.data = {0xB3, 0x31, 0x2F, 0xA7, 0xE2, 0x3E, 0xE7, + 0xE4, 0x98, 0x8E, 0x05, 0x6B, 0xE3, 0xF8, + 0x2D, 0x19, 0x18, 0x1D, 0x9C, 0x6E, 0xFE, + 0x81, 0x41, 0x12, 0x03, 0x14, 0x08, 0x8F, + 0x50, 0x13, 0x87, 0x5A, 0xC6, 0x56, 0x39, + 0x8D, 0x8A, 0x2E, 0xD1, 0x9D, 0x2A, 0x85, + 0xC8, 0xED, 0xD3, 0xEC, 0x2A, 0xEF}, + .length = 48}, }, - { - .prime = { - .data = { - 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF - }, - .length = 66 - }, - .order = { - .data = { - 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFA, 0x51, 0x86, 0x87, 0x83, 0xBF, 0x2F, - 0x96, 0x6B, 0x7F, 0xCC, 0x01, 0x48, 0xF7, 0x09, - 0xA5, 0xD0, 0x3B, 0xB5, 0xC9, 0xB8, 0x89, 0x9C, - 0x47, 0xAE, 0xBB, 0x6F, 0xB7, 0x1E, 0x91, 0x38, - 0x64, 0x09 - }, - .length = 66 - } - } -}; + {.prime = {.data = {0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF}, + .length = 66}, + .order = {.data = {0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFA, 0x51, 0x86, 0x87, 0x83, 0xBF, 0x2F, + 0x96, 0x6B, 0x7F, 0xCC, 0x01, 0x48, 0xF7, 0x09, + 0xA5, 0xD0, 0x3B, 0xB5, 0xC9, 0xB8, 0x89, 0x9C, + 0x47, 0xAE, 0xBB, 0x6F, 0xB7, 0x1E, 0x91, 0x38, + 0x64, 0x09}, + .length = 66}, + .consta = {.data = {0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFC}, + .length = 66}, + .constb = {.data = {0x00, 0x51, 0x95, 0x3E, 0xB9, 0x61, 0x8E, 0x1C, + 0x9A, 0x1F, 0x92, 0x9A, 0x21, 0xA0, 0xB6, 0x85, + 0x40, 0xEE, 0xA2, 0xDA, 0x72, 0x5B, 0x99, 0xB3, + 0x15, 0xF3, 0xB8, 0xB4, 0x89, 0x91, 0x8E, 0xF1, + 0x09, 0xE1, 0x56, 0x19, 0x39, 0x51, 0xEC, 0x7E, + 0x93, 0x7B, 0x16, 0x52, 0xC0, 0xBD, 0x3B, 0xB1, + 0xBF, 0x07, 0x35, 0x73, 0xDF, 0x88, 0x3D, 0x2C, + 0x34, 0xF1, 0xEF, 0x45, 0x1F, 0xD4, 0x6B, 0x50, + 0x3F, 0x00}, + .length = 66}}}; static __rte_always_inline void cpt_ecdsa_sign_prep(struct rte_crypto_ecdsa_op_param *ecdsa, @@ -621,7 +646,6 @@ cpt_ecdsa_sign_prep(struct rte_crypto_ecdsa_op_param *ecdsa, uint16_t order_len, prime_len; uint16_t o_offset, pk_offset; vq_cmd_word0_t vq_cmd_w0; - opcode_info_t opcode; uint16_t rlen, dlen; buf_ptr_t caddr; uint8_t *dptr; @@ -632,10 +656,10 @@ cpt_ecdsa_sign_prep(struct rte_crypto_ecdsa_op_param *ecdsa, /* Truncate input length to curve prime length */ if (message_len > prime_len) message_len = prime_len; - m_align = ROUNDUP8(message_len); + m_align = RTE_ALIGN_CEIL(message_len, 8); - p_align = ROUNDUP8(prime_len); - k_align = ROUNDUP8(k_len); + p_align = RTE_ALIGN_CEIL(prime_len, 8); + k_align = RTE_ALIGN_CEIL(k_len, 8); /* Set write offset for order and private key */ o_offset = prime_len - order_len; @@ -650,7 +674,7 @@ cpt_ecdsa_sign_prep(struct rte_crypto_ecdsa_op_param *ecdsa, * Please note, private key, order cannot exceed prime * length i.e 3 * p_align. */ - dlen = sizeof(fpm_table_iova) + k_align + m_align + p_align * 3; + dlen = sizeof(fpm_table_iova) + k_align + m_align + p_align * 5; memset(dptr, 0, dlen); @@ -672,17 +696,22 @@ cpt_ecdsa_sign_prep(struct rte_crypto_ecdsa_op_param *ecdsa, memcpy(dptr, ecdsa->message.data, message_len); dptr += m_align; + memcpy(dptr, ec_grp[curveid].consta.data, prime_len); + dptr += p_align; + + memcpy(dptr, ec_grp[curveid].constb.data, prime_len); + dptr += p_align; + /* 2 * prime length (for sign r and s ) */ rlen = 2 * p_align; /* Setup opcodes */ - opcode.s.major = CPT_MAJOR_OP_ECDSA; - opcode.s.minor = CPT_MINOR_OP_ECDSA_SIGN; - vq_cmd_w0.s.opcode = opcode.flags; + vq_cmd_w0.s.opcode.major = CPT_MAJOR_OP_ECDSA; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_ECDSA_SIGN; /* GP op header */ vq_cmd_w0.s.param1 = curveid | (message_len << 8); - vq_cmd_w0.s.param2 = k_len; + vq_cmd_w0.s.param2 = (pkey_len << 8) | k_len; vq_cmd_w0.s.dlen = dlen; /* Filling cpt_request_info structure */ @@ -722,7 +751,6 @@ cpt_ecdsa_verify_prep(struct rte_crypto_ecdsa_op_param *ecdsa, uint16_t qx_offset, qy_offset; uint16_t p_align, m_align; vq_cmd_word0_t vq_cmd_w0; - opcode_info_t opcode; buf_ptr_t caddr; uint16_t dlen; uint8_t *dptr; @@ -734,8 +762,8 @@ cpt_ecdsa_verify_prep(struct rte_crypto_ecdsa_op_param *ecdsa, if (message_len > prime_len) message_len = prime_len; - m_align = ROUNDUP8(message_len); - p_align = ROUNDUP8(prime_len); + m_align = RTE_ALIGN_CEIL(message_len, 8); + p_align = RTE_ALIGN_CEIL(prime_len, 8); /* Set write offset for sign, order and public key coordinates */ o_offset = prime_len - order_len; @@ -754,7 +782,7 @@ cpt_ecdsa_verify_prep(struct rte_crypto_ecdsa_op_param *ecdsa, * Please note sign, public key and order can not excede prime length * i.e. 6 * p_align */ - dlen = sizeof(fpm_table_iova) + m_align + (6 * p_align); + dlen = sizeof(fpm_table_iova) + m_align + (8 * p_align); memset(dptr, 0, dlen); @@ -782,10 +810,15 @@ cpt_ecdsa_verify_prep(struct rte_crypto_ecdsa_op_param *ecdsa, memcpy(dptr + qy_offset, ecdsa->q.y.data, qy_len); dptr += p_align; + memcpy(dptr, ec_grp[curveid].consta.data, prime_len); + dptr += p_align; + + memcpy(dptr, ec_grp[curveid].constb.data, prime_len); + dptr += p_align; + /* Setup opcodes */ - opcode.s.major = CPT_MAJOR_OP_ECDSA; - opcode.s.minor = CPT_MINOR_OP_ECDSA_VERIFY; - vq_cmd_w0.s.opcode = opcode.flags; + vq_cmd_w0.s.opcode.major = CPT_MAJOR_OP_ECDSA; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_ECDSA_VERIFY; /* GP op header */ vq_cmd_w0.s.param1 = curveid | (message_len << 8); @@ -845,7 +878,6 @@ cpt_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm, uint16_t dlen, rlen, prime_len; uint16_t x1_offset, y1_offset; vq_cmd_word0_t vq_cmd_w0; - opcode_info_t opcode; buf_ptr_t caddr; uint8_t *dptr; @@ -854,15 +886,15 @@ cpt_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm, /* Input buffer */ dptr = RTE_PTR_ADD(req, sizeof(struct cpt_request_info)); - p_align = ROUNDUP8(prime_len); - scalar_align = ROUNDUP8(ecpm->scalar.length); + p_align = RTE_ALIGN_CEIL(prime_len, 8); + scalar_align = RTE_ALIGN_CEIL(ecpm->scalar.length, 8); /* * Set dlen = sum(ROUNDUP8(input point(x and y coordinates), prime, * scalar length), * Please note point length is equivalent to prime of the curve */ - dlen = 3 * p_align + scalar_align; + dlen = 5 * p_align + scalar_align; x1_offset = prime_len - x1_len; y1_offset = prime_len - y1_len; @@ -879,12 +911,19 @@ cpt_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm, memcpy(dptr, ec_grp[curveid].prime.data, ec_grp[curveid].prime.length); dptr += p_align; + memcpy(dptr, ec_grp[curveid].consta.data, + ec_grp[curveid].consta.length); + dptr += p_align; + + memcpy(dptr, ec_grp[curveid].constb.data, + ec_grp[curveid].constb.length); + dptr += p_align; + /* Setup opcodes */ - opcode.s.major = CPT_MAJOR_OP_ECC; - opcode.s.minor = CPT_MINOR_OP_ECC_UMP; + vq_cmd_w0.s.opcode.major = CPT_MAJOR_OP_ECC; + vq_cmd_w0.s.opcode.minor = CPT_MINOR_OP_ECC_UMP; /* GP op header */ - vq_cmd_w0.s.opcode = opcode.flags; vq_cmd_w0.s.param1 = curveid; vq_cmd_w0.s.param2 = ecpm->scalar.length; vq_cmd_w0.s.dlen = dlen;