tree: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master head: 38641b83ebc54635151810eeef00b61da3097952 commit: 9e46eafdf82a67dd069eef27c48898b79379c9f2 [9/15] crypto: inside-secure - sha384 support reproduce: # apt-get install sparse git checkout 9e46eafdf82a67dd069eef27c48898b79379c9f2 make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow' drivers/crypto/inside-secure/safexcel_hash.c:1009:45: sparse: cast to restricted __le32 drivers/crypto/inside-secure/safexcel_hash.c:1010:45: sparse: cast to restricted __le32 include/linux/slab.h:631:13: sparse: call with no type! drivers/crypto/inside-secure/safexcel_hash.c:1303:25: sparse: cast truncates bits from constant value (6a09e667f3bcc908 becomes f3bcc908) drivers/crypto/inside-secure/safexcel_hash.c:1305:25: sparse: cast truncates bits from constant value (bb67ae8584caa73b becomes 84caa73b) drivers/crypto/inside-secure/safexcel_hash.c:1307:25: sparse: cast truncates bits from constant value (3c6ef372fe94f82b becomes fe94f82b) drivers/crypto/inside-secure/safexcel_hash.c:1309:25: sparse: cast truncates bits from constant value (a54ff53a5f1d36f1 becomes 5f1d36f1) drivers/crypto/inside-secure/safexcel_hash.c:1311:25: sparse: cast truncates bits from constant value (510e527fade682d1 becomes ade682d1) drivers/crypto/inside-secure/safexcel_hash.c:1313:26: sparse: cast truncates bits from constant value (9b05688c2b3e6c1f becomes 2b3e6c1f) drivers/crypto/inside-secure/safexcel_hash.c:1315:26: sparse: cast truncates bits from constant value (1f83d9abfb41bd6b becomes fb41bd6b) drivers/crypto/inside-secure/safexcel_hash.c:1317:26: sparse: cast truncates bits from constant value (5be0cd19137e2179 becomes 137e2179) >> drivers/crypto/inside-secure/safexcel_hash.c:1373:25: sparse: cast truncates bits from constant value (cbbb9d5dc1059ed8 becomes c1059ed8) >> drivers/crypto/inside-secure/safexcel_hash.c:1375:25: sparse: cast truncates bits from constant value (629a292a367cd507 becomes 367cd507) >> drivers/crypto/inside-secure/safexcel_hash.c:1377:25: sparse: cast truncates bits from constant value (9159015a3070dd17 becomes 3070dd17) >> drivers/crypto/inside-secure/safexcel_hash.c:1379:25: sparse: cast truncates bits from constant value (152fecd8f70e5939 becomes f70e5939) >> drivers/crypto/inside-secure/safexcel_hash.c:1381:25: sparse: cast truncates bits from constant value (67332667ffc00b31 becomes ffc00b31) >> drivers/crypto/inside-secure/safexcel_hash.c:1383:26: sparse: cast truncates bits from constant value (8eb44a8768581511 becomes 68581511) >> drivers/crypto/inside-secure/safexcel_hash.c:1385:26: sparse: cast truncates bits from constant value (db0c2e0d64f98fa7 becomes 64f98fa7) >> drivers/crypto/inside-secure/safexcel_hash.c:1387:26: sparse: cast truncates bits from constant value (47b5481dbefa4fa4 becomes befa4fa4) vim +1373 drivers/crypto/inside-secure/safexcel_hash.c 1295 1296 static int safexcel_sha512_init(struct ahash_request *areq) 1297 { 1298 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); 1299 struct safexcel_ahash_req *req = ahash_request_ctx(areq); 1300 1301 memset(req, 0, sizeof(*req)); 1302 > 1303 req->state[0] = lower_32_bits(SHA512_H0); 1304 req->state[1] = upper_32_bits(SHA512_H0); > 1305 req->state[2] = lower_32_bits(SHA512_H1); 1306 req->state[3] = upper_32_bits(SHA512_H1); > 1307 req->state[4] = lower_32_bits(SHA512_H2); 1308 req->state[5] = upper_32_bits(SHA512_H2); > 1309 req->state[6] = lower_32_bits(SHA512_H3); 1310 req->state[7] = upper_32_bits(SHA512_H3); > 1311 req->state[8] = lower_32_bits(SHA512_H4); 1312 req->state[9] = upper_32_bits(SHA512_H4); > 1313 req->state[10] = lower_32_bits(SHA512_H5); 1314 req->state[11] = upper_32_bits(SHA512_H5); > 1315 req->state[12] = lower_32_bits(SHA512_H6); 1316 req->state[13] = upper_32_bits(SHA512_H6); 1317 req->state[14] = lower_32_bits(SHA512_H7); 1318 req->state[15] = upper_32_bits(SHA512_H7); 1319 1320 ctx->alg = CONTEXT_CONTROL_CRYPTO_ALG_SHA512; 1321 req->digest = CONTEXT_CONTROL_DIGEST_PRECOMPUTED; 1322 req->state_sz = SHA512_DIGEST_SIZE; 1323 1324 return 0; 1325 } 1326 1327 static int safexcel_sha512_digest(struct ahash_request *areq) 1328 { 1329 int ret = safexcel_sha512_init(areq); 1330 1331 if (ret) 1332 return ret; 1333 1334 return safexcel_ahash_finup(areq); 1335 } 1336 1337 struct safexcel_alg_template safexcel_alg_sha512 = { 1338 .type = SAFEXCEL_ALG_TYPE_AHASH, 1339 .alg.ahash = { 1340 .init = safexcel_sha512_init, 1341 .update = safexcel_ahash_update, 1342 .final = safexcel_ahash_final, 1343 .finup = safexcel_ahash_finup, 1344 .digest = safexcel_sha512_digest, 1345 .export = safexcel_ahash_export, 1346 .import = safexcel_ahash_import, 1347 .halg = { 1348 .digestsize = SHA512_DIGEST_SIZE, 1349 .statesize = sizeof(struct safexcel_ahash_export_state), 1350 .base = { 1351 .cra_name = "sha512", 1352 .cra_driver_name = "safexcel-sha512", 1353 .cra_priority = 300, 1354 .cra_flags = CRYPTO_ALG_ASYNC | 1355 CRYPTO_ALG_KERN_DRIVER_ONLY, 1356 .cra_blocksize = SHA512_BLOCK_SIZE, 1357 .cra_ctxsize = sizeof(struct safexcel_ahash_ctx), 1358 .cra_init = safexcel_ahash_cra_init, 1359 .cra_exit = safexcel_ahash_cra_exit, 1360 .cra_module = THIS_MODULE, 1361 }, 1362 }, 1363 }, 1364 }; 1365 1366 static int safexcel_sha384_init(struct ahash_request *areq) 1367 { 1368 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); 1369 struct safexcel_ahash_req *req = ahash_request_ctx(areq); 1370 1371 memset(req, 0, sizeof(*req)); 1372 > 1373 req->state[0] = lower_32_bits(SHA384_H0); 1374 req->state[1] = upper_32_bits(SHA384_H0); > 1375 req->state[2] = lower_32_bits(SHA384_H1); 1376 req->state[3] = upper_32_bits(SHA384_H1); > 1377 req->state[4] = lower_32_bits(SHA384_H2); 1378 req->state[5] = upper_32_bits(SHA384_H2); > 1379 req->state[6] = lower_32_bits(SHA384_H3); 1380 req->state[7] = upper_32_bits(SHA384_H3); > 1381 req->state[8] = lower_32_bits(SHA384_H4); 1382 req->state[9] = upper_32_bits(SHA384_H4); > 1383 req->state[10] = lower_32_bits(SHA384_H5); 1384 req->state[11] = upper_32_bits(SHA384_H5); > 1385 req->state[12] = lower_32_bits(SHA384_H6); 1386 req->state[13] = upper_32_bits(SHA384_H6); > 1387 req->state[14] = lower_32_bits(SHA384_H7); 1388 req->state[15] = upper_32_bits(SHA384_H7); 1389 1390 ctx->alg = CONTEXT_CONTROL_CRYPTO_ALG_SHA384; 1391 req->digest = CONTEXT_CONTROL_DIGEST_PRECOMPUTED; 1392 req->state_sz = SHA512_DIGEST_SIZE; 1393 1394 return 0; 1395 } 1396 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation