11/*
2- * Shared descriptors for aead, ablkcipher algorithms
2+ * Shared descriptors for aead, skcipher algorithms
33 *
4- * Copyright 2016 NXP
4+ * Copyright 2016-2018 NXP
55 */
66
77#include "compat.h"
@@ -1212,11 +1212,8 @@ void cnstr_shdsc_rfc4543_decap(u32 * const desc, struct alginfo *cdata,
12121212}
12131213EXPORT_SYMBOL (cnstr_shdsc_rfc4543_decap );
12141214
1215- /*
1216- * For ablkcipher encrypt and decrypt, read from req->src and
1217- * write to req->dst
1218- */
1219- static inline void ablkcipher_append_src_dst (u32 * desc )
1215+ /* For skcipher encrypt and decrypt, read from req->src and write to req->dst */
1216+ static inline void skcipher_append_src_dst (u32 * desc )
12201217{
12211218 append_math_add (desc , VARSEQOUTLEN , SEQINLEN , REG0 , CAAM_CMD_SZ );
12221219 append_math_add (desc , VARSEQINLEN , SEQINLEN , REG0 , CAAM_CMD_SZ );
@@ -1226,7 +1223,7 @@ static inline void ablkcipher_append_src_dst(u32 *desc)
12261223}
12271224
12281225/**
1229- * cnstr_shdsc_ablkcipher_encap - ablkcipher encapsulation shared descriptor
1226+ * cnstr_shdsc_skcipher_encap - skcipher encapsulation shared descriptor
12301227 * @desc: pointer to buffer used for descriptor construction
12311228 * @cdata: pointer to block cipher transform definitions
12321229 * Valid algorithm values - one of OP_ALG_ALGSEL_{AES, DES, 3DES} ANDed
@@ -1235,9 +1232,9 @@ static inline void ablkcipher_append_src_dst(u32 *desc)
12351232 * @is_rfc3686: true when ctr(aes) is wrapped by rfc3686 template
12361233 * @ctx1_iv_off: IV offset in CONTEXT1 register
12371234 */
1238- void cnstr_shdsc_ablkcipher_encap (u32 * const desc , struct alginfo * cdata ,
1239- unsigned int ivsize , const bool is_rfc3686 ,
1240- const u32 ctx1_iv_off )
1235+ void cnstr_shdsc_skcipher_encap (u32 * const desc , struct alginfo * cdata ,
1236+ unsigned int ivsize , const bool is_rfc3686 ,
1237+ const u32 ctx1_iv_off )
12411238{
12421239 u32 * key_jump_cmd ;
12431240
@@ -1280,18 +1277,18 @@ void cnstr_shdsc_ablkcipher_encap(u32 * const desc, struct alginfo *cdata,
12801277 OP_ALG_ENCRYPT );
12811278
12821279 /* Perform operation */
1283- ablkcipher_append_src_dst (desc );
1280+ skcipher_append_src_dst (desc );
12841281
12851282#ifdef DEBUG
12861283 print_hex_dump (KERN_ERR ,
1287- "ablkcipher enc shdesc@" __stringify (__LINE__ )": " ,
1284+ "skcipher enc shdesc@" __stringify (__LINE__ )": " ,
12881285 DUMP_PREFIX_ADDRESS , 16 , 4 , desc , desc_bytes (desc ), 1 );
12891286#endif
12901287}
1291- EXPORT_SYMBOL (cnstr_shdsc_ablkcipher_encap );
1288+ EXPORT_SYMBOL (cnstr_shdsc_skcipher_encap );
12921289
12931290/**
1294- * cnstr_shdsc_ablkcipher_decap - ablkcipher decapsulation shared descriptor
1291+ * cnstr_shdsc_skcipher_decap - skcipher decapsulation shared descriptor
12951292 * @desc: pointer to buffer used for descriptor construction
12961293 * @cdata: pointer to block cipher transform definitions
12971294 * Valid algorithm values - one of OP_ALG_ALGSEL_{AES, DES, 3DES} ANDed
@@ -1300,9 +1297,9 @@ EXPORT_SYMBOL(cnstr_shdsc_ablkcipher_encap);
13001297 * @is_rfc3686: true when ctr(aes) is wrapped by rfc3686 template
13011298 * @ctx1_iv_off: IV offset in CONTEXT1 register
13021299 */
1303- void cnstr_shdsc_ablkcipher_decap (u32 * const desc , struct alginfo * cdata ,
1304- unsigned int ivsize , const bool is_rfc3686 ,
1305- const u32 ctx1_iv_off )
1300+ void cnstr_shdsc_skcipher_decap (u32 * const desc , struct alginfo * cdata ,
1301+ unsigned int ivsize , const bool is_rfc3686 ,
1302+ const u32 ctx1_iv_off )
13061303{
13071304 u32 * key_jump_cmd ;
13081305
@@ -1348,24 +1345,23 @@ void cnstr_shdsc_ablkcipher_decap(u32 * const desc, struct alginfo *cdata,
13481345 append_dec_op1 (desc , cdata -> algtype );
13491346
13501347 /* Perform operation */
1351- ablkcipher_append_src_dst (desc );
1348+ skcipher_append_src_dst (desc );
13521349
13531350#ifdef DEBUG
13541351 print_hex_dump (KERN_ERR ,
1355- "ablkcipher dec shdesc@" __stringify (__LINE__ )": " ,
1352+ "skcipher dec shdesc@" __stringify (__LINE__ )": " ,
13561353 DUMP_PREFIX_ADDRESS , 16 , 4 , desc , desc_bytes (desc ), 1 );
13571354#endif
13581355}
1359- EXPORT_SYMBOL (cnstr_shdsc_ablkcipher_decap );
1356+ EXPORT_SYMBOL (cnstr_shdsc_skcipher_decap );
13601357
13611358/**
1362- * cnstr_shdsc_xts_ablkcipher_encap - xts ablkcipher encapsulation shared
1363- * descriptor
1359+ * cnstr_shdsc_xts_skcipher_encap - xts skcipher encapsulation shared descriptor
13641360 * @desc: pointer to buffer used for descriptor construction
13651361 * @cdata: pointer to block cipher transform definitions
13661362 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_XTS.
13671363 */
1368- void cnstr_shdsc_xts_ablkcipher_encap (u32 * const desc , struct alginfo * cdata )
1364+ void cnstr_shdsc_xts_skcipher_encap (u32 * const desc , struct alginfo * cdata )
13691365{
13701366 __be64 sector_size = cpu_to_be64 (512 );
13711367 u32 * key_jump_cmd ;
@@ -1400,24 +1396,23 @@ void cnstr_shdsc_xts_ablkcipher_encap(u32 * const desc, struct alginfo *cdata)
14001396 OP_ALG_ENCRYPT );
14011397
14021398 /* Perform operation */
1403- ablkcipher_append_src_dst (desc );
1399+ skcipher_append_src_dst (desc );
14041400
14051401#ifdef DEBUG
14061402 print_hex_dump (KERN_ERR ,
1407- "xts ablkcipher enc shdesc@" __stringify (__LINE__ ) ": " ,
1403+ "xts skcipher enc shdesc@" __stringify (__LINE__ ) ": " ,
14081404 DUMP_PREFIX_ADDRESS , 16 , 4 , desc , desc_bytes (desc ), 1 );
14091405#endif
14101406}
1411- EXPORT_SYMBOL (cnstr_shdsc_xts_ablkcipher_encap );
1407+ EXPORT_SYMBOL (cnstr_shdsc_xts_skcipher_encap );
14121408
14131409/**
1414- * cnstr_shdsc_xts_ablkcipher_decap - xts ablkcipher decapsulation shared
1415- * descriptor
1410+ * cnstr_shdsc_xts_skcipher_decap - xts skcipher decapsulation shared descriptor
14161411 * @desc: pointer to buffer used for descriptor construction
14171412 * @cdata: pointer to block cipher transform definitions
14181413 * Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with OP_ALG_AAI_XTS.
14191414 */
1420- void cnstr_shdsc_xts_ablkcipher_decap (u32 * const desc , struct alginfo * cdata )
1415+ void cnstr_shdsc_xts_skcipher_decap (u32 * const desc , struct alginfo * cdata )
14211416{
14221417 __be64 sector_size = cpu_to_be64 (512 );
14231418 u32 * key_jump_cmd ;
@@ -1451,15 +1446,15 @@ void cnstr_shdsc_xts_ablkcipher_decap(u32 * const desc, struct alginfo *cdata)
14511446 append_dec_op1 (desc , cdata -> algtype );
14521447
14531448 /* Perform operation */
1454- ablkcipher_append_src_dst (desc );
1449+ skcipher_append_src_dst (desc );
14551450
14561451#ifdef DEBUG
14571452 print_hex_dump (KERN_ERR ,
1458- "xts ablkcipher dec shdesc@" __stringify (__LINE__ ) ": " ,
1453+ "xts skcipher dec shdesc@" __stringify (__LINE__ ) ": " ,
14591454 DUMP_PREFIX_ADDRESS , 16 , 4 , desc , desc_bytes (desc ), 1 );
14601455#endif
14611456}
1462- EXPORT_SYMBOL (cnstr_shdsc_xts_ablkcipher_decap );
1457+ EXPORT_SYMBOL (cnstr_shdsc_xts_skcipher_decap );
14631458
14641459MODULE_LICENSE ("GPL" );
14651460MODULE_DESCRIPTION ("FSL CAAM descriptor support" );
0 commit comments