X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcrypto%2Fccp%2Fccp_crypto.h;h=882b398acaaca00d1e0df3b80cfcadff19df6edd;hb=1b03e2929114d4ebfc7a2159d0d45f0a3e9a7ba6;hp=aa4787a7826b935d0b8cfb29eaa99fad89a8883a;hpb=0c6a81eff11ddf2a7d303f567b1918e34c9d180d;p=dpdk.git diff --git a/drivers/crypto/ccp/ccp_crypto.h b/drivers/crypto/ccp/ccp_crypto.h index aa4787a782..882b398aca 100644 --- a/drivers/crypto/ccp/ccp_crypto.h +++ b/drivers/crypto/ccp/ccp_crypto.h @@ -42,16 +42,34 @@ #define HMAC_IPAD_VALUE 0x36 #define HMAC_OPAD_VALUE 0x5c -#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH +/* MD5 */ #define MD5_DIGEST_SIZE 16 #define MD5_BLOCK_SIZE 64 -#endif /* SHA */ #define SHA_COMMON_DIGEST_SIZE 32 #define SHA1_DIGEST_SIZE 20 #define SHA1_BLOCK_SIZE 64 +#define SHA224_DIGEST_SIZE 28 +#define SHA224_BLOCK_SIZE 64 +#define SHA3_224_BLOCK_SIZE 144 + +#define SHA256_DIGEST_SIZE 32 +#define SHA256_BLOCK_SIZE 64 +#define SHA3_256_BLOCK_SIZE 136 + +#define SHA384_DIGEST_SIZE 48 +#define SHA384_BLOCK_SIZE 128 +#define SHA3_384_BLOCK_SIZE 104 + +#define SHA512_DIGEST_SIZE 64 +#define SHA512_BLOCK_SIZE 128 +#define SHA3_512_BLOCK_SIZE 72 + +/* Maximum length for digest */ +#define DIGEST_LENGTH_MAX 64 + /* SHA LSB intialiazation values */ #define SHA1_H0 0x67452301UL @@ -60,6 +78,42 @@ #define SHA1_H3 0x10325476UL #define SHA1_H4 0xc3d2e1f0UL +#define SHA224_H0 0xc1059ed8UL +#define SHA224_H1 0x367cd507UL +#define SHA224_H2 0x3070dd17UL +#define SHA224_H3 0xf70e5939UL +#define SHA224_H4 0xffc00b31UL +#define SHA224_H5 0x68581511UL +#define SHA224_H6 0x64f98fa7UL +#define SHA224_H7 0xbefa4fa4UL + +#define SHA256_H0 0x6a09e667UL +#define SHA256_H1 0xbb67ae85UL +#define SHA256_H2 0x3c6ef372UL +#define SHA256_H3 0xa54ff53aUL +#define SHA256_H4 0x510e527fUL +#define SHA256_H5 0x9b05688cUL +#define SHA256_H6 0x1f83d9abUL +#define SHA256_H7 0x5be0cd19UL + +#define SHA384_H0 0xcbbb9d5dc1059ed8ULL +#define SHA384_H1 0x629a292a367cd507ULL +#define SHA384_H2 0x9159015a3070dd17ULL +#define SHA384_H3 0x152fecd8f70e5939ULL +#define SHA384_H4 0x67332667ffc00b31ULL +#define SHA384_H5 0x8eb44a8768581511ULL +#define SHA384_H6 0xdb0c2e0d64f98fa7ULL +#define SHA384_H7 0x47b5481dbefa4fa4ULL + +#define SHA512_H0 0x6a09e667f3bcc908ULL +#define SHA512_H1 0xbb67ae8584caa73bULL +#define SHA512_H2 0x3c6ef372fe94f82bULL +#define SHA512_H3 0xa54ff53a5f1d36f1ULL +#define SHA512_H4 0x510e527fade682d1ULL +#define SHA512_H5 0x9b05688c2b3e6c1fULL +#define SHA512_H6 0x1f83d9abfb41bd6bULL +#define SHA512_H7 0x5be0cd19137e2179ULL + /** * CCP supported AES modes */ @@ -180,9 +234,7 @@ enum ccp_hash_algo { CCP_AUTH_ALGO_SHA3_512_HMAC, CCP_AUTH_ALGO_AES_CMAC, CCP_AUTH_ALGO_AES_GCM, -#ifdef RTE_LIBRTE_PMD_CCP_CPU_AUTH CCP_AUTH_ALGO_MD5_HMAC, -#endif }; /** @@ -195,6 +247,7 @@ enum ccp_hash_op { /* CCP crypto private session structure */ struct ccp_session { + bool auth_opt; enum ccp_cmd_order cmd_id; /**< chain order mode */ struct { @@ -266,6 +319,7 @@ struct ccp_session { extern uint8_t ccp_cryptodev_driver_id; struct ccp_qp; +struct ccp_private; /** * Set and validate CCP crypto session parameters @@ -275,7 +329,8 @@ struct ccp_qp; * @return 0 on success otherwise -1 */ int ccp_set_session_parameters(struct ccp_session *sess, - const struct rte_crypto_sym_xform *xform); + const struct rte_crypto_sym_xform *xform, + struct ccp_private *internals); /** * Find count of slots @@ -294,7 +349,7 @@ int ccp_compute_slot_count(struct ccp_session *session); * @param nb_ops No. of ops to be submitted * @return 0 on success otherwise -1 */ -int process_ops_to_enqueue(const struct ccp_qp *qp, +int process_ops_to_enqueue(struct ccp_qp *qp, struct rte_crypto_op **op, struct ccp_queue *cmd_q, uint16_t nb_ops, @@ -312,4 +367,22 @@ int process_ops_to_dequeue(struct ccp_qp *qp, struct rte_crypto_op **op, uint16_t nb_ops); + +/** + * Apis for SHA3 partial hash generation + * @param data_in buffer pointer on which phash is applied + * @param data_out phash result in ccp be format is written + */ +int partial_hash_sha3_224(uint8_t *data_in, + uint8_t *data_out); + +int partial_hash_sha3_256(uint8_t *data_in, + uint8_t *data_out); + +int partial_hash_sha3_384(uint8_t *data_in, + uint8_t *data_out); + +int partial_hash_sha3_512(uint8_t *data_in, + uint8_t *data_out); + #endif /* _CCP_CRYPTO_H_ */