Skip to content

Commit 0e35e9c

Browse files
Merge pull request #6806 from lealem47/XTS
Add XTS API's required for VeraCrypt
2 parents 653e5b0 + e7eec64 commit 0e35e9c

3 files changed

Lines changed: 257 additions & 1 deletion

File tree

wolfcrypt/src/aes.c

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11445,6 +11445,98 @@ int wc_AesXtsDecrypt(XtsAes* xaes, byte* out, const byte* in, word32 sz,
1144511445
}
1144611446
#endif /* !WOLFSSL_ARMASM || WOLFSSL_ARMASM_NO_HW_CRYPTO */
1144711447

11448+
/* Same as wc_AesXtsEncryptSector but the sector gets incremented by one every
11449+
* sectorSz bytes
11450+
*
11451+
* xaes AES keys to use for block encrypt
11452+
* out output buffer to hold cipher text
11453+
* in input plain text buffer to encrypt
11454+
* sz size of both out and in buffers
11455+
* sector value to use for tweak
11456+
* sectorSz size of the sector
11457+
*
11458+
* returns 0 on success
11459+
*/
11460+
int wc_AesXtsEncryptConsecutiveSectors(XtsAes* aes, byte* out, const byte* in,
11461+
word32 sz, word64 sector, word32 sectorSz)
11462+
{
11463+
int ret = 0;
11464+
int iter = 0;
11465+
int sectorCount = sz / sectorSz;
11466+
int remainder = sz % sectorSz;
11467+
11468+
if (aes == NULL || out == NULL || in == NULL || sectorSz == 0) {
11469+
return BAD_FUNC_ARG;
11470+
}
11471+
11472+
if (sz < AES_BLOCK_SIZE) {
11473+
WOLFSSL_MSG("Cipher text input too small for encryption");
11474+
return BAD_FUNC_ARG;
11475+
}
11476+
11477+
while (sectorCount) {
11478+
ret = wc_AesXtsEncryptSector(aes, out + (iter * sectorSz),
11479+
in + (iter * sectorSz), sectorSz, sector);
11480+
if (ret != 0)
11481+
break;
11482+
11483+
sectorCount--;
11484+
iter++;
11485+
sector++;
11486+
}
11487+
11488+
if (remainder && ret == 0)
11489+
ret = wc_AesXtsEncryptSector(aes, out + (iter * sectorSz),
11490+
in + (iter * sectorSz), remainder, sector);
11491+
11492+
return ret;
11493+
}
11494+
11495+
/* Same as wc_AesXtsEncryptConsecutiveSectors but Aes key is AES_DECRYPTION type
11496+
*
11497+
* xaes AES keys to use for block decrypt
11498+
* out output buffer to hold cipher text
11499+
* in input plain text buffer to encrypt
11500+
* sz size of both out and in buffers
11501+
* sector value to use for tweak
11502+
* sectorSz size of the sector
11503+
*
11504+
* returns 0 on success
11505+
*/
11506+
int wc_AesXtsDecryptConsecutiveSectors(XtsAes* aes, byte* out, const byte* in,
11507+
word32 sz, word64 sector, word32 sectorSz)
11508+
{
11509+
int ret = 0;
11510+
int iter = 0;
11511+
int sectorCount = sz / sectorSz;
11512+
int remainder = sz % sectorSz;
11513+
11514+
if (aes == NULL || out == NULL || in == NULL || sectorSz == 0) {
11515+
return BAD_FUNC_ARG;
11516+
}
11517+
11518+
if (sz < AES_BLOCK_SIZE) {
11519+
WOLFSSL_MSG("Cipher text input too small for decryption");
11520+
return BAD_FUNC_ARG;
11521+
}
11522+
11523+
while (sectorCount) {
11524+
ret = wc_AesXtsDecryptSector(aes, out + (iter * sectorSz),
11525+
in + (iter * sectorSz), sectorSz, sector);
11526+
if (ret != 0)
11527+
break;
11528+
11529+
sectorCount--;
11530+
iter++;
11531+
sector++;
11532+
}
11533+
11534+
if (remainder && ret == 0)
11535+
ret = wc_AesXtsDecryptSector(aes, out + (iter * sectorSz),
11536+
in + (iter * sectorSz), remainder, sector);
11537+
11538+
return ret;
11539+
}
1144811540
#endif /* WOLFSSL_AES_XTS */
1144911541

1145011542
#ifdef WOLFSSL_AES_SIV

wolfcrypt/test/test.c

Lines changed: 157 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9820,6 +9820,10 @@ static wc_test_ret_t aes_xts_sector_test(void)
98209820
int aes_inited = 0;
98219821
wc_test_ret_t ret = 0;
98229822
unsigned char buf[AES_BLOCK_SIZE * 2];
9823+
#ifndef BENCH_EMBEDDED
9824+
/* Sector size for encrypt/decrypt consecutive sectors testcase */
9825+
word32 sectorSz = 512;
9826+
#endif
98239827

98249828
/* 128 key tests */
98259829
WOLFSSL_SMALL_STACK_STATIC unsigned char k1[] = {
@@ -9867,6 +9871,120 @@ static wc_test_ret_t aes_xts_sector_test(void)
98679871
};
98689872
word64 s2 = 187;
98699873

9874+
#ifndef BENCH_EMBEDDED
9875+
unsigned char data[550];
9876+
9877+
WOLFSSL_SMALL_STACK_STATIC unsigned char k3[] = {
9878+
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
9879+
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
9880+
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
9881+
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22
9882+
};
9883+
9884+
WOLFSSL_SMALL_STACK_STATIC unsigned char p3[] = {
9885+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
9886+
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
9887+
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
9888+
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
9889+
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
9890+
0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
9891+
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
9892+
0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
9893+
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
9894+
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
9895+
0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83,
9896+
0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
9897+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
9898+
0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
9899+
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,
9900+
0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
9901+
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb,
9902+
0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
9903+
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
9904+
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
9905+
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
9906+
0xfc, 0xfd, 0xfe, 0xff,
9907+
9908+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
9909+
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
9910+
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
9911+
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
9912+
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
9913+
0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
9914+
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
9915+
0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
9916+
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
9917+
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
9918+
0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83,
9919+
0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
9920+
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
9921+
0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
9922+
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,
9923+
0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
9924+
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb,
9925+
0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
9926+
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
9927+
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
9928+
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
9929+
0xfc, 0xfd, 0xfe, 0xff,
9930+
9931+
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
9932+
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
9933+
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
9934+
};
9935+
9936+
WOLFSSL_SMALL_STACK_STATIC unsigned char c3[] = {
9937+
0xb9, 0x6b, 0x2b, 0xfd, 0x61, 0x87, 0x84, 0xd5, 0x26, 0xd2, 0x8c, 0x62,
9938+
0x63, 0x01, 0xca, 0x46, 0xb1, 0x82, 0xfa, 0xdc, 0xbc, 0x32, 0x18, 0xe9,
9939+
0xda, 0xe6, 0xda, 0xd1, 0x1a, 0x52, 0x77, 0xca, 0xdb, 0x0e, 0xbe, 0x37,
9940+
0x88, 0x36, 0x1c, 0x87, 0x16, 0x60, 0xfe, 0xa8, 0x9e, 0xf6, 0x48, 0x64,
9941+
0x94, 0x34, 0x64, 0xed, 0xf6, 0x9a, 0xc5, 0x28, 0xc9, 0xed, 0x64, 0x80,
9942+
0x85, 0xd8, 0x93, 0xa7, 0x50, 0xb1, 0x9d, 0x2f, 0x1e, 0x34, 0xcc, 0xb4,
9943+
0x03, 0xfb, 0x6b, 0x43, 0x21, 0xa8, 0x5b, 0xc6, 0x59, 0x13, 0xd2, 0xb5,
9944+
0xf5, 0x7b, 0xf6, 0xb2, 0xa4, 0x7a, 0xd2, 0x50, 0x26, 0xcb, 0xa4, 0x83,
9945+
0xc3, 0x56, 0xb0, 0xb1, 0x14, 0x34, 0x12, 0x1b, 0xea, 0x26, 0x97, 0x24,
9946+
0x54, 0xcc, 0x32, 0x4c, 0xa4, 0xc2, 0xa3, 0x07, 0xfa, 0x30, 0xa9, 0xf0,
9947+
0x91, 0x17, 0x60, 0x68, 0x88, 0x7f, 0x34, 0x7e, 0xbd, 0x20, 0x33, 0x95,
9948+
0x6e, 0xc0, 0xb6, 0x2b, 0xff, 0x7e, 0x61, 0x35, 0x9a, 0x88, 0xff, 0xd9,
9949+
0x69, 0x21, 0xe7, 0x8f, 0x45, 0x02, 0xf9, 0xd7, 0xeb, 0xa6, 0x53, 0xf1,
9950+
0x73, 0x04, 0xf1, 0x0b, 0x85, 0xc6, 0x1f, 0x4a, 0x51, 0x2f, 0x95, 0x87,
9951+
0x5a, 0x67, 0x37, 0xb2, 0x87, 0xf7, 0xbe, 0x2a, 0x17, 0x57, 0xca, 0xfc,
9952+
0xdd, 0x5f, 0x37, 0x48, 0x78, 0xbd, 0xfa, 0x75, 0xc9, 0xfa, 0x86, 0x7e,
9953+
0xc4, 0x0f, 0x60, 0x85, 0xce, 0x12, 0x44, 0x7c, 0xd9, 0xb2, 0x50, 0xd9,
9954+
0x57, 0x85, 0xa5, 0xd7, 0x68, 0x59, 0x03, 0x09, 0x97, 0x2e, 0x8e, 0xa5,
9955+
0xe3, 0x98, 0xac, 0x16, 0xfb, 0x6d, 0x54, 0xc5, 0x5d, 0x7a, 0x33, 0x44,
9956+
0x0a, 0x39, 0x91, 0xcc, 0x9f, 0x67, 0xf9, 0x89, 0xbb, 0x62, 0x02, 0xc4,
9957+
0x22, 0xec, 0xcf, 0x97, 0x69, 0x81, 0x3d, 0x00, 0xfd, 0xeb, 0x55, 0x08,
9958+
0xa2, 0xff, 0x97, 0xaa, 0x79, 0xde, 0x3c, 0x8a, 0x78, 0x71, 0x73, 0xa2,
9959+
0x98, 0x2f, 0xd8, 0x5c, 0x62, 0x1c, 0x5c, 0x23, 0x0a, 0xd1, 0xf1, 0x81,
9960+
0x8a, 0x12, 0xe7, 0x4d, 0xdd, 0x4f, 0xd4, 0xf1, 0xe8, 0x0f, 0x25, 0x79,
9961+
0x45, 0x4a, 0x49, 0x49, 0x7e, 0x56, 0x91, 0x4e, 0xaa, 0xba, 0x18, 0xe1,
9962+
0xe4, 0xbe, 0x21, 0xdc, 0x58, 0x60, 0x6f, 0x6a, 0x7f, 0xdc, 0x5e, 0x74,
9963+
0x47, 0xbf, 0xeb, 0x84, 0xc4, 0x1e, 0x5a, 0x61, 0x64, 0xc8, 0x63, 0x68,
9964+
0xfa, 0x17, 0x9c, 0xac, 0x60, 0x1c, 0xa5, 0x6e, 0x00, 0x21, 0x93, 0x3c,
9965+
0xd7, 0xbb, 0x73, 0x45, 0xf7, 0x34, 0x81, 0x6c, 0xfa, 0xf2, 0x33, 0xfd,
9966+
0xb1, 0x40, 0x30, 0x6b, 0x30, 0xd1, 0x83, 0x5e, 0x2e, 0x7a, 0xce, 0xa6,
9967+
0x12, 0x2a, 0x15, 0x03, 0x78, 0x29, 0xb9, 0x07, 0xae, 0xe7, 0xc2, 0x78,
9968+
0x74, 0x72, 0xa5, 0x0e, 0x6b, 0x1f, 0x78, 0xf2, 0x5a, 0x69, 0xb6, 0x2b,
9969+
0x99, 0x94, 0x1f, 0x89, 0xd1, 0x21, 0x14, 0x4a, 0x54, 0xab, 0x5a, 0x9f,
9970+
0xaa, 0xa7, 0x96, 0x0a, 0x21, 0xce, 0x30, 0xb6, 0x70, 0x81, 0xe9, 0xd3,
9971+
0x71, 0xc0, 0xf1, 0x15, 0xe2, 0xf6, 0xd3, 0xcc, 0x41, 0x15, 0x9d, 0xd5,
9972+
0xa3, 0xa4, 0xe0, 0xf8, 0x62, 0xc4, 0x76, 0x65, 0x63, 0x89, 0xa7, 0xe2,
9973+
0xfb, 0xf5, 0xc9, 0x80, 0x15, 0x5b, 0xc1, 0x59, 0xb2, 0xd0, 0x01, 0x3a,
9974+
0xf9, 0xab, 0x5b, 0x79, 0x54, 0xed, 0x6b, 0xf9, 0x1d, 0x9d, 0x87, 0x63,
9975+
0x80, 0x4f, 0xec, 0x9c, 0x4f, 0xad, 0x97, 0x04, 0xff, 0x62, 0x4a, 0x17,
9976+
0xc0, 0x09, 0x2a, 0x2c, 0x23, 0x4b, 0xc3, 0xb6, 0x6d, 0xed, 0xdb, 0x1a,
9977+
0x6f, 0x56, 0x2b, 0x78, 0x92, 0x3a, 0x5c, 0x7f, 0xb2, 0x63, 0xd3, 0xd5,
9978+
0x1a, 0xbe, 0xc2, 0x34, 0xc8, 0xad, 0x36, 0xb7, 0x12, 0xb8, 0xe1, 0xb7,
9979+
0x52, 0x7f, 0x16, 0x84, 0x2c, 0x47, 0x7e, 0xf2, 0xa5, 0x36, 0x2e, 0xad,
9980+
0xe7, 0xbb, 0xc0, 0x6f, 0x27, 0x8e, 0x41, 0x08, 0x75, 0xe5, 0xff, 0xde,
9981+
0x08, 0x9f, 0x8c, 0x91, 0xba, 0xc9, 0x9d, 0x9f, 0x27, 0x90, 0x50, 0x44,
9982+
0x24, 0xe7, 0x3d, 0x6f
9983+
};
9984+
9985+
word64 s3 = 0x000000ffffffffff;
9986+
#endif
9987+
98709988
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
98719989
if ((aes = (XtsAes *)XMALLOC(sizeof *aes, HEAP_HINT, DYNAMIC_TYPE_AES)) == NULL)
98729990
ERROR_OUT(WC_TEST_RET_ENC_ERRNO, out);
@@ -9935,8 +10053,46 @@ static wc_test_ret_t aes_xts_sector_test(void)
993510053
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
993610054
if (XMEMCMP(p2, buf, sizeof(p2)))
993710055
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
10056+
wc_AesXtsFree(aes);
993810057

9939-
out:
10058+
#ifndef BENCH_EMBEDDED
10059+
/* encrypt consecutive sectors test */
10060+
XMEMSET(data, 0, sizeof(buf));
10061+
ret = wc_AesXtsSetKey(aes, k3, sizeof(k3), AES_ENCRYPTION,
10062+
HEAP_HINT, devId);
10063+
if (ret != 0)
10064+
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
10065+
ret = wc_AesXtsEncryptConsecutiveSectors(aes, data, p3,
10066+
sizeof(p3), s3, sectorSz);
10067+
#if defined(WOLFSSL_ASYNC_CRYPT)
10068+
ret = wc_AsyncWait(ret, &aes->aes.asyncDev, WC_ASYNC_FLAG_NONE);
10069+
#endif
10070+
if (ret != 0)
10071+
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
10072+
if (XMEMCMP(c3, data, sizeof(c3)))
10073+
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
10074+
wc_AesXtsFree(aes);
10075+
10076+
/* decrypt consecutive sectors test */
10077+
XMEMSET(data, 0, sizeof(buf));
10078+
ret = wc_AesXtsSetKey(aes, k3, sizeof(k3), AES_DECRYPTION,
10079+
HEAP_HINT, devId);
10080+
if (ret != 0)
10081+
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
10082+
ret = wc_AesXtsDecryptConsecutiveSectors(aes, data, c3,
10083+
sizeof(c3), s3, sectorSz);
10084+
#if defined(WOLFSSL_ASYNC_CRYPT)
10085+
ret = wc_AsyncWait(ret, &aes->aes.asyncDev, WC_ASYNC_FLAG_NONE);
10086+
#endif
10087+
if (ret != 0)
10088+
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
10089+
if (XMEMCMP(p3, data, sizeof(p3)))
10090+
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
10091+
wc_AesXtsFree(aes);
10092+
10093+
#endif
10094+
10095+
out:
994010096

994110097
if (aes_inited)
994210098
wc_AesXtsFree(aes);

wolfssl/wolfcrypt/aes.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,14 @@ WOLFSSL_API int wc_AesXtsEncrypt(XtsAes* aes, byte* out,
567567
WOLFSSL_API int wc_AesXtsDecrypt(XtsAes* aes, byte* out,
568568
const byte* in, word32 sz, const byte* i, word32 iSz);
569569

570+
WOLFSSL_API int wc_AesXtsEncryptConsecutiveSectors(XtsAes* aes,
571+
byte* out, const byte* in, word32 sz, word64 sector,
572+
word32 sectorSz);
573+
574+
WOLFSSL_API int wc_AesXtsDecryptConsecutiveSectors(XtsAes* aes,
575+
byte* out, const byte* in, word32 sz, word64 sector,
576+
word32 sectorSz);
577+
570578
WOLFSSL_API int wc_AesXtsFree(XtsAes* aes);
571579
#endif
572580

0 commit comments

Comments
 (0)