199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2018 Cavium Networks 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _RTE_CRYPTO_ASYM_H_ 699a2dd95SBruce Richardson #define _RTE_CRYPTO_ASYM_H_ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson /** 999a2dd95SBruce Richardson * @file rte_crypto_asym.h 1099a2dd95SBruce Richardson * 1199a2dd95SBruce Richardson * RTE Definitions for Asymmetric Cryptography 1299a2dd95SBruce Richardson * 1399a2dd95SBruce Richardson * Defines asymmetric algorithms and modes, as well as supported 1499a2dd95SBruce Richardson * asymmetric crypto operations. 1599a2dd95SBruce Richardson */ 1699a2dd95SBruce Richardson 1799a2dd95SBruce Richardson #include <string.h> 1899a2dd95SBruce Richardson #include <stdint.h> 1999a2dd95SBruce Richardson 2099a2dd95SBruce Richardson #include <rte_memory.h> 2199a2dd95SBruce Richardson #include <rte_mempool.h> 2299a2dd95SBruce Richardson #include <rte_common.h> 2399a2dd95SBruce Richardson 2499a2dd95SBruce Richardson #include "rte_crypto_sym.h" 2599a2dd95SBruce Richardson 26518a974bSArek Kusztal struct rte_cryptodev_asym_session; 2799a2dd95SBruce Richardson 285fa1fb29SArek Kusztal /** asym key exchange operation type name strings */ 295fa1fb29SArek Kusztal extern const char * 305fa1fb29SArek Kusztal rte_crypto_asym_ke_strings[]; 315fa1fb29SArek Kusztal 3299a2dd95SBruce Richardson /** asym operations type name strings */ 3399a2dd95SBruce Richardson extern const char * 3499a2dd95SBruce Richardson rte_crypto_asym_op_strings[]; 3599a2dd95SBruce Richardson 36a9059a01SArek Kusztal #define RTE_CRYPTO_ASYM_FLAG_PUB_KEY_NO_PADDING RTE_BIT32(0) 37a9059a01SArek Kusztal /**< 38a9059a01SArek Kusztal * Flag to denote public key will be returned without leading zero bytes 39a9059a01SArek Kusztal * and if the flag is not set, public key will be padded to the left with 40a9059a01SArek Kusztal * zeros to the size of the underlying algorithm (default) 41a9059a01SArek Kusztal */ 42a9059a01SArek Kusztal #define RTE_CRYPTO_ASYM_FLAG_SHARED_KEY_NO_PADDING RTE_BIT32(1) 43a9059a01SArek Kusztal /**< 44a9059a01SArek Kusztal * Flag to denote shared secret will be returned without leading zero bytes 45a9059a01SArek Kusztal * and if the flag is not set, shared secret will be padded to the left with 46a9059a01SArek Kusztal * zeros to the size of the underlying algorithm (default) 47a9059a01SArek Kusztal */ 488bd4315cSGowrishankar Muthukrishnan #define RTE_CRYPTO_ASYM_FLAG_PUB_KEY_COMPRESSED RTE_BIT32(2) 498bd4315cSGowrishankar Muthukrishnan /**< 508bd4315cSGowrishankar Muthukrishnan * Flag to denote public key will be returned in compressed form 518bd4315cSGowrishankar Muthukrishnan */ 52a9059a01SArek Kusztal 5399a2dd95SBruce Richardson /** 546b742fb8SArek Kusztal * List of elliptic curves. This enum aligns with 556b742fb8SArek Kusztal * TLS "Supported Groups" registry (previously known as 566b742fb8SArek Kusztal * NamedCurve registry). FFDH groups are not, and will not 576b742fb8SArek Kusztal * be included in this list. 586b742fb8SArek Kusztal * Deprecation for selected curve in TLS does not deprecate 596b742fb8SArek Kusztal * the selected curve in Cryptodev. 606b742fb8SArek Kusztal * https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml 61518a974bSArek Kusztal */ 626b742fb8SArek Kusztal enum rte_crypto_curve_id { 63518a974bSArek Kusztal RTE_CRYPTO_EC_GROUP_SECP192R1 = 19, 64518a974bSArek Kusztal RTE_CRYPTO_EC_GROUP_SECP224R1 = 21, 65518a974bSArek Kusztal RTE_CRYPTO_EC_GROUP_SECP256R1 = 23, 66518a974bSArek Kusztal RTE_CRYPTO_EC_GROUP_SECP384R1 = 24, 67f8ca1d61SGowrishankar Muthukrishnan RTE_CRYPTO_EC_GROUP_SECP521R1 = 25, 688bd4315cSGowrishankar Muthukrishnan RTE_CRYPTO_EC_GROUP_ED25519 = 29, 698bd4315cSGowrishankar Muthukrishnan RTE_CRYPTO_EC_GROUP_ED448 = 30, 70f8ca1d61SGowrishankar Muthukrishnan RTE_CRYPTO_EC_GROUP_SM2 = 41, 71518a974bSArek Kusztal }; 72518a974bSArek Kusztal 73518a974bSArek Kusztal /** 748bd4315cSGowrishankar Muthukrishnan * List of Edwards curve instances as per RFC 8032 (Section 5). 758bd4315cSGowrishankar Muthukrishnan */ 768bd4315cSGowrishankar Muthukrishnan enum rte_crypto_edward_instance { 778bd4315cSGowrishankar Muthukrishnan RTE_CRYPTO_EDCURVE_25519, 788bd4315cSGowrishankar Muthukrishnan RTE_CRYPTO_EDCURVE_25519CTX, 798bd4315cSGowrishankar Muthukrishnan RTE_CRYPTO_EDCURVE_25519PH, 808bd4315cSGowrishankar Muthukrishnan RTE_CRYPTO_EDCURVE_448, 818bd4315cSGowrishankar Muthukrishnan RTE_CRYPTO_EDCURVE_448PH 828bd4315cSGowrishankar Muthukrishnan }; 838bd4315cSGowrishankar Muthukrishnan 848bd4315cSGowrishankar Muthukrishnan /** 8599a2dd95SBruce Richardson * Asymmetric crypto transformation types. 8699a2dd95SBruce Richardson * Each xform type maps to one asymmetric algorithm 8799a2dd95SBruce Richardson * performing specific operation 8899a2dd95SBruce Richardson */ 8999a2dd95SBruce Richardson enum rte_crypto_asym_xform_type { 9099a2dd95SBruce Richardson RTE_CRYPTO_ASYM_XFORM_UNSPECIFIED = 0, 9199a2dd95SBruce Richardson /**< Invalid xform. */ 9299a2dd95SBruce Richardson RTE_CRYPTO_ASYM_XFORM_NONE, 9399a2dd95SBruce Richardson /**< Xform type None. 9499a2dd95SBruce Richardson * May be supported by PMD to support 9599a2dd95SBruce Richardson * passthrough op for debugging purpose. 9699a2dd95SBruce Richardson * if xform_type none , op_type is disregarded. 9799a2dd95SBruce Richardson */ 9899a2dd95SBruce Richardson RTE_CRYPTO_ASYM_XFORM_RSA, 9999a2dd95SBruce Richardson /**< RSA. Performs Encrypt, Decrypt, Sign and Verify. 10099a2dd95SBruce Richardson * Refer to rte_crypto_asym_op_type 10199a2dd95SBruce Richardson */ 10299a2dd95SBruce Richardson RTE_CRYPTO_ASYM_XFORM_DH, 10399a2dd95SBruce Richardson /**< Diffie-Hellman. 10499a2dd95SBruce Richardson * Performs Key Generate and Shared Secret Compute. 10599a2dd95SBruce Richardson * Refer to rte_crypto_asym_op_type 10699a2dd95SBruce Richardson */ 10799a2dd95SBruce Richardson RTE_CRYPTO_ASYM_XFORM_DSA, 10899a2dd95SBruce Richardson /**< Digital Signature Algorithm 10999a2dd95SBruce Richardson * Performs Signature Generation and Verification. 11099a2dd95SBruce Richardson * Refer to rte_crypto_asym_op_type 11199a2dd95SBruce Richardson */ 11299a2dd95SBruce Richardson RTE_CRYPTO_ASYM_XFORM_MODINV, 11399a2dd95SBruce Richardson /**< Modular Multiplicative Inverse 11499a2dd95SBruce Richardson * Perform Modular Multiplicative Inverse b^(-1) mod n 11599a2dd95SBruce Richardson */ 11699a2dd95SBruce Richardson RTE_CRYPTO_ASYM_XFORM_MODEX, 11799a2dd95SBruce Richardson /**< Modular Exponentiation 11899a2dd95SBruce Richardson * Perform Modular Exponentiation b^e mod n 11999a2dd95SBruce Richardson */ 12099a2dd95SBruce Richardson RTE_CRYPTO_ASYM_XFORM_ECDSA, 12199a2dd95SBruce Richardson /**< Elliptic Curve Digital Signature Algorithm 12299a2dd95SBruce Richardson * Perform Signature Generation and Verification. 12399a2dd95SBruce Richardson */ 12496db98dbSArek Kusztal RTE_CRYPTO_ASYM_XFORM_ECDH, 12596db98dbSArek Kusztal /**< Elliptic Curve Diffie Hellman */ 12699a2dd95SBruce Richardson RTE_CRYPTO_ASYM_XFORM_ECPM, 12799a2dd95SBruce Richardson /**< Elliptic Curve Point Multiplication */ 12846a15846SGowrishankar Muthukrishnan RTE_CRYPTO_ASYM_XFORM_ECFPM, 12946a15846SGowrishankar Muthukrishnan /**< Elliptic Curve Fixed Point Multiplication */ 1302d970c66SGowrishankar Muthukrishnan RTE_CRYPTO_ASYM_XFORM_SM2, 1312d970c66SGowrishankar Muthukrishnan /**< ShangMi 2 1322d970c66SGowrishankar Muthukrishnan * Performs Encrypt, Decrypt, Sign and Verify. 1332d970c66SGowrishankar Muthukrishnan * Refer to rte_crypto_asym_op_type. 1342d970c66SGowrishankar Muthukrishnan */ 1358bd4315cSGowrishankar Muthukrishnan RTE_CRYPTO_ASYM_XFORM_EDDSA, 1368bd4315cSGowrishankar Muthukrishnan /**< Edwards Curve Digital Signature Algorithm 1378bd4315cSGowrishankar Muthukrishnan * Perform Signature Generation and Verification. 1388bd4315cSGowrishankar Muthukrishnan */ 13999a2dd95SBruce Richardson }; 14099a2dd95SBruce Richardson 14199a2dd95SBruce Richardson /** 14299a2dd95SBruce Richardson * Asymmetric crypto operation type variants 14399a2dd95SBruce Richardson */ 14499a2dd95SBruce Richardson enum rte_crypto_asym_op_type { 14599a2dd95SBruce Richardson RTE_CRYPTO_ASYM_OP_ENCRYPT, 14699a2dd95SBruce Richardson /**< Asymmetric Encrypt operation */ 14799a2dd95SBruce Richardson RTE_CRYPTO_ASYM_OP_DECRYPT, 14899a2dd95SBruce Richardson /**< Asymmetric Decrypt operation */ 14999a2dd95SBruce Richardson RTE_CRYPTO_ASYM_OP_SIGN, 15099a2dd95SBruce Richardson /**< Signature Generation operation */ 15199a2dd95SBruce Richardson RTE_CRYPTO_ASYM_OP_VERIFY, 15299a2dd95SBruce Richardson /**< Signature Verification operation */ 15399a2dd95SBruce Richardson RTE_CRYPTO_ASYM_OP_LIST_END 15499a2dd95SBruce Richardson }; 15599a2dd95SBruce Richardson 15699a2dd95SBruce Richardson /** 1575fa1fb29SArek Kusztal * Asymmetric crypto key exchange operation type 1585fa1fb29SArek Kusztal */ 1595fa1fb29SArek Kusztal enum rte_crypto_asym_ke_type { 1605fa1fb29SArek Kusztal RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE, 1615fa1fb29SArek Kusztal /**< Private Key generation operation */ 1625fa1fb29SArek Kusztal RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE, 1635fa1fb29SArek Kusztal /**< Public Key generation operation */ 1642adb8529SArek Kusztal RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE, 1655fa1fb29SArek Kusztal /**< Shared Secret compute operation */ 1662adb8529SArek Kusztal RTE_CRYPTO_ASYM_KE_PUB_KEY_VERIFY 1672adb8529SArek Kusztal /**< Public Key Verification - can be used for 1682adb8529SArek Kusztal * elliptic curve point validation. 1692adb8529SArek Kusztal */ 1705fa1fb29SArek Kusztal }; 1715fa1fb29SArek Kusztal 1725fa1fb29SArek Kusztal /** 17399a2dd95SBruce Richardson * Padding types for RSA signature. 17499a2dd95SBruce Richardson */ 17599a2dd95SBruce Richardson enum rte_crypto_rsa_padding_type { 17699a2dd95SBruce Richardson RTE_CRYPTO_RSA_PADDING_NONE = 0, 17799a2dd95SBruce Richardson /**< RSA no padding scheme */ 17899a2dd95SBruce Richardson RTE_CRYPTO_RSA_PADDING_PKCS1_5, 17999a2dd95SBruce Richardson /**< RSA PKCS#1 PKCS1-v1_5 padding scheme. For signatures block type 01, 18099a2dd95SBruce Richardson * for encryption block type 02 are used. 18199a2dd95SBruce Richardson */ 18299a2dd95SBruce Richardson RTE_CRYPTO_RSA_PADDING_OAEP, 18399a2dd95SBruce Richardson /**< RSA PKCS#1 OAEP padding scheme */ 18499a2dd95SBruce Richardson RTE_CRYPTO_RSA_PADDING_PSS, 18599a2dd95SBruce Richardson /**< RSA PKCS#1 PSS padding scheme */ 18699a2dd95SBruce Richardson }; 18799a2dd95SBruce Richardson 18899a2dd95SBruce Richardson /** 18999a2dd95SBruce Richardson * RSA private key type enumeration 19099a2dd95SBruce Richardson * 19199a2dd95SBruce Richardson * enumerates private key format required to perform RSA crypto 19299a2dd95SBruce Richardson * transform. 19399a2dd95SBruce Richardson */ 19499a2dd95SBruce Richardson enum rte_crypto_rsa_priv_key_type { 19599a2dd95SBruce Richardson RTE_RSA_KEY_TYPE_EXP, 19699a2dd95SBruce Richardson /**< RSA private key is an exponent */ 1973387912fSArek Kusztal RTE_RSA_KEY_TYPE_QT, 19899a2dd95SBruce Richardson /**< RSA private key is in quintuple format 19999a2dd95SBruce Richardson * See rte_crypto_rsa_priv_key_qt 20099a2dd95SBruce Richardson */ 20199a2dd95SBruce Richardson }; 20299a2dd95SBruce Richardson 20399a2dd95SBruce Richardson /** 204518a974bSArek Kusztal * Buffer to hold crypto params required for asym operations. 205518a974bSArek Kusztal * 206518a974bSArek Kusztal * These buffers can be used for both input to PMD and output from PMD. When 207518a974bSArek Kusztal * used for output from PMD, application has to ensure the buffer is large 208518a974bSArek Kusztal * enough to hold the target data. 209518a974bSArek Kusztal * 210518a974bSArek Kusztal * If an operation requires the PMD to generate a random number, 211518a974bSArek Kusztal * and the device supports CSRNG, 'data' should be set to NULL. 212518a974bSArek Kusztal * The crypto parameter in question will not be used by the PMD, 213518a974bSArek Kusztal * as it is internally generated. 214518a974bSArek Kusztal */ 215518a974bSArek Kusztal typedef struct rte_crypto_param_t { 216518a974bSArek Kusztal uint8_t *data; 217518a974bSArek Kusztal /**< pointer to buffer holding data */ 218518a974bSArek Kusztal rte_iova_t iova; 219518a974bSArek Kusztal /**< IO address of data buffer */ 220518a974bSArek Kusztal size_t length; 221518a974bSArek Kusztal /**< length of data in bytes */ 222518a974bSArek Kusztal } rte_crypto_param; 223518a974bSArek Kusztal 224518a974bSArek Kusztal /** Unsigned big-integer in big-endian format */ 225518a974bSArek Kusztal typedef rte_crypto_param rte_crypto_uint; 226518a974bSArek Kusztal 227518a974bSArek Kusztal /** 228518a974bSArek Kusztal * Structure for elliptic curve point 229518a974bSArek Kusztal */ 230518a974bSArek Kusztal struct rte_crypto_ec_point { 231518a974bSArek Kusztal rte_crypto_param x; 232518a974bSArek Kusztal /**< X coordinate */ 233518a974bSArek Kusztal rte_crypto_param y; 234518a974bSArek Kusztal /**< Y coordinate */ 235518a974bSArek Kusztal }; 236518a974bSArek Kusztal 237518a974bSArek Kusztal /** 23899a2dd95SBruce Richardson * Structure describing RSA private key in quintuple format. 23999a2dd95SBruce Richardson * See PKCS V1.5 RSA Cryptography Standard. 24099a2dd95SBruce Richardson */ 24199a2dd95SBruce Richardson struct rte_crypto_rsa_priv_key_qt { 242518a974bSArek Kusztal rte_crypto_uint p; 243518a974bSArek Kusztal /**< the first factor */ 244518a974bSArek Kusztal rte_crypto_uint q; 245518a974bSArek Kusztal /**< the second factor */ 246518a974bSArek Kusztal rte_crypto_uint dP; 247518a974bSArek Kusztal /**< the first factor's CRT exponent */ 248518a974bSArek Kusztal rte_crypto_uint dQ; 249518a974bSArek Kusztal /**< the second's factor's CRT exponent */ 250518a974bSArek Kusztal rte_crypto_uint qInv; 251518a974bSArek Kusztal /**< the CRT coefficient */ 25299a2dd95SBruce Richardson }; 25399a2dd95SBruce Richardson 25499a2dd95SBruce Richardson /** 255db8d2a2cSArek Kusztal * RSA padding type 256db8d2a2cSArek Kusztal */ 257db8d2a2cSArek Kusztal struct rte_crypto_rsa_padding { 258db8d2a2cSArek Kusztal enum rte_crypto_rsa_padding_type type; 259db8d2a2cSArek Kusztal /**< RSA padding scheme to be used for transform */ 260769723eeSArek Kusztal enum rte_crypto_auth_algorithm hash; 261db8d2a2cSArek Kusztal /**< 262db8d2a2cSArek Kusztal * RSA padding hash algorithm 263db8d2a2cSArek Kusztal * Valid hash algorithms are: 264db8d2a2cSArek Kusztal * MD5, SHA1, SHA224, SHA256, SHA384, SHA512 265db8d2a2cSArek Kusztal * 266db8d2a2cSArek Kusztal * When a specific padding type is selected, the following rules apply: 267db8d2a2cSArek Kusztal * - RTE_CRYPTO_RSA_PADDING_NONE: 268db8d2a2cSArek Kusztal * This field is ignored by the PMD 269db8d2a2cSArek Kusztal * 270db8d2a2cSArek Kusztal * - RTE_CRYPTO_RSA_PADDING_PKCS1_5: 271db8d2a2cSArek Kusztal * When signing an operation this field is used to determine value 272db8d2a2cSArek Kusztal * of the DigestInfo structure, therefore specifying which algorithm 273db8d2a2cSArek Kusztal * was used to create the message digest. 274db8d2a2cSArek Kusztal * When doing encryption/decryption this field is ignored for this 275db8d2a2cSArek Kusztal * padding type. 276db8d2a2cSArek Kusztal * 277db8d2a2cSArek Kusztal * - RTE_CRYPTO_RSA_PADDING_OAEP 278db8d2a2cSArek Kusztal * This field shall be set with the hash algorithm used 279db8d2a2cSArek Kusztal * in the padding scheme 280db8d2a2cSArek Kusztal * 281db8d2a2cSArek Kusztal * - RTE_CRYPTO_RSA_PADDING_PSS 282db8d2a2cSArek Kusztal * This field shall be set with the hash algorithm used 283db8d2a2cSArek Kusztal * in the padding scheme (and to create the input message digest) 284db8d2a2cSArek Kusztal */ 285769723eeSArek Kusztal enum rte_crypto_auth_algorithm mgf1hash; 286db8d2a2cSArek Kusztal /**< 287db8d2a2cSArek Kusztal * Hash algorithm to be used for mask generation if the 288db8d2a2cSArek Kusztal * padding scheme is either OAEP or PSS. If the padding 289db8d2a2cSArek Kusztal * scheme is unspecified a data hash algorithm is used 290db8d2a2cSArek Kusztal * for mask generation. Valid hash algorithms are: 291db8d2a2cSArek Kusztal * MD5, SHA1, SHA224, SHA256, SHA384, SHA512 292db8d2a2cSArek Kusztal */ 293769723eeSArek Kusztal uint16_t pss_saltlen; 294769723eeSArek Kusztal /**< 295769723eeSArek Kusztal * RSA PSS padding salt length 296769723eeSArek Kusztal * 297769723eeSArek Kusztal * Used only when RTE_CRYPTO_RSA_PADDING_PSS padding is selected, 298769723eeSArek Kusztal * otherwise ignored. 299769723eeSArek Kusztal */ 300769723eeSArek Kusztal rte_crypto_param oaep_label; 301769723eeSArek Kusztal /**< 302769723eeSArek Kusztal * RSA OAEP padding optional label 303769723eeSArek Kusztal * 304769723eeSArek Kusztal * Used only when RTE_CRYPTO_RSA_PADDING_OAEP padding is selected, 305769723eeSArek Kusztal * otherwise ignored. If label.data == NULL, a default 306769723eeSArek Kusztal * label (empty string) is used. 307769723eeSArek Kusztal */ 308db8d2a2cSArek Kusztal }; 309db8d2a2cSArek Kusztal 310db8d2a2cSArek Kusztal /** 31199a2dd95SBruce Richardson * Asymmetric RSA transform data 31299a2dd95SBruce Richardson * 31399a2dd95SBruce Richardson * Structure describing RSA xform params 31499a2dd95SBruce Richardson */ 31599a2dd95SBruce Richardson struct rte_crypto_rsa_xform { 316518a974bSArek Kusztal rte_crypto_uint n; 317518a974bSArek Kusztal /**< the RSA modulus */ 318518a974bSArek Kusztal rte_crypto_uint e; 319518a974bSArek Kusztal /**< the RSA public exponent */ 32099a2dd95SBruce Richardson 32199a2dd95SBruce Richardson enum rte_crypto_rsa_priv_key_type key_type; 32299a2dd95SBruce Richardson 3230e3b2fc1SGowrishankar Muthukrishnan struct { 324518a974bSArek Kusztal rte_crypto_uint d; 325518a974bSArek Kusztal /**< the RSA private exponent */ 32699a2dd95SBruce Richardson struct rte_crypto_rsa_priv_key_qt qt; 32799a2dd95SBruce Richardson /**< qt - Private key in quintuple format */ 32899a2dd95SBruce Richardson }; 3298a97564bSGowrishankar Muthukrishnan 3308a97564bSGowrishankar Muthukrishnan struct rte_crypto_rsa_padding padding; 3318a97564bSGowrishankar Muthukrishnan /**< RSA padding information */ 33299a2dd95SBruce Richardson }; 33399a2dd95SBruce Richardson 33499a2dd95SBruce Richardson /** 33599a2dd95SBruce Richardson * Asymmetric Modular exponentiation transform data 33699a2dd95SBruce Richardson * 33799a2dd95SBruce Richardson * Structure describing modular exponentiation xform param 33899a2dd95SBruce Richardson */ 33999a2dd95SBruce Richardson struct rte_crypto_modex_xform { 340518a974bSArek Kusztal rte_crypto_uint modulus; 341518a974bSArek Kusztal /**< Modulus data for modexp transform operation */ 342518a974bSArek Kusztal rte_crypto_uint exponent; 343518a974bSArek Kusztal /**< Exponent of the modexp transform operation */ 34499a2dd95SBruce Richardson }; 34599a2dd95SBruce Richardson 34699a2dd95SBruce Richardson /** 34799a2dd95SBruce Richardson * Asymmetric modular multiplicative inverse transform operation 34899a2dd95SBruce Richardson * 34999a2dd95SBruce Richardson * Structure describing modular multiplicative inverse transform 35099a2dd95SBruce Richardson */ 35199a2dd95SBruce Richardson struct rte_crypto_modinv_xform { 352518a974bSArek Kusztal rte_crypto_uint modulus; 353518a974bSArek Kusztal /**< Modulus data for modular multiplicative inverse operation */ 35499a2dd95SBruce Richardson }; 35599a2dd95SBruce Richardson 35699a2dd95SBruce Richardson /** 35799a2dd95SBruce Richardson * Asymmetric DH transform data 35899a2dd95SBruce Richardson * 35999a2dd95SBruce Richardson * Structure describing deffie-hellman xform params 36099a2dd95SBruce Richardson */ 36199a2dd95SBruce Richardson struct rte_crypto_dh_xform { 362518a974bSArek Kusztal rte_crypto_uint p; 363518a974bSArek Kusztal /**< Prime modulus data */ 364518a974bSArek Kusztal rte_crypto_uint g; 365518a974bSArek Kusztal /**< DH Generator */ 36699a2dd95SBruce Richardson }; 36799a2dd95SBruce Richardson 36899a2dd95SBruce Richardson /** 36999a2dd95SBruce Richardson * Asymmetric Digital Signature transform operation 37099a2dd95SBruce Richardson * 37199a2dd95SBruce Richardson * Structure describing DSA xform params 37299a2dd95SBruce Richardson */ 37399a2dd95SBruce Richardson struct rte_crypto_dsa_xform { 374518a974bSArek Kusztal rte_crypto_uint p; 375518a974bSArek Kusztal /**< Prime modulus */ 376518a974bSArek Kusztal rte_crypto_uint q; 377518a974bSArek Kusztal /**< Order of the subgroup */ 378518a974bSArek Kusztal rte_crypto_uint g; 379518a974bSArek Kusztal /**< Generator of the subgroup */ 380518a974bSArek Kusztal rte_crypto_uint x; 381eb40223bSArek Kusztal /**< x: Private key of the signer */ 38299a2dd95SBruce Richardson }; 38399a2dd95SBruce Richardson 38499a2dd95SBruce Richardson /** 38599a2dd95SBruce Richardson * Asymmetric elliptic curve transform data 38699a2dd95SBruce Richardson * 38799a2dd95SBruce Richardson * Structure describing all EC based xform params 38899a2dd95SBruce Richardson */ 38999a2dd95SBruce Richardson struct rte_crypto_ec_xform { 3906b742fb8SArek Kusztal enum rte_crypto_curve_id curve_id; 39199a2dd95SBruce Richardson /**< Pre-defined ec groups */ 392badc0c6fSGowrishankar Muthukrishnan 393badc0c6fSGowrishankar Muthukrishnan rte_crypto_uint pkey; 394badc0c6fSGowrishankar Muthukrishnan /**< Private key */ 395badc0c6fSGowrishankar Muthukrishnan 396badc0c6fSGowrishankar Muthukrishnan struct rte_crypto_ec_point q; 397badc0c6fSGowrishankar Muthukrishnan /**< Public key */ 39899a2dd95SBruce Richardson }; 39999a2dd95SBruce Richardson 40099a2dd95SBruce Richardson /** 40199a2dd95SBruce Richardson * Operations params for modular operations: 40299a2dd95SBruce Richardson * exponentiation and multiplicative inverse 40399a2dd95SBruce Richardson */ 40499a2dd95SBruce Richardson struct rte_crypto_mod_op_param { 405518a974bSArek Kusztal rte_crypto_uint base; 406f504f972SThomas Monjalon /**< Base of modular exponentiation/multiplicative inverse. */ 407518a974bSArek Kusztal rte_crypto_uint result; 408f504f972SThomas Monjalon /**< Result of modular exponentiation/multiplicative inverse. */ 40999a2dd95SBruce Richardson }; 41099a2dd95SBruce Richardson 41199a2dd95SBruce Richardson /** 41299a2dd95SBruce Richardson * RSA operation params 41399a2dd95SBruce Richardson */ 41499a2dd95SBruce Richardson struct rte_crypto_rsa_op_param { 41599a2dd95SBruce Richardson enum rte_crypto_asym_op_type op_type; 41699a2dd95SBruce Richardson /**< Type of RSA operation for transform */ 41799a2dd95SBruce Richardson 41899a2dd95SBruce Richardson rte_crypto_param message; 41999a2dd95SBruce Richardson /**< 42099a2dd95SBruce Richardson * Pointer to input data 42199a2dd95SBruce Richardson * - to be encrypted for RSA public encrypt. 42299a2dd95SBruce Richardson * - to be signed for RSA sign generation. 42399a2dd95SBruce Richardson * - to be authenticated for RSA sign verification. 42499a2dd95SBruce Richardson * 42599a2dd95SBruce Richardson * Pointer to output data 42699a2dd95SBruce Richardson * - for RSA private decrypt. 42799a2dd95SBruce Richardson * In this case the underlying array should have been 42899a2dd95SBruce Richardson * allocated with enough memory to hold plaintext output 42999a2dd95SBruce Richardson * (i.e. must be at least RSA key size). The message.length 430d3a913d9SGowrishankar Muthukrishnan * field could be either 0 or minimal length expected from PMD. 431d3a913d9SGowrishankar Muthukrishnan * This could be validated and overwritten by the PMD 43299a2dd95SBruce Richardson * with the decrypted length. 43399a2dd95SBruce Richardson */ 43499a2dd95SBruce Richardson 43599a2dd95SBruce Richardson rte_crypto_param cipher; 43699a2dd95SBruce Richardson /**< 43799a2dd95SBruce Richardson * Pointer to input data 43899a2dd95SBruce Richardson * - to be decrypted for RSA private decrypt. 43999a2dd95SBruce Richardson * 44099a2dd95SBruce Richardson * Pointer to output data 44199a2dd95SBruce Richardson * - for RSA public encrypt. 44299a2dd95SBruce Richardson * In this case the underlying array should have been allocated 44399a2dd95SBruce Richardson * with enough memory to hold ciphertext output (i.e. must be 444d3a913d9SGowrishankar Muthukrishnan * at least RSA key size). The cipher.length field could be 445d3a913d9SGowrishankar Muthukrishnan * either 0 or minimal length expected from PMD. 446d3a913d9SGowrishankar Muthukrishnan * This could be validated and overwritten by the PMD 447d3a913d9SGowrishankar Muthukrishnan * with the encrypted length. 44899a2dd95SBruce Richardson * 449f140bf27SArek Kusztal * When RTE_CRYPTO_RSA_PADDING_NONE and RTE_CRYPTO_ASYM_OP_VERIFY 450f140bf27SArek Kusztal * selected, this is an output of decrypted signature. 45199a2dd95SBruce Richardson */ 45299a2dd95SBruce Richardson 45399a2dd95SBruce Richardson rte_crypto_param sign; 45499a2dd95SBruce Richardson /**< 45599a2dd95SBruce Richardson * Pointer to input data 45699a2dd95SBruce Richardson * - to be verified for RSA public decrypt. 45799a2dd95SBruce Richardson * 45899a2dd95SBruce Richardson * Pointer to output data 45999a2dd95SBruce Richardson * - for RSA private encrypt. 46099a2dd95SBruce Richardson * In this case the underlying array should have been allocated 46199a2dd95SBruce Richardson * with enough memory to hold signature output (i.e. must be 462d3a913d9SGowrishankar Muthukrishnan * at least RSA key size). The sign.length field could be 463d3a913d9SGowrishankar Muthukrishnan * either 0 or minimal length expected from PMD. 464d3a913d9SGowrishankar Muthukrishnan * This could be validated and overwritten by the PMD 465d3a913d9SGowrishankar Muthukrishnan * with the signature length. 46699a2dd95SBruce Richardson */ 46799a2dd95SBruce Richardson }; 46899a2dd95SBruce Richardson 46999a2dd95SBruce Richardson /** 47099a2dd95SBruce Richardson * Diffie-Hellman Operations params. 47199a2dd95SBruce Richardson * @note: 47299a2dd95SBruce Richardson */ 47399a2dd95SBruce Richardson struct rte_crypto_dh_op_param { 474515a704dSArek Kusztal enum rte_crypto_asym_ke_type ke_type; 475515a704dSArek Kusztal /**< Key exchange operation type */ 476518a974bSArek Kusztal rte_crypto_uint priv_key; 47799a2dd95SBruce Richardson /**< 478515a704dSArek Kusztal * Output - generated private key when ke_type is 4795fa1fb29SArek Kusztal * RTE_CRYPTO_ASYM_KE_PRIV_KEY_GENERATE. 48099a2dd95SBruce Richardson * 481515a704dSArek Kusztal * Input - private key when ke_type is one of: 4825fa1fb29SArek Kusztal * RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE, 4835fa1fb29SArek Kusztal * RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE. 4849e3ad30bSArek Kusztal * 485515a704dSArek Kusztal * In case priv_key.length is 0 and ke_type is set with 4869e3ad30bSArek Kusztal * RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE, CSRNG capable 4879e3ad30bSArek Kusztal * device will generate a private key and use it for public 4889e3ad30bSArek Kusztal * key generation. 48999a2dd95SBruce Richardson */ 490515a704dSArek Kusztal rte_crypto_uint pub_key; 491515a704dSArek Kusztal /**< 492515a704dSArek Kusztal * Output - generated public key when ke_type is 493515a704dSArek Kusztal * RTE_CRYPTO_ASYM_KE_PUB_KEY_GENERATE. 494515a704dSArek Kusztal * 495515a704dSArek Kusztal * Input - peer's public key when ke_type is 496515a704dSArek Kusztal * RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE. 497515a704dSArek Kusztal */ 498518a974bSArek Kusztal rte_crypto_uint shared_secret; 49999a2dd95SBruce Richardson /**< 500515a704dSArek Kusztal * Output - calculated shared secret when ke_type is 5015fa1fb29SArek Kusztal * RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE. 50299a2dd95SBruce Richardson */ 50399a2dd95SBruce Richardson }; 50499a2dd95SBruce Richardson 50599a2dd95SBruce Richardson /** 50696db98dbSArek Kusztal * Elliptic Curve Diffie-Hellman Operations params. 50796db98dbSArek Kusztal */ 50896db98dbSArek Kusztal struct rte_crypto_ecdh_op_param { 50996db98dbSArek Kusztal enum rte_crypto_asym_ke_type ke_type; 51096db98dbSArek Kusztal /**< Key exchange operation type */ 51196db98dbSArek Kusztal rte_crypto_uint priv_key; 51296db98dbSArek Kusztal /**< 51396db98dbSArek Kusztal * Output - generated private key when ke_type is 51496db98dbSArek Kusztal * RTE_CRYPTO_ASYM_KE_PRIVATE_KEY_GENERATE. 51596db98dbSArek Kusztal * 51696db98dbSArek Kusztal * Input - private key when ke_type is one of: 51796db98dbSArek Kusztal * RTE_CRYPTO_ASYM_KE_PUBLIC_KEY_GENERATE, 51896db98dbSArek Kusztal * RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE. 51996db98dbSArek Kusztal * 52096db98dbSArek Kusztal * In case priv_key.length is 0 and ke_type is set with 52196db98dbSArek Kusztal * RTE_CRYPTO_ASYM_KE_PUBLIC_KEY_GENERATE, CSRNG capable 52296db98dbSArek Kusztal * device will generate private key and use it for public 52396db98dbSArek Kusztal * key generation. 52496db98dbSArek Kusztal */ 52596db98dbSArek Kusztal struct rte_crypto_ec_point pub_key; 52696db98dbSArek Kusztal /**< 52796db98dbSArek Kusztal * Output - generated public key when ke_type is 52896db98dbSArek Kusztal * RTE_CRYPTO_ASYM_KE_PUBLIC_KEY_GENERATE. 52996db98dbSArek Kusztal * 5302adb8529SArek Kusztal * Input - peer's public key, when ke_type is one of: 5312adb8529SArek Kusztal * RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE, 5322adb8529SArek Kusztal * RTE_CRYPTO_ASYM_KE_EC_PUBLIC_KEY_VERIFY. 53396db98dbSArek Kusztal */ 53496db98dbSArek Kusztal struct rte_crypto_ec_point shared_secret; 53596db98dbSArek Kusztal /**< 53696db98dbSArek Kusztal * Output - calculated shared secret when ke_type is 53796db98dbSArek Kusztal * RTE_CRYPTO_ASYM_KE_SHARED_SECRET_COMPUTE. 53896db98dbSArek Kusztal */ 53996db98dbSArek Kusztal }; 54096db98dbSArek Kusztal 54196db98dbSArek Kusztal /** 54299a2dd95SBruce Richardson * DSA Operations params 54399a2dd95SBruce Richardson */ 54499a2dd95SBruce Richardson struct rte_crypto_dsa_op_param { 54599a2dd95SBruce Richardson enum rte_crypto_asym_op_type op_type; 54699a2dd95SBruce Richardson /**< Signature Generation or Verification */ 54799a2dd95SBruce Richardson rte_crypto_param message; 54899a2dd95SBruce Richardson /**< input message to be signed or verified */ 549518a974bSArek Kusztal rte_crypto_uint k; 550a678c5d3SArek Kusztal /**< Per-message secret number, which is an integer 551baf482c0SArek Kusztal * in the interval (1, q-1). 552baf482c0SArek Kusztal * If the random number is generated by the PMD, 553baf482c0SArek Kusztal * the 'rte_crypto_param.data' parameter should be set to NULL. 554a678c5d3SArek Kusztal */ 555518a974bSArek Kusztal rte_crypto_uint r; 55699a2dd95SBruce Richardson /**< dsa sign component 'r' value 55799a2dd95SBruce Richardson * 55899a2dd95SBruce Richardson * output if op_type = sign generate, 55999a2dd95SBruce Richardson * input if op_type = sign verify 56099a2dd95SBruce Richardson */ 561518a974bSArek Kusztal rte_crypto_uint s; 56299a2dd95SBruce Richardson /**< dsa sign component 's' value 56399a2dd95SBruce Richardson * 56499a2dd95SBruce Richardson * output if op_type = sign generate, 56599a2dd95SBruce Richardson * input if op_type = sign verify 56699a2dd95SBruce Richardson */ 567518a974bSArek Kusztal rte_crypto_uint y; 56899a2dd95SBruce Richardson /**< y : Public key of the signer. 56999a2dd95SBruce Richardson * y = g^x mod p 57099a2dd95SBruce Richardson */ 57199a2dd95SBruce Richardson }; 57299a2dd95SBruce Richardson 57399a2dd95SBruce Richardson /** 57499a2dd95SBruce Richardson * ECDSA operation params 57599a2dd95SBruce Richardson */ 57699a2dd95SBruce Richardson struct rte_crypto_ecdsa_op_param { 57799a2dd95SBruce Richardson enum rte_crypto_asym_op_type op_type; 57899a2dd95SBruce Richardson /**< Signature generation or verification */ 57999a2dd95SBruce Richardson 58099a2dd95SBruce Richardson rte_crypto_param message; 58199a2dd95SBruce Richardson /**< Input message digest to be signed or verified */ 58299a2dd95SBruce Richardson 583518a974bSArek Kusztal rte_crypto_uint k; 58499a2dd95SBruce Richardson /**< The ECDSA per-message secret number, which is an integer 585baf482c0SArek Kusztal * in the interval (1, n-1). 586baf482c0SArek Kusztal * If the random number is generated by the PMD, 587baf482c0SArek Kusztal * the 'rte_crypto_param.data' parameter should be set to NULL. 58899a2dd95SBruce Richardson */ 58999a2dd95SBruce Richardson 590518a974bSArek Kusztal rte_crypto_uint r; 59199a2dd95SBruce Richardson /**< r component of elliptic curve signature 59299a2dd95SBruce Richardson * output : for signature generation 59399a2dd95SBruce Richardson * input : for signature verification 59499a2dd95SBruce Richardson */ 595518a974bSArek Kusztal rte_crypto_uint s; 59699a2dd95SBruce Richardson /**< s component of elliptic curve signature 59799a2dd95SBruce Richardson * output : for signature generation 59899a2dd95SBruce Richardson * input : for signature verification 59999a2dd95SBruce Richardson */ 60099a2dd95SBruce Richardson }; 60199a2dd95SBruce Richardson 60299a2dd95SBruce Richardson /** 6038bd4315cSGowrishankar Muthukrishnan * EdDSA operation params 6048bd4315cSGowrishankar Muthukrishnan */ 6058bd4315cSGowrishankar Muthukrishnan struct rte_crypto_eddsa_op_param { 6068bd4315cSGowrishankar Muthukrishnan enum rte_crypto_asym_op_type op_type; 6078bd4315cSGowrishankar Muthukrishnan /**< Signature generation or verification */ 6088bd4315cSGowrishankar Muthukrishnan 6098bd4315cSGowrishankar Muthukrishnan rte_crypto_param message; 6108bd4315cSGowrishankar Muthukrishnan /**< Input message digest to be signed or verified */ 6118bd4315cSGowrishankar Muthukrishnan 6128bd4315cSGowrishankar Muthukrishnan rte_crypto_param context; 6138bd4315cSGowrishankar Muthukrishnan /**< Context value for the sign op. 6148bd4315cSGowrishankar Muthukrishnan * Must not be empty for Ed25519ctx instance. 6158bd4315cSGowrishankar Muthukrishnan */ 6168bd4315cSGowrishankar Muthukrishnan 6178bd4315cSGowrishankar Muthukrishnan enum rte_crypto_edward_instance instance; 6188bd4315cSGowrishankar Muthukrishnan /**< Type of Edwards curve. */ 6198bd4315cSGowrishankar Muthukrishnan 6208bd4315cSGowrishankar Muthukrishnan rte_crypto_uint sign; 6218bd4315cSGowrishankar Muthukrishnan /**< Edward curve signature 6228bd4315cSGowrishankar Muthukrishnan * output : for signature generation 6238bd4315cSGowrishankar Muthukrishnan * input : for signature verification 6248bd4315cSGowrishankar Muthukrishnan */ 6258bd4315cSGowrishankar Muthukrishnan }; 6268bd4315cSGowrishankar Muthukrishnan 6278bd4315cSGowrishankar Muthukrishnan /** 62899a2dd95SBruce Richardson * Structure for EC point multiplication operation param 62999a2dd95SBruce Richardson */ 63099a2dd95SBruce Richardson struct rte_crypto_ecpm_op_param { 63199a2dd95SBruce Richardson struct rte_crypto_ec_point p; 63299a2dd95SBruce Richardson /**< x and y coordinates of input point */ 63399a2dd95SBruce Richardson 63499a2dd95SBruce Richardson struct rte_crypto_ec_point r; 63599a2dd95SBruce Richardson /**< x and y coordinates of resultant point */ 63699a2dd95SBruce Richardson 63799a2dd95SBruce Richardson rte_crypto_param scalar; 63899a2dd95SBruce Richardson /**< Scalar to multiply the input point */ 63999a2dd95SBruce Richardson }; 64099a2dd95SBruce Richardson 64199a2dd95SBruce Richardson /** 64253c65a3cSGowrishankar Muthukrishnan * SM2 operation capabilities 64353c65a3cSGowrishankar Muthukrishnan */ 64453c65a3cSGowrishankar Muthukrishnan enum rte_crypto_sm2_op_capa { 64553c65a3cSGowrishankar Muthukrishnan RTE_CRYPTO_SM2_RNG, 64653c65a3cSGowrishankar Muthukrishnan /**< Random number generator supported in SM2 ops. */ 64753c65a3cSGowrishankar Muthukrishnan RTE_CRYPTO_SM2_PH, 64853c65a3cSGowrishankar Muthukrishnan /**< Prehash message before crypto op. */ 64953c65a3cSGowrishankar Muthukrishnan }; 65053c65a3cSGowrishankar Muthukrishnan 65153c65a3cSGowrishankar Muthukrishnan /** 6522d970c66SGowrishankar Muthukrishnan * SM2 operation params. 6532d970c66SGowrishankar Muthukrishnan */ 6542d970c66SGowrishankar Muthukrishnan struct rte_crypto_sm2_op_param { 6552d970c66SGowrishankar Muthukrishnan enum rte_crypto_asym_op_type op_type; 6562d970c66SGowrishankar Muthukrishnan /**< Signature generation or verification. */ 6572d970c66SGowrishankar Muthukrishnan 658f8ca1d61SGowrishankar Muthukrishnan enum rte_crypto_auth_algorithm hash; 659f8ca1d61SGowrishankar Muthukrishnan /**< Hash algorithm used in EC op. */ 660f8ca1d61SGowrishankar Muthukrishnan 6612d970c66SGowrishankar Muthukrishnan rte_crypto_param message; 6622d970c66SGowrishankar Muthukrishnan /**< 6632d970c66SGowrishankar Muthukrishnan * Pointer to input data 6642d970c66SGowrishankar Muthukrishnan * - to be encrypted for SM2 public encrypt. 6652d970c66SGowrishankar Muthukrishnan * - to be signed for SM2 sign generation. 6662d970c66SGowrishankar Muthukrishnan * - to be authenticated for SM2 sign verification. 6672d970c66SGowrishankar Muthukrishnan * 6682d970c66SGowrishankar Muthukrishnan * Pointer to output data 6692d970c66SGowrishankar Muthukrishnan * - for SM2 private decrypt. 6702d970c66SGowrishankar Muthukrishnan * In this case the underlying array should have been 6712d970c66SGowrishankar Muthukrishnan * allocated with enough memory to hold plaintext output 6722d970c66SGowrishankar Muthukrishnan * (at least encrypted text length). The message.length field 6732d970c66SGowrishankar Muthukrishnan * will be overwritten by the PMD with the decrypted length. 6742d970c66SGowrishankar Muthukrishnan */ 6752d970c66SGowrishankar Muthukrishnan 6762d970c66SGowrishankar Muthukrishnan rte_crypto_param cipher; 6772d970c66SGowrishankar Muthukrishnan /**< 6782d970c66SGowrishankar Muthukrishnan * Pointer to input data 6792d970c66SGowrishankar Muthukrishnan * - to be decrypted for SM2 private decrypt. 6802d970c66SGowrishankar Muthukrishnan * 6812d970c66SGowrishankar Muthukrishnan * Pointer to output data 6822d970c66SGowrishankar Muthukrishnan * - for SM2 public encrypt. 6832d970c66SGowrishankar Muthukrishnan * In this case the underlying array should have been allocated 6842d970c66SGowrishankar Muthukrishnan * with enough memory to hold ciphertext output (at least X bytes 6852d970c66SGowrishankar Muthukrishnan * for prime field curve of N bytes and for message M bytes, 6862d970c66SGowrishankar Muthukrishnan * where X = (C1 || C2 || C3) and computed based on SM2 RFC as 6872d970c66SGowrishankar Muthukrishnan * C1 (1 + N + N), C2 = M, C3 = N. The cipher.length field will 6882d970c66SGowrishankar Muthukrishnan * be overwritten by the PMD with the encrypted length. 6892d970c66SGowrishankar Muthukrishnan */ 6902d970c66SGowrishankar Muthukrishnan 6912d970c66SGowrishankar Muthukrishnan rte_crypto_uint id; 6922d970c66SGowrishankar Muthukrishnan /**< The SM2 id used by signer and verifier. */ 6932d970c66SGowrishankar Muthukrishnan 6942d970c66SGowrishankar Muthukrishnan rte_crypto_uint k; 6952d970c66SGowrishankar Muthukrishnan /**< The SM2 per-message secret number, which is an integer 6962d970c66SGowrishankar Muthukrishnan * in the interval (1, n-1). 6972d970c66SGowrishankar Muthukrishnan * If the random number is generated by the PMD, 6982d970c66SGowrishankar Muthukrishnan * the 'rte_crypto_param.data' parameter should be set to NULL. 6992d970c66SGowrishankar Muthukrishnan */ 7002d970c66SGowrishankar Muthukrishnan 7012d970c66SGowrishankar Muthukrishnan rte_crypto_uint r; 7022d970c66SGowrishankar Muthukrishnan /**< r component of elliptic curve signature 7032d970c66SGowrishankar Muthukrishnan * output : for signature generation (of at least N bytes 7042d970c66SGowrishankar Muthukrishnan * where prime field length is N bytes) 7052d970c66SGowrishankar Muthukrishnan * input : for signature verification 7062d970c66SGowrishankar Muthukrishnan */ 7072d970c66SGowrishankar Muthukrishnan rte_crypto_uint s; 7082d970c66SGowrishankar Muthukrishnan /**< s component of elliptic curve signature 7092d970c66SGowrishankar Muthukrishnan * output : for signature generation (of at least N bytes 7102d970c66SGowrishankar Muthukrishnan * where prime field length is N bytes) 7112d970c66SGowrishankar Muthukrishnan * input : for signature verification 7122d970c66SGowrishankar Muthukrishnan */ 7132d970c66SGowrishankar Muthukrishnan }; 7142d970c66SGowrishankar Muthukrishnan 7152d970c66SGowrishankar Muthukrishnan /** 716*6d66f08eSArkadiusz Kusztal * Asymmetric crypto transform data 717*6d66f08eSArkadiusz Kusztal * 718*6d66f08eSArkadiusz Kusztal * Structure describing asym xforms. 719*6d66f08eSArkadiusz Kusztal */ 720*6d66f08eSArkadiusz Kusztal struct rte_crypto_asym_xform { 721*6d66f08eSArkadiusz Kusztal struct rte_crypto_asym_xform *next; 722*6d66f08eSArkadiusz Kusztal /**< Pointer to next xform to set up xform chain.*/ 723*6d66f08eSArkadiusz Kusztal enum rte_crypto_asym_xform_type xform_type; 724*6d66f08eSArkadiusz Kusztal /**< Asymmetric crypto transform */ 725*6d66f08eSArkadiusz Kusztal 726*6d66f08eSArkadiusz Kusztal union { 727*6d66f08eSArkadiusz Kusztal struct rte_crypto_rsa_xform rsa; 728*6d66f08eSArkadiusz Kusztal /**< RSA xform parameters */ 729*6d66f08eSArkadiusz Kusztal 730*6d66f08eSArkadiusz Kusztal struct rte_crypto_modex_xform modex; 731*6d66f08eSArkadiusz Kusztal /**< Modular Exponentiation xform parameters */ 732*6d66f08eSArkadiusz Kusztal 733*6d66f08eSArkadiusz Kusztal struct rte_crypto_modinv_xform modinv; 734*6d66f08eSArkadiusz Kusztal /**< Modular Multiplicative Inverse xform parameters */ 735*6d66f08eSArkadiusz Kusztal 736*6d66f08eSArkadiusz Kusztal struct rte_crypto_dh_xform dh; 737*6d66f08eSArkadiusz Kusztal /**< DH xform parameters */ 738*6d66f08eSArkadiusz Kusztal 739*6d66f08eSArkadiusz Kusztal struct rte_crypto_dsa_xform dsa; 740*6d66f08eSArkadiusz Kusztal /**< DSA xform parameters */ 741*6d66f08eSArkadiusz Kusztal 742*6d66f08eSArkadiusz Kusztal struct rte_crypto_ec_xform ec; 743*6d66f08eSArkadiusz Kusztal /**< EC xform parameters, used by elliptic curve based 744*6d66f08eSArkadiusz Kusztal * operations. 745*6d66f08eSArkadiusz Kusztal */ 746*6d66f08eSArkadiusz Kusztal }; 747*6d66f08eSArkadiusz Kusztal }; 748*6d66f08eSArkadiusz Kusztal 749*6d66f08eSArkadiusz Kusztal /** 75099a2dd95SBruce Richardson * Asymmetric Cryptographic Operation. 75199a2dd95SBruce Richardson * 75299a2dd95SBruce Richardson * Structure describing asymmetric crypto operation params. 75399a2dd95SBruce Richardson */ 75499a2dd95SBruce Richardson struct rte_crypto_asym_op { 75599a2dd95SBruce Richardson union { 75699a2dd95SBruce Richardson struct rte_cryptodev_asym_session *session; 75799a2dd95SBruce Richardson /**< Handle for the initialised session context */ 75899a2dd95SBruce Richardson struct rte_crypto_asym_xform *xform; 75999a2dd95SBruce Richardson /**< Session-less API crypto operation parameters */ 76099a2dd95SBruce Richardson }; 76199a2dd95SBruce Richardson 76299a2dd95SBruce Richardson union { 76399a2dd95SBruce Richardson struct rte_crypto_rsa_op_param rsa; 76499a2dd95SBruce Richardson struct rte_crypto_mod_op_param modex; 76599a2dd95SBruce Richardson struct rte_crypto_mod_op_param modinv; 76699a2dd95SBruce Richardson struct rte_crypto_dh_op_param dh; 76796db98dbSArek Kusztal struct rte_crypto_ecdh_op_param ecdh; 76899a2dd95SBruce Richardson struct rte_crypto_dsa_op_param dsa; 76999a2dd95SBruce Richardson struct rte_crypto_ecdsa_op_param ecdsa; 77099a2dd95SBruce Richardson struct rte_crypto_ecpm_op_param ecpm; 7712d970c66SGowrishankar Muthukrishnan struct rte_crypto_sm2_op_param sm2; 7728bd4315cSGowrishankar Muthukrishnan struct rte_crypto_eddsa_op_param eddsa; 77399a2dd95SBruce Richardson }; 774a9059a01SArek Kusztal uint16_t flags; 775a9059a01SArek Kusztal /**< 776a9059a01SArek Kusztal * Asymmetric crypto operation flags. 777a9059a01SArek Kusztal * Please refer to the RTE_CRYPTO_ASYM_FLAG_*. 778a9059a01SArek Kusztal */ 77999a2dd95SBruce Richardson }; 78099a2dd95SBruce Richardson 78199a2dd95SBruce Richardson #endif /* _RTE_CRYPTO_ASYM_H_ */ 782