Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: xts - Only add ecb if it is not already there

Only add ecb to the cipher name if it isn't already ecb.

Also use memcmp instead of strncmp since these strings are all
stored in an array of length CRYPTO_MAX_ALG_NAME.

Fixes: f1c131b45410 ("crypto: xts - Convert to skcipher")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+2 -2
+2 -2
crypto/xts.c
··· 363 363 364 364 err = crypto_grab_skcipher(&ctx->spawn, skcipher_crypto_instance(inst), 365 365 cipher_name, 0, mask); 366 - if (err == -ENOENT) { 366 + if (err == -ENOENT && memcmp(cipher_name, "ecb(", 4)) { 367 367 err = -ENAMETOOLONG; 368 368 if (snprintf(name, CRYPTO_MAX_ALG_NAME, "ecb(%s)", 369 369 cipher_name) >= CRYPTO_MAX_ALG_NAME) ··· 397 397 /* Alas we screwed up the naming so we have to mangle the 398 398 * cipher name. 399 399 */ 400 - if (!strncmp(cipher_name, "ecb(", 4)) { 400 + if (!memcmp(cipher_name, "ecb(", 4)) { 401 401 int len; 402 402 403 403 len = strscpy(name, cipher_name + 4, sizeof(name));