Skip to content

Commit 666b6a4

Browse files
committed
Give the XTS demo key two different halves
1 parent cc37913 commit 666b6a4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

crypto/aes-modes/aes-xts.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,10 @@ int main(int argc, char** argv)
361361

362362
wolfCrypt_Init();
363363

364-
/* Use a fixed key for demonstration (XTS uses two keys) */
365-
memset(key, 0x0D, AES_XTS_KEY_SIZE);
364+
/* Fixed key for demonstration. XTS is two keys; wolfSSL rejects a key
365+
* whose halves are identical, so they must differ. */
366+
memset(key, 0x0D, AES_XTS_KEY_SIZE / 2);
367+
memset(key + AES_XTS_KEY_SIZE / 2, 0x2A, AES_XTS_KEY_SIZE / 2);
366368

367369
/* Encrypt to temporary file */
368370
ret = encrypt_file(argv[1], "temp_encrypted.bin", key, AES_XTS_KEY_SIZE);

0 commit comments

Comments
 (0)