aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorLee Nipper <lee.nipper@gmail.com>2009-03-29 03:50:50 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-06-02 00:04:23 -0400
commit56af8cd44b05bd9649103b76a6e1e575682990e4 (patch)
tree976bcdcec33914345615acf1eae1b4e460d7ad49 /drivers/crypto
parent9f171adc192fc3c8ffbb691cfdcc70259d75c6ea (diff)
crypto: talitos - scaffolding for new algorithm types
This patch is preparation for adding new algorithm types. Some elements which are AEAD specific were renamed. The algorithm template structure was changed to use crypto_alg, and talitos_alg_alloc was made more general with respect to algorithm types. ipsec_esp_edesc is renamed to talitos_edesc to use it in the upcoming ablkcipher routines. Signed-off-by: Lee Nipper <lee.nipper@gmail.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/talitos.c245
1 files changed, 129 insertions, 116 deletions
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index a3918c16b3db..9833961a247e 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -684,8 +684,8 @@ struct talitos_ctx {
684 unsigned int authsize; 684 unsigned int authsize;
685}; 685};
686 686
687static int aead_authenc_setauthsize(struct crypto_aead *authenc, 687static int aead_setauthsize(struct crypto_aead *authenc,
688 unsigned int authsize) 688 unsigned int authsize)
689{ 689{
690 struct talitos_ctx *ctx = crypto_aead_ctx(authenc); 690 struct talitos_ctx *ctx = crypto_aead_ctx(authenc);
691 691
@@ -694,8 +694,8 @@ static int aead_authenc_setauthsize(struct crypto_aead *authenc,
694 return 0; 694 return 0;
695} 695}
696 696
697static int aead_authenc_setkey(struct crypto_aead *authenc, 697static int aead_setkey(struct crypto_aead *authenc,
698 const u8 *key, unsigned int keylen) 698 const u8 *key, unsigned int keylen)
699{ 699{
700 struct talitos_ctx *ctx = crypto_aead_ctx(authenc); 700 struct talitos_ctx *ctx = crypto_aead_ctx(authenc);
701 struct rtattr *rta = (void *)key; 701 struct rtattr *rta = (void *)key;
@@ -740,7 +740,7 @@ badkey:
740} 740}
741 741
742/* 742/*
743 * ipsec_esp_edesc - s/w-extended ipsec_esp descriptor 743 * talitos_edesc - s/w-extended descriptor
744 * @src_nents: number of segments in input scatterlist 744 * @src_nents: number of segments in input scatterlist
745 * @dst_nents: number of segments in output scatterlist 745 * @dst_nents: number of segments in output scatterlist
746 * @dma_len: length of dma mapped link_tbl space 746 * @dma_len: length of dma mapped link_tbl space
@@ -752,7 +752,7 @@ badkey:
752 * is greater than 1, an integrity check value is concatenated to the end 752 * is greater than 1, an integrity check value is concatenated to the end
753 * of link_tbl data 753 * of link_tbl data
754 */ 754 */
755struct ipsec_esp_edesc { 755struct talitos_edesc {
756 int src_nents; 756 int src_nents;
757 int dst_nents; 757 int dst_nents;
758 int dma_len; 758 int dma_len;
@@ -762,7 +762,7 @@ struct ipsec_esp_edesc {
762}; 762};
763 763
764static void ipsec_esp_unmap(struct device *dev, 764static void ipsec_esp_unmap(struct device *dev,
765 struct ipsec_esp_edesc *edesc, 765 struct talitos_edesc *edesc,
766 struct aead_request *areq) 766 struct aead_request *areq)
767{ 767{
768 unmap_single_talitos_ptr(dev, &edesc->desc.ptr[6], DMA_FROM_DEVICE); 768 unmap_single_talitos_ptr(dev, &edesc->desc.ptr[6], DMA_FROM_DEVICE);
@@ -795,8 +795,8 @@ static void ipsec_esp_encrypt_done(struct device *dev,
795 int err) 795 int err)
796{ 796{
797 struct aead_request *areq = context; 797 struct aead_request *areq = context;
798 struct ipsec_esp_edesc *edesc = 798 struct talitos_edesc *edesc =
799 container_of(desc, struct ipsec_esp_edesc, desc); 799 container_of(desc, struct talitos_edesc, desc);
800 struct crypto_aead *authenc = crypto_aead_reqtfm(areq); 800 struct crypto_aead *authenc = crypto_aead_reqtfm(areq);
801 struct talitos_ctx *ctx = crypto_aead_ctx(authenc); 801 struct talitos_ctx *ctx = crypto_aead_ctx(authenc);
802 struct scatterlist *sg; 802 struct scatterlist *sg;
@@ -823,8 +823,8 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,
823 int err) 823 int err)
824{ 824{
825 struct aead_request *req = context; 825 struct aead_request *req = context;
826 struct ipsec_esp_edesc *edesc = 826 struct talitos_edesc *edesc =
827 container_of(desc, struct ipsec_esp_edesc, desc); 827 container_of(desc, struct talitos_edesc, desc);
828 struct crypto_aead *authenc = crypto_aead_reqtfm(req); 828 struct crypto_aead *authenc = crypto_aead_reqtfm(req);
829 struct talitos_ctx *ctx = crypto_aead_ctx(authenc); 829 struct talitos_ctx *ctx = crypto_aead_ctx(authenc);
830 struct scatterlist *sg; 830 struct scatterlist *sg;
@@ -855,8 +855,8 @@ static void ipsec_esp_decrypt_hwauth_done(struct device *dev,
855 int err) 855 int err)
856{ 856{
857 struct aead_request *req = context; 857 struct aead_request *req = context;
858 struct ipsec_esp_edesc *edesc = 858 struct talitos_edesc *edesc =
859 container_of(desc, struct ipsec_esp_edesc, desc); 859 container_of(desc, struct talitos_edesc, desc);
860 860
861 ipsec_esp_unmap(dev, edesc, req); 861 ipsec_esp_unmap(dev, edesc, req);
862 862
@@ -910,7 +910,7 @@ static int sg_to_link_tbl(struct scatterlist *sg, int sg_count,
910/* 910/*
911 * fill in and submit ipsec_esp descriptor 911 * fill in and submit ipsec_esp descriptor
912 */ 912 */
913static int ipsec_esp(struct ipsec_esp_edesc *edesc, struct aead_request *areq, 913static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,
914 u8 *giv, u64 seq, 914 u8 *giv, u64 seq,
915 void (*callback) (struct device *dev, 915 void (*callback) (struct device *dev,
916 struct talitos_desc *desc, 916 struct talitos_desc *desc,
@@ -1052,14 +1052,14 @@ static int sg_count(struct scatterlist *sg_list, int nbytes)
1052} 1052}
1053 1053
1054/* 1054/*
1055 * allocate and map the ipsec_esp extended descriptor 1055 * allocate and map the extended descriptor
1056 */ 1056 */
1057static struct ipsec_esp_edesc *ipsec_esp_edesc_alloc(struct aead_request *areq, 1057static struct talitos_edesc *ipsec_esp_edesc_alloc(struct aead_request *areq,
1058 int icv_stashing) 1058 int icv_stashing)
1059{ 1059{
1060 struct crypto_aead *authenc = crypto_aead_reqtfm(areq); 1060 struct crypto_aead *authenc = crypto_aead_reqtfm(areq);
1061 struct talitos_ctx *ctx = crypto_aead_ctx(authenc); 1061 struct talitos_ctx *ctx = crypto_aead_ctx(authenc);
1062 struct ipsec_esp_edesc *edesc; 1062 struct talitos_edesc *edesc;
1063 int src_nents, dst_nents, alloc_len, dma_len; 1063 int src_nents, dst_nents, alloc_len, dma_len;
1064 gfp_t flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : 1064 gfp_t flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL :
1065 GFP_ATOMIC; 1065 GFP_ATOMIC;
@@ -1084,7 +1084,7 @@ static struct ipsec_esp_edesc *ipsec_esp_edesc_alloc(struct aead_request *areq,
1084 * allowing for two separate entries for ICV and generated ICV (+ 2), 1084 * allowing for two separate entries for ICV and generated ICV (+ 2),
1085 * and the ICV data itself 1085 * and the ICV data itself
1086 */ 1086 */
1087 alloc_len = sizeof(struct ipsec_esp_edesc); 1087 alloc_len = sizeof(struct talitos_edesc);
1088 if (src_nents || dst_nents) { 1088 if (src_nents || dst_nents) {
1089 dma_len = (src_nents + dst_nents + 2) * 1089 dma_len = (src_nents + dst_nents + 2) *
1090 sizeof(struct talitos_ptr) + ctx->authsize; 1090 sizeof(struct talitos_ptr) + ctx->authsize;
@@ -1109,11 +1109,11 @@ static struct ipsec_esp_edesc *ipsec_esp_edesc_alloc(struct aead_request *areq,
1109 return edesc; 1109 return edesc;
1110} 1110}
1111 1111
1112static int aead_authenc_encrypt(struct aead_request *req) 1112static int aead_encrypt(struct aead_request *req)
1113{ 1113{
1114 struct crypto_aead *authenc = crypto_aead_reqtfm(req); 1114 struct crypto_aead *authenc = crypto_aead_reqtfm(req);
1115 struct talitos_ctx *ctx = crypto_aead_ctx(authenc); 1115 struct talitos_ctx *ctx = crypto_aead_ctx(authenc);
1116 struct ipsec_esp_edesc *edesc; 1116 struct talitos_edesc *edesc;
1117 1117
1118 /* allocate extended descriptor */ 1118 /* allocate extended descriptor */
1119 edesc = ipsec_esp_edesc_alloc(req, 0); 1119 edesc = ipsec_esp_edesc_alloc(req, 0);
@@ -1128,13 +1128,13 @@ static int aead_authenc_encrypt(struct aead_request *req)
1128 1128
1129 1129
1130 1130
1131static int aead_authenc_decrypt(struct aead_request *req) 1131static int aead_decrypt(struct aead_request *req)
1132{ 1132{
1133 struct crypto_aead *authenc = crypto_aead_reqtfm(req); 1133 struct crypto_aead *authenc = crypto_aead_reqtfm(req);
1134 struct talitos_ctx *ctx = crypto_aead_ctx(authenc); 1134 struct talitos_ctx *ctx = crypto_aead_ctx(authenc);
1135 unsigned int authsize = ctx->authsize; 1135 unsigned int authsize = ctx->authsize;
1136 struct talitos_private *priv = dev_get_drvdata(ctx->dev); 1136 struct talitos_private *priv = dev_get_drvdata(ctx->dev);
1137 struct ipsec_esp_edesc *edesc; 1137 struct talitos_edesc *edesc;
1138 struct scatterlist *sg; 1138 struct scatterlist *sg;
1139 void *icvdata; 1139 void *icvdata;
1140 1140
@@ -1180,13 +1180,12 @@ static int aead_authenc_decrypt(struct aead_request *req)
1180 } 1180 }
1181} 1181}
1182 1182
1183static int aead_authenc_givencrypt( 1183static int aead_givencrypt(struct aead_givcrypt_request *req)
1184 struct aead_givcrypt_request *req)
1185{ 1184{
1186 struct aead_request *areq = &req->areq; 1185 struct aead_request *areq = &req->areq;
1187 struct crypto_aead *authenc = crypto_aead_reqtfm(areq); 1186 struct crypto_aead *authenc = crypto_aead_reqtfm(areq);
1188 struct talitos_ctx *ctx = crypto_aead_ctx(authenc); 1187 struct talitos_ctx *ctx = crypto_aead_ctx(authenc);
1189 struct ipsec_esp_edesc *edesc; 1188 struct talitos_edesc *edesc;
1190 1189
1191 /* allocate extended descriptor */ 1190 /* allocate extended descriptor */
1192 edesc = ipsec_esp_edesc_alloc(areq, 0); 1191 edesc = ipsec_esp_edesc_alloc(areq, 0);
@@ -1205,30 +1204,30 @@ static int aead_authenc_givencrypt(
1205} 1204}
1206 1205
1207struct talitos_alg_template { 1206struct talitos_alg_template {
1208 char name[CRYPTO_MAX_ALG_NAME]; 1207 struct crypto_alg alg;
1209 char driver_name[CRYPTO_MAX_ALG_NAME];
1210 unsigned int blocksize;
1211 struct aead_alg aead;
1212 struct device *dev;
1213 __be32 desc_hdr_template; 1208 __be32 desc_hdr_template;
1214}; 1209};
1215 1210
1216static struct talitos_alg_template driver_algs[] = { 1211static struct talitos_alg_template driver_algs[] = {
1217 /* single-pass ipsec_esp descriptor */ 1212 /* AEAD algorithms. These use a single-pass ipsec_esp descriptor */
1218 { 1213 {
1219 .name = "authenc(hmac(sha1),cbc(aes))", 1214 .alg = {
1220 .driver_name = "authenc-hmac-sha1-cbc-aes-talitos", 1215 .cra_name = "authenc(hmac(sha1),cbc(aes))",
1221 .blocksize = AES_BLOCK_SIZE, 1216 .cra_driver_name = "authenc-hmac-sha1-cbc-aes-talitos",
1222 .aead = { 1217 .cra_blocksize = AES_BLOCK_SIZE,
1223 .setkey = aead_authenc_setkey, 1218 .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
1224 .setauthsize = aead_authenc_setauthsize, 1219 .cra_type = &crypto_aead_type,
1225 .encrypt = aead_authenc_encrypt, 1220 .cra_aead = {
1226 .decrypt = aead_authenc_decrypt, 1221 .setkey = aead_setkey,
1227 .givencrypt = aead_authenc_givencrypt, 1222 .setauthsize = aead_setauthsize,
1228 .geniv = "<built-in>", 1223 .encrypt = aead_encrypt,
1229 .ivsize = AES_BLOCK_SIZE, 1224 .decrypt = aead_decrypt,
1230 .maxauthsize = SHA1_DIGEST_SIZE, 1225 .givencrypt = aead_givencrypt,
1231 }, 1226 .geniv = "<built-in>",
1227 .ivsize = AES_BLOCK_SIZE,
1228 .maxauthsize = SHA1_DIGEST_SIZE,
1229 }
1230 },
1232 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP | 1231 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP |
1233 DESC_HDR_SEL0_AESU | 1232 DESC_HDR_SEL0_AESU |
1234 DESC_HDR_MODE0_AESU_CBC | 1233 DESC_HDR_MODE0_AESU_CBC |
@@ -1238,19 +1237,23 @@ static struct talitos_alg_template driver_algs[] = {
1238 DESC_HDR_MODE1_MDEU_SHA1_HMAC, 1237 DESC_HDR_MODE1_MDEU_SHA1_HMAC,
1239 }, 1238 },
1240 { 1239 {
1241 .name = "authenc(hmac(sha1),cbc(des3_ede))", 1240 .alg = {
1242 .driver_name = "authenc-hmac-sha1-cbc-3des-talitos", 1241 .cra_name = "authenc(hmac(sha1),cbc(des3_ede))",
1243 .blocksize = DES3_EDE_BLOCK_SIZE, 1242 .cra_driver_name = "authenc-hmac-sha1-cbc-3des-talitos",
1244 .aead = { 1243 .cra_blocksize = DES3_EDE_BLOCK_SIZE,
1245 .setkey = aead_authenc_setkey, 1244 .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
1246 .setauthsize = aead_authenc_setauthsize, 1245 .cra_type = &crypto_aead_type,
1247 .encrypt = aead_authenc_encrypt, 1246 .cra_aead = {
1248 .decrypt = aead_authenc_decrypt, 1247 .setkey = aead_setkey,
1249 .givencrypt = aead_authenc_givencrypt, 1248 .setauthsize = aead_setauthsize,
1250 .geniv = "<built-in>", 1249 .encrypt = aead_encrypt,
1251 .ivsize = DES3_EDE_BLOCK_SIZE, 1250 .decrypt = aead_decrypt,
1252 .maxauthsize = SHA1_DIGEST_SIZE, 1251 .givencrypt = aead_givencrypt,
1253 }, 1252 .geniv = "<built-in>",
1253 .ivsize = DES3_EDE_BLOCK_SIZE,
1254 .maxauthsize = SHA1_DIGEST_SIZE,
1255 }
1256 },
1254 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP | 1257 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP |
1255 DESC_HDR_SEL0_DEU | 1258 DESC_HDR_SEL0_DEU |
1256 DESC_HDR_MODE0_DEU_CBC | 1259 DESC_HDR_MODE0_DEU_CBC |
@@ -1261,19 +1264,23 @@ static struct talitos_alg_template driver_algs[] = {
1261 DESC_HDR_MODE1_MDEU_SHA1_HMAC, 1264 DESC_HDR_MODE1_MDEU_SHA1_HMAC,
1262 }, 1265 },
1263 { 1266 {
1264 .name = "authenc(hmac(sha256),cbc(aes))", 1267 .alg = {
1265 .driver_name = "authenc-hmac-sha256-cbc-aes-talitos", 1268 .cra_name = "authenc(hmac(sha256),cbc(aes))",
1266 .blocksize = AES_BLOCK_SIZE, 1269 .cra_driver_name = "authenc-hmac-sha256-cbc-aes-talitos",
1267 .aead = { 1270 .cra_blocksize = AES_BLOCK_SIZE,
1268 .setkey = aead_authenc_setkey, 1271 .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
1269 .setauthsize = aead_authenc_setauthsize, 1272 .cra_type = &crypto_aead_type,
1270 .encrypt = aead_authenc_encrypt, 1273 .cra_aead = {
1271 .decrypt = aead_authenc_decrypt, 1274 .setkey = aead_setkey,
1272 .givencrypt = aead_authenc_givencrypt, 1275 .setauthsize = aead_setauthsize,
1273 .geniv = "<built-in>", 1276 .encrypt = aead_encrypt,
1274 .ivsize = AES_BLOCK_SIZE, 1277 .decrypt = aead_decrypt,
1275 .maxauthsize = SHA256_DIGEST_SIZE, 1278 .givencrypt = aead_givencrypt,
1276 }, 1279 .geniv = "<built-in>",
1280 .ivsize = AES_BLOCK_SIZE,
1281 .maxauthsize = SHA256_DIGEST_SIZE,
1282 }
1283 },
1277 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP | 1284 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP |
1278 DESC_HDR_SEL0_AESU | 1285 DESC_HDR_SEL0_AESU |
1279 DESC_HDR_MODE0_AESU_CBC | 1286 DESC_HDR_MODE0_AESU_CBC |
@@ -1283,19 +1290,23 @@ static struct talitos_alg_template driver_algs[] = {
1283 DESC_HDR_MODE1_MDEU_SHA256_HMAC, 1290 DESC_HDR_MODE1_MDEU_SHA256_HMAC,
1284 }, 1291 },
1285 { 1292 {
1286 .name = "authenc(hmac(sha256),cbc(des3_ede))", 1293 .alg = {
1287 .driver_name = "authenc-hmac-sha256-cbc-3des-talitos", 1294 .cra_name = "authenc(hmac(sha256),cbc(des3_ede))",
1288 .blocksize = DES3_EDE_BLOCK_SIZE, 1295 .cra_driver_name = "authenc-hmac-sha256-cbc-3des-talitos",
1289 .aead = { 1296 .cra_blocksize = DES3_EDE_BLOCK_SIZE,
1290 .setkey = aead_authenc_setkey, 1297 .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
1291 .setauthsize = aead_authenc_setauthsize, 1298 .cra_type = &crypto_aead_type,
1292 .encrypt = aead_authenc_encrypt, 1299 .cra_aead = {
1293 .decrypt = aead_authenc_decrypt, 1300 .setkey = aead_setkey,
1294 .givencrypt = aead_authenc_givencrypt, 1301 .setauthsize = aead_setauthsize,
1295 .geniv = "<built-in>", 1302 .encrypt = aead_encrypt,
1296 .ivsize = DES3_EDE_BLOCK_SIZE, 1303 .decrypt = aead_decrypt,
1297 .maxauthsize = SHA256_DIGEST_SIZE, 1304 .givencrypt = aead_givencrypt,
1298 }, 1305 .geniv = "<built-in>",
1306 .ivsize = DES3_EDE_BLOCK_SIZE,
1307 .maxauthsize = SHA256_DIGEST_SIZE,
1308 }
1309 },
1299 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP | 1310 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP |
1300 DESC_HDR_SEL0_DEU | 1311 DESC_HDR_SEL0_DEU |
1301 DESC_HDR_MODE0_DEU_CBC | 1312 DESC_HDR_MODE0_DEU_CBC |
@@ -1306,19 +1317,23 @@ static struct talitos_alg_template driver_algs[] = {
1306 DESC_HDR_MODE1_MDEU_SHA256_HMAC, 1317 DESC_HDR_MODE1_MDEU_SHA256_HMAC,
1307 }, 1318 },
1308 { 1319 {
1309 .name = "authenc(hmac(md5),cbc(aes))", 1320 .alg = {
1310 .driver_name = "authenc-hmac-md5-cbc-aes-talitos", 1321 .cra_name = "authenc(hmac(md5),cbc(aes))",
1311 .blocksize = AES_BLOCK_SIZE, 1322 .cra_driver_name = "authenc-hmac-md5-cbc-aes-talitos",
1312 .aead = { 1323 .cra_blocksize = AES_BLOCK_SIZE,
1313 .setkey = aead_authenc_setkey, 1324 .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
1314 .setauthsize = aead_authenc_setauthsize, 1325 .cra_type = &crypto_aead_type,
1315 .encrypt = aead_authenc_encrypt, 1326 .cra_aead = {
1316 .decrypt = aead_authenc_decrypt, 1327 .setkey = aead_setkey,
1317 .givencrypt = aead_authenc_givencrypt, 1328 .setauthsize = aead_setauthsize,
1318 .geniv = "<built-in>", 1329 .encrypt = aead_encrypt,
1319 .ivsize = AES_BLOCK_SIZE, 1330 .decrypt = aead_decrypt,
1320 .maxauthsize = MD5_DIGEST_SIZE, 1331 .givencrypt = aead_givencrypt,
1321 }, 1332 .geniv = "<built-in>",
1333 .ivsize = AES_BLOCK_SIZE,
1334 .maxauthsize = MD5_DIGEST_SIZE,
1335 }
1336 },
1322 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP | 1337 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP |
1323 DESC_HDR_SEL0_AESU | 1338 DESC_HDR_SEL0_AESU |
1324 DESC_HDR_MODE0_AESU_CBC | 1339 DESC_HDR_MODE0_AESU_CBC |
@@ -1328,19 +1343,23 @@ static struct talitos_alg_template driver_algs[] = {
1328 DESC_HDR_MODE1_MDEU_MD5_HMAC, 1343 DESC_HDR_MODE1_MDEU_MD5_HMAC,
1329 }, 1344 },
1330 { 1345 {
1331 .name = "authenc(hmac(md5),cbc(des3_ede))", 1346 .alg = {
1332 .driver_name = "authenc-hmac-md5-cbc-3des-talitos", 1347 .cra_name = "authenc(hmac(md5),cbc(des3_ede))",
1333 .blocksize = DES3_EDE_BLOCK_SIZE, 1348 .cra_driver_name = "authenc-hmac-md5-cbc-3des-talitos",
1334 .aead = { 1349 .cra_blocksize = DES3_EDE_BLOCK_SIZE,
1335 .setkey = aead_authenc_setkey, 1350 .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
1336 .setauthsize = aead_authenc_setauthsize, 1351 .cra_type = &crypto_aead_type,
1337 .encrypt = aead_authenc_encrypt, 1352 .cra_aead = {
1338 .decrypt = aead_authenc_decrypt, 1353 .setkey = aead_setkey,
1339 .givencrypt = aead_authenc_givencrypt, 1354 .setauthsize = aead_setauthsize,
1340 .geniv = "<built-in>", 1355 .encrypt = aead_encrypt,
1341 .ivsize = DES3_EDE_BLOCK_SIZE, 1356 .decrypt = aead_decrypt,
1342 .maxauthsize = MD5_DIGEST_SIZE, 1357 .givencrypt = aead_givencrypt,
1343 }, 1358 .geniv = "<built-in>",
1359 .ivsize = DES3_EDE_BLOCK_SIZE,
1360 .maxauthsize = MD5_DIGEST_SIZE,
1361 }
1362 },
1344 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP | 1363 .desc_hdr_template = DESC_HDR_TYPE_IPSEC_ESP |
1345 DESC_HDR_SEL0_DEU | 1364 DESC_HDR_SEL0_DEU |
1346 DESC_HDR_MODE0_DEU_CBC | 1365 DESC_HDR_MODE0_DEU_CBC |
@@ -1453,19 +1472,13 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
1453 return ERR_PTR(-ENOMEM); 1472 return ERR_PTR(-ENOMEM);
1454 1473
1455 alg = &t_alg->crypto_alg; 1474 alg = &t_alg->crypto_alg;
1475 *alg = template->alg;
1456 1476
1457 snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s", template->name);
1458 snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
1459 template->driver_name);
1460 alg->cra_module = THIS_MODULE; 1477 alg->cra_module = THIS_MODULE;
1461 alg->cra_init = talitos_cra_init; 1478 alg->cra_init = talitos_cra_init;
1462 alg->cra_priority = TALITOS_CRA_PRIORITY; 1479 alg->cra_priority = TALITOS_CRA_PRIORITY;
1463 alg->cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC;
1464 alg->cra_blocksize = template->blocksize;
1465 alg->cra_alignmask = 0; 1480 alg->cra_alignmask = 0;
1466 alg->cra_type = &crypto_aead_type;
1467 alg->cra_ctxsize = sizeof(struct talitos_ctx); 1481 alg->cra_ctxsize = sizeof(struct talitos_ctx);
1468 alg->cra_u.aead = template->aead;
1469 1482
1470 t_alg->desc_hdr_template = template->desc_hdr_template; 1483 t_alg->desc_hdr_template = template->desc_hdr_template;
1471 t_alg->dev = dev; 1484 t_alg->dev = dev;