diff --git a/src/LibHac/Crypto/Impl/AesCore.cs b/src/LibHac/Crypto/Impl/AesCore.cs index a4111997..3fc14a76 100644 --- a/src/LibHac/Crypto/Impl/AesCore.cs +++ b/src/LibHac/Crypto/Impl/AesCore.cs @@ -63,7 +63,7 @@ public struct AesCore int bytesWritten = Transform(rented.Array, rented.Array, input.Length); - rented.Array.CopyTo(output); + rented.Span.Slice(0, bytesWritten).CopyTo(output); return bytesWritten; } diff --git a/tests/LibHac.Tests/CryptoTests/AesCbcTests.cs b/tests/LibHac.Tests/CryptoTests/AesCbcTests.cs index 50d5b087..e02aa44d 100644 --- a/tests/LibHac.Tests/CryptoTests/AesCbcTests.cs +++ b/tests/LibHac.Tests/CryptoTests/AesCbcTests.cs @@ -6,10 +6,10 @@ namespace LibHac.Tests.CryptoTests; public class AesCbcTests { public static EncryptionTestVector[] EncryptTestVectors = - RspReader.ReadEncryptionTestVectorsArray(true, "CBCVarKey128.rsp", "CBCVarTxt128.rsp", "CBCKeySbox128.rsp", "CBCGFSbox128.rsp"); + RspReader.ReadEncryptionTestVectorsArray(true, "CBCVarKey128.rsp", "CBCVarTxt128.rsp", "CBCKeySbox128.rsp", "CBCGFSbox128.rsp", "CBC128Long.rsp"); public static EncryptionTestVector[] DecryptTestVectors = - RspReader.ReadEncryptionTestVectorsArray(false, "CBCVarKey128.rsp", "CBCVarTxt128.rsp", "CBCKeySbox128.rsp", "CBCGFSbox128.rsp"); + RspReader.ReadEncryptionTestVectorsArray(false, "CBCVarKey128.rsp", "CBCVarTxt128.rsp", "CBCKeySbox128.rsp", "CBCGFSbox128.rsp", "CBC128Long.rsp"); public static EncryptionTestVector[] EncryptMultiTestVectors = RspReader.ReadEncryptionTestVectorsArray(true, "CBCMMT128.rsp"); @@ -74,10 +74,10 @@ public class AesCbcTests #pragma warning disable xUnit1013 // Public method should be marked as test public static TheoryData EncryptTestVectors_Individual = - RspReader.ReadEncryptionTestVectors(true, "CBCVarKey128.rsp", "CBCVarTxt128.rsp", "CBCKeySbox128.rsp", "CBCGFSbox128.rsp"); + RspReader.ReadEncryptionTestVectors(true, "CBCVarKey128.rsp", "CBCVarTxt128.rsp", "CBCKeySbox128.rsp", "CBCGFSbox128.rsp", "CBC128Long.rsp"); public static TheoryData DecryptTestVectors_Individual = - RspReader.ReadEncryptionTestVectors(false, "CBCVarKey128.rsp", "CBCVarTxt128.rsp", "CBCKeySbox128.rsp", "CBCGFSbox128.rsp"); + RspReader.ReadEncryptionTestVectors(false, "CBCVarKey128.rsp", "CBCVarTxt128.rsp", "CBCKeySbox128.rsp", "CBCGFSbox128.rsp", "CBC128Long.rsp"); public static TheoryData EncryptMultiTestVectors_Individual = RspReader.ReadEncryptionTestVectors(true, "CBCMMT128.rsp"); diff --git a/tests/LibHac.Tests/CryptoTests/AesEcbTests.cs b/tests/LibHac.Tests/CryptoTests/AesEcbTests.cs index 2f574902..93e2d593 100644 --- a/tests/LibHac.Tests/CryptoTests/AesEcbTests.cs +++ b/tests/LibHac.Tests/CryptoTests/AesEcbTests.cs @@ -6,10 +6,10 @@ namespace LibHac.Tests.CryptoTests; public class AesEcbTests { public static EncryptionTestVector[] EncryptTestVectors = - RspReader.ReadEncryptionTestVectorsArray(true, "ECBVarKey128.rsp", "ECBVarTxt128.rsp", "ECBKeySbox128.rsp", "ECBGFSbox128.rsp"); + RspReader.ReadEncryptionTestVectorsArray(true, "ECBVarKey128.rsp", "ECBVarTxt128.rsp", "ECBKeySbox128.rsp", "ECBGFSbox128.rsp", "ECB128Long.rsp"); public static EncryptionTestVector[] DecryptTestVectors = - RspReader.ReadEncryptionTestVectorsArray(false, "ECBVarKey128.rsp", "ECBVarTxt128.rsp", "ECBKeySbox128.rsp", "ECBGFSbox128.rsp"); + RspReader.ReadEncryptionTestVectorsArray(false, "ECBVarKey128.rsp", "ECBVarTxt128.rsp", "ECBKeySbox128.rsp", "ECBGFSbox128.rsp", "ECB128Long.rsp"); public static EncryptionTestVector[] EncryptMultiTestVectors = RspReader.ReadEncryptionTestVectorsArray(true, "ECBMMT128.rsp"); @@ -74,10 +74,10 @@ public class AesEcbTests #pragma warning disable xUnit1013 // Public method should be marked as test public static TheoryData EncryptTestVectors_Individual = - RspReader.ReadEncryptionTestVectors(true, "ECBVarKey128.rsp", "ECBVarTxt128.rsp", "ECBKeySbox128.rsp", "ECBGFSbox128.rsp"); + RspReader.ReadEncryptionTestVectors(true, "ECBVarKey128.rsp", "ECBVarTxt128.rsp", "ECBKeySbox128.rsp", "ECBGFSbox128.rsp", "ECB128Long.rsp"); public static TheoryData DecryptTestVectors_Individual = - RspReader.ReadEncryptionTestVectors(false, "ECBVarKey128.rsp", "ECBVarTxt128.rsp", "ECBKeySbox128.rsp", "ECBGFSbox128.rsp"); + RspReader.ReadEncryptionTestVectors(false, "ECBVarKey128.rsp", "ECBVarTxt128.rsp", "ECBKeySbox128.rsp", "ECBGFSbox128.rsp", "ECB128Long.rsp"); public static TheoryData EncryptMultiTestVectors_Individual = RspReader.ReadEncryptionTestVectors(true, "ECBMMT128.rsp"); diff --git a/tests/LibHac.Tests/CryptoTests/AesXtsTests.cs b/tests/LibHac.Tests/CryptoTests/AesXtsTests.cs index 347c9468..f0b0850a 100644 --- a/tests/LibHac.Tests/CryptoTests/AesXtsTests.cs +++ b/tests/LibHac.Tests/CryptoTests/AesXtsTests.cs @@ -9,10 +9,10 @@ namespace LibHac.Tests.CryptoTests; public class AesXtsTests { public static EncryptionTestVector[] EncryptTestVectors = - RemovePartialByteTests(RspReader.ReadEncryptionTestVectorsArray(true, "XTSGenAES128.rsp")); + RemovePartialByteTests(RspReader.ReadEncryptionTestVectorsArray(true, "XTSGenAES128.rsp", "XTSAES128Long.rsp")); public static EncryptionTestVector[] DecryptTestVectors = - RemovePartialByteTests(RspReader.ReadEncryptionTestVectorsArray(false, "XTSGenAES128.rsp")); + RemovePartialByteTests(RspReader.ReadEncryptionTestVectorsArray(false, "XTSGenAES128.rsp", "XTSAES128Long.rsp")); // The XTS implementation only supports multiples of whole bytes private static EncryptionTestVector[] RemovePartialByteTests(EncryptionTestVector[] input) @@ -67,10 +67,10 @@ public class AesXtsTests #pragma warning disable xUnit1013 // Public method should be marked as test public static TheoryData EncryptTestVectors_Individual = - RemovePartialByteTests(RspReader.ReadEncryptionTestVectors(true, "XTSGenAES128.rsp")); + RemovePartialByteTests(RspReader.ReadEncryptionTestVectors(true, "XTSGenAES128.rsp", "XTSAES128Long.rsp")); public static TheoryData DecryptTestVectors_Individual = - RemovePartialByteTests(RspReader.ReadEncryptionTestVectors(false, "XTSGenAES128.rsp")); + RemovePartialByteTests(RspReader.ReadEncryptionTestVectors(false, "XTSGenAES128.rsp", "XTSAES128Long.rsp")); private static TheoryData RemovePartialByteTests(TheoryData input) { diff --git a/tests/LibHac.Tests/CryptoTests/TestVectors/CBC128Long.rsp b/tests/LibHac.Tests/CryptoTests/TestVectors/CBC128Long.rsp new file mode 100644 index 00000000..e693fdec --- /dev/null +++ b/tests/LibHac.Tests/CryptoTests/TestVectors/CBC128Long.rsp @@ -0,0 +1,20 @@ +# Large AES-CBC-128 test vectors + +[ENCRYPT] + +COUNT = 0 +KEY = cc1795a8ebb516723669c82bef7f3d7b +IV = 0f118d07e3116a8037e109e3bdd523fd +PLAINTEXT = 046ae94d7543d38504df4a10a0b56ead52883ab8f3e3a8c9be0fb16967e925b5cb4dd6a789c1001f819cbb3bc6af9293e242d372b19464b8eb2949bcb4d232b8c529386351feb4ca16d99378f97bcf12aad7179a4368dc5f91bf15739c06d75ffc2264c8437986104266a59baaa9ebbd014610d038aa74ac189d146ad01b2b253a226fe3a69c1b7042051ee13a5a61d0af6b324f936eb990800871119d6471a47082e7cc3783629a476b8efc012c69d1fbd8af4c80b3ecf9e91d454dcc2a60725a2c75ab2e58c9b60cb5ccea9b09c0f1f924944c68daaaca612d5e1077a0ffa583dbe2cf509dbb42de793f53b65904e37fb1ab332d158080c8fa4f453123ff3f22ff8364c726ccf43fa470c1658b1381acce8504334a746b8887a6eb5a7e1bac0ee3a551841ed162a6d8158e0a018d5b9c4b48649f513c82397cfca18e3d14e0d3dfd7d0907466d56f833140b838b585b6e7d3ab284bd2ef863d42d2d0c7033916b74e2634107adede5fa4a5b4e1d472af8a2838a0c42fe9a49e7f6d4b270d7180239aff7bddd451169f91070a49f5751c8ac54a99305856d5eb5a12b972a33c699d80a60489c1a879cdeb2bf5defb9d5b3c4382bf2844ec252afe1142c653b5891ff538c19e82ea1d04ac6c7b66c9018e4fc415cfea381269a1db0f2f56c9051767f13975498ed2ab21817fbe5b40e6f58ef715b6e5bbc7e9b4fc9df75b5db36d587c302a080d29c42b700df0310e7d +CIPHERTEXT = 1eb775460c2ecde0a2d677b9c241931c762306ca0643b93546dbce36a7e50250eaf97810cec779ffe88d58fd63d3bae36e392b71f73a929076aa050a2b9febe6e167fa7c5b4da8d6b7262dee138b134e1fe13e2af494764c08ef491fe93dcb02405397955ab4742984f09888498895bc87d1fb612969d57e7a60368849efef898eb7ff004cf5bfca4a1fe1f120f3f69e81b73345ae75eca396df1b6a78eb0ee6fd6891519fc06a6cad9d5a56ccaddfb2966028ac48ab03e4f956e564890892e97497f31d1af35f2d0989e3ee0333e4d791c20b34b3af8e63c28960da54b4c3d6b40b56d1e73f62f145f7374fedcba3ad0896c6bd3ac360aeecb8540caaad6e68f28947c7fd52eda16c511374863dfbc09ebf9ec30a28d599c032d71cb1ddb90e28cee739675ba9f0c5f000ab2841a9a3433d7b9c1c5572cf21d092fa09630723e55c0bc68712cc27b15e32dfcb73d7915ebdaf8e386334e5b72c1f876438b2070b10849e293a4a6397056338bb8f4a82a7e4b0ee4bd00fe61cc5f2fc3c97274d6372050c9478b7aeb1384207e686551a71e68a2db113546154328ab4fea8d9007214fcbcc5c030578ced72545e5008ed9dc18129cacd2cd78e907fca3b2e91e2b5f471f857c32ff3680f68bc7dac67bfaa31c471e210af12876c101ff429b335699638634283476737e8f8c942d2d345d5d1fc2ecfb24fe150ee426e6c2d2b306f00c6b9c216a72c65d5afa1dc3b192d + + + +[DECRYPT] + +COUNT = 0 +KEY = cc1795a8ebb516723669c82bef7f3d7b +IV = 0f118d07e3116a8037e109e3bdd523fd +PLAINTEXT = 046ae94d7543d38504df4a10a0b56ead52883ab8f3e3a8c9be0fb16967e925b5cb4dd6a789c1001f819cbb3bc6af9293e242d372b19464b8eb2949bcb4d232b8c529386351feb4ca16d99378f97bcf12aad7179a4368dc5f91bf15739c06d75ffc2264c8437986104266a59baaa9ebbd014610d038aa74ac189d146ad01b2b253a226fe3a69c1b7042051ee13a5a61d0af6b324f936eb990800871119d6471a47082e7cc3783629a476b8efc012c69d1fbd8af4c80b3ecf9e91d454dcc2a60725a2c75ab2e58c9b60cb5ccea9b09c0f1f924944c68daaaca612d5e1077a0ffa583dbe2cf509dbb42de793f53b65904e37fb1ab332d158080c8fa4f453123ff3f22ff8364c726ccf43fa470c1658b1381acce8504334a746b8887a6eb5a7e1bac0ee3a551841ed162a6d8158e0a018d5b9c4b48649f513c82397cfca18e3d14e0d3dfd7d0907466d56f833140b838b585b6e7d3ab284bd2ef863d42d2d0c7033916b74e2634107adede5fa4a5b4e1d472af8a2838a0c42fe9a49e7f6d4b270d7180239aff7bddd451169f91070a49f5751c8ac54a99305856d5eb5a12b972a33c699d80a60489c1a879cdeb2bf5defb9d5b3c4382bf2844ec252afe1142c653b5891ff538c19e82ea1d04ac6c7b66c9018e4fc415cfea381269a1db0f2f56c9051767f13975498ed2ab21817fbe5b40e6f58ef715b6e5bbc7e9b4fc9df75b5db36d587c302a080d29c42b700df0310e7d +CIPHERTEXT = 1eb775460c2ecde0a2d677b9c241931c762306ca0643b93546dbce36a7e50250eaf97810cec779ffe88d58fd63d3bae36e392b71f73a929076aa050a2b9febe6e167fa7c5b4da8d6b7262dee138b134e1fe13e2af494764c08ef491fe93dcb02405397955ab4742984f09888498895bc87d1fb612969d57e7a60368849efef898eb7ff004cf5bfca4a1fe1f120f3f69e81b73345ae75eca396df1b6a78eb0ee6fd6891519fc06a6cad9d5a56ccaddfb2966028ac48ab03e4f956e564890892e97497f31d1af35f2d0989e3ee0333e4d791c20b34b3af8e63c28960da54b4c3d6b40b56d1e73f62f145f7374fedcba3ad0896c6bd3ac360aeecb8540caaad6e68f28947c7fd52eda16c511374863dfbc09ebf9ec30a28d599c032d71cb1ddb90e28cee739675ba9f0c5f000ab2841a9a3433d7b9c1c5572cf21d092fa09630723e55c0bc68712cc27b15e32dfcb73d7915ebdaf8e386334e5b72c1f876438b2070b10849e293a4a6397056338bb8f4a82a7e4b0ee4bd00fe61cc5f2fc3c97274d6372050c9478b7aeb1384207e686551a71e68a2db113546154328ab4fea8d9007214fcbcc5c030578ced72545e5008ed9dc18129cacd2cd78e907fca3b2e91e2b5f471f857c32ff3680f68bc7dac67bfaa31c471e210af12876c101ff429b335699638634283476737e8f8c942d2d345d5d1fc2ecfb24fe150ee426e6c2d2b306f00c6b9c216a72c65d5afa1dc3b192d + diff --git a/tests/LibHac.Tests/CryptoTests/TestVectors/CTR128.rsp b/tests/LibHac.Tests/CryptoTests/TestVectors/CTR128.rsp index 0adda5f4..e5c1cfa1 100644 --- a/tests/LibHac.Tests/CryptoTests/TestVectors/CTR128.rsp +++ b/tests/LibHac.Tests/CryptoTests/TestVectors/CTR128.rsp @@ -18,3 +18,9 @@ IV = 00e0017b27777f3f4a1786f000000001 PLAINTEXT = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223 CIPHERTEXT = c1cf48a89f2ffdd9cf4652e9efdb72d74540a42bde6d7836d59a5ceaaef3105325b2072f +COUNT = 3 +KEY = 7691be035e5020a8ac6e618529f9a0dc +IV = 00e0017b27777f3f4a1786f000000001 +PLAINTEXT = c3bbbc92963e759a279269ad93dc7de252c5567068d011b71762affe5e8eeaf1015ebb3eba6b7c18a3d8f61efb762a5393bd0213e25a807e0af0680405681a5c8ee6c3f9a858c23ab0a668406caac984a867f8e87075a4dfd771d3d7dd7a42a06b24ea468811e1afab7261c39213f5feb8f089a0d043be6098eb8d2491b0b64fb80028108747e0596354de14250621ace48db87b45b069eb337d923d5e64392d1dd08f85ce593c19abb334b3aaad4c13f26b01b025a1be5bebfcfd26449b62781fa421d5dd427aba6c97d4764343a63a2cb1553953ec1316852b06117553e05b7c8d8e38b76e7486084f2ab597104cc382248994f23e247ae3dbdbb5ea90196d293357ffa73d35c3e0309f23ae2b1497462af10a8c283c78c1b22103b769d7e48766206d9ce370b2c2c8563c0556d4c9a4e3e277cedd6d88d12032e6e321c6e86f64de4f62de65e523d6e9f1b369f0cd9811ece397654e3f976beab7ec9723dd0ce4edc41ea589f0c2fedb82540a041a25194c99d83e3f9561a51496b9f7378954abc9fcc6a9d8d4d68cbc29c3f1587f0e804fd9ba700f959bd5fe8707fbdb00bec2d25380103d6b1d5a1aa539bd30b162d101b534754592e95f7b174803ad23830b8ad65c37b3221abf152668a540abbf75afa837a9677e74fb020598fc7376c708ffbc8a129f6a5c0ed2eb51928c135aa16d7fe59d378060bb4167d0562de48db833b6da3624248a5ab99c9734817d +CIPHERTEXT = 0275f6390d148e44e0dd314f700a013a0794e048a2a87f96dae1e90fec60e4bd04cd9e32ad3e4a1805e508d1ad55adba784167bbbf5eecb76cc8472d43c74d93fd72a57f48847a6ea61416aaae835e9e44457feb1d05317d83767a39b19b2919997ed549ba3a96b30a027c30f3a23d6be3916c7d05ad09ffc3b0d87d049a9fb6014d173905d35753863b791db9b5cc62a5a5f1f631efc0c3320aa6580e71a0686adfbed4206362f3e26950d2c7b2a1314241f1f9812d5d50236a36cdc00832a2d4e0c57ad3d542b801ae56d22be6ba7ee3ba62fdb337ebc299feb4278f355d3eccedfd8584cfbe2d5ba83c55b07ad3dc50ff988a7b05fca81e6d4b3934c6435f4443c6d76e44a4572878bfe98fc0fc4b868ae40528ad6057fccd8497799d67393b6d3a5a0481e5bb4f9ab40e176adfba1fc57917318b18d76381f76301c2f509025b12a93cf812ce9461a543934ba81f486cd992de153a5a5503256fd975116b493c6a8eec9d5217d4b775ecafda14fcae831083ec483005695aa7118d0bb91840b9784fd0cc72326d1c270d13225797b6eb56502879dbf9471cb2eea3f662ebf383b94c982258e49517c91b2b2dde04f6edd793edbc8761f0ee2cbc7d71c97e2a1dddfd8702acffc8622de40862b911ddce9186441428ff849f692feafa06d33c3cf905c602d3a16eb9eeec147e99dd7db16523ecf6332c694455be9d9f4925c81c1499a511c7ac1e3610b6f785a502 + diff --git a/tests/LibHac.Tests/CryptoTests/TestVectors/ECB128Long.rsp b/tests/LibHac.Tests/CryptoTests/TestVectors/ECB128Long.rsp new file mode 100644 index 00000000..79fc51f8 --- /dev/null +++ b/tests/LibHac.Tests/CryptoTests/TestVectors/ECB128Long.rsp @@ -0,0 +1,16 @@ +# Large AES-ECB-128 test vectors + +[ENCRYPT] + +COUNT = 0 +KEY = 00000000000000000000000000000000 +PLAINTEXT = 6381fb697d29c20b143c80e29018b8a2f0a6723f4c3284e63f5be759e0951a2d704a61c71ea92bb7f28f03568e57557dd502dbe59f58e266da777143fcdbb3105d65d4411cdc83f6e0f47eb2c379216b425fc03b929c0e8e92f3f384739f4d6e4cd081b6ad23638f517e18aab0e75a4281cd138be4061f8377e083662c7807c3bbd3cabf630ef6e33cbc62347dd0a6f65ac49ebfa683505beb3025417e324697def26da680ad19b5fef52d2091701f2ff462f8c5c7759af0bedf7968f7958db6f51656b44bc5e97f3869344fc117d583001b1521184f6743ef4b7b0ea69967b20e0e0adbf5028250a8d105f5e8ee13aef00e7793234e982ee6a49b52a2a313e878dfb5e85b9399b38ef5f60b448cc8e9c78f3895ea149d2e5e4c684a50a2e254cd32824069d33dfee91ba7fc6cf6f4bd2a5e9639d3cae6ddd83929140e82b0faeb4569931939d46b1932394e332e8781207a944ff54155b52f8472ed46a2a9e5a28d77818333a8a4882c43f3b2f47d0ab6cb51a160066fda9aa88851c4780fc5a4f11335342d0bb0cd854398b54583f7727d53464a6542a1c98194d8c8c19366a88f31ebae3ec4370dd8b3a6c637fe5383c70fbdac2646de38471c360132b382f74e8e33c37ff6397fbdd28160ba3c85f122c7ec290bbc3340d4e11d711ddc9b4812a172cda15f2cf3ea7d3c8001eea81dd67ee633bfa3e5353a45bb097e15f95ce374df29b4699a60fd4ec7e941c14a +CIPHERTEXT = 00310103770cb6b0c4e12ee228ec2ad07a0b40f4c6b441fd0fadd7278993b48bce5392e8d1d2944ed2df1d5a5a126672162d0955ac14e58d4cba129f1307fbf64f8c461cee0b9a5ec48db68e40f2e8b106e35bd420340c8db5c6137426e5716238a73903860cf322d762ed5a174bce75d2adaaccaa06668cda904139a122629404cb1bdd3f07c1773df624b73b5b02069ed04910907b006f716ece5e4f4afcdf9040aa908597b2addc55267c8e7a4fc8f73a4929ea054291c711b1b1e8fb3bfbf7736bbb542d8bac1e327c83a2307571893f236134fb7e0ae92711b98d5693afa44b7ca04729b40d6dbc885a42a925fbc04b9d184ff380901828fac9d0cb4af1737c9f3c7d761dd224faff56b1744733dcd7ac09837a515e5c74582ee4a7c453cbbc6a209891e2d11cbcf38e00e6fa16ce2fc7ed5124b9f10527225526a7fa17522f308c1ba6a920c8453bfc8bc82017cb60d0dabc5b1f64da432c4918615c5f7d899022eb393b2a791ccdf6cab2c2a6d88b281b5ecd9aee0fb6c86b216181c564b18791c693d78711256951188fabb159d0f85e010fa01d56e5c4535f7fb26f5e5cc0fcce89387776b299330b06c5a88c52db0e46b70fa276d20086fbc4b76e5e8e45c9bdcd67abe2b75e275f60a007ec94df3f15da7ee8322ed1f5ae5a468706570265028da374c5b7a7a7e359a67ff8f124733f747b02d72110afb70ae94e8540a6400be623699979fedbf6844b5b + +[DECRYPT] + +COUNT = 0 +KEY = 00000000000000000000000000000000 +CIPHERTEXT = 00310103770cb6b0c4e12ee228ec2ad07a0b40f4c6b441fd0fadd7278993b48bce5392e8d1d2944ed2df1d5a5a126672162d0955ac14e58d4cba129f1307fbf64f8c461cee0b9a5ec48db68e40f2e8b106e35bd420340c8db5c6137426e5716238a73903860cf322d762ed5a174bce75d2adaaccaa06668cda904139a122629404cb1bdd3f07c1773df624b73b5b02069ed04910907b006f716ece5e4f4afcdf9040aa908597b2addc55267c8e7a4fc8f73a4929ea054291c711b1b1e8fb3bfbf7736bbb542d8bac1e327c83a2307571893f236134fb7e0ae92711b98d5693afa44b7ca04729b40d6dbc885a42a925fbc04b9d184ff380901828fac9d0cb4af1737c9f3c7d761dd224faff56b1744733dcd7ac09837a515e5c74582ee4a7c453cbbc6a209891e2d11cbcf38e00e6fa16ce2fc7ed5124b9f10527225526a7fa17522f308c1ba6a920c8453bfc8bc82017cb60d0dabc5b1f64da432c4918615c5f7d899022eb393b2a791ccdf6cab2c2a6d88b281b5ecd9aee0fb6c86b216181c564b18791c693d78711256951188fabb159d0f85e010fa01d56e5c4535f7fb26f5e5cc0fcce89387776b299330b06c5a88c52db0e46b70fa276d20086fbc4b76e5e8e45c9bdcd67abe2b75e275f60a007ec94df3f15da7ee8322ed1f5ae5a468706570265028da374c5b7a7a7e359a67ff8f124733f747b02d72110afb70ae94e8540a6400be623699979fedbf6844b5b +PLAINTEXT = 6381fb697d29c20b143c80e29018b8a2f0a6723f4c3284e63f5be759e0951a2d704a61c71ea92bb7f28f03568e57557dd502dbe59f58e266da777143fcdbb3105d65d4411cdc83f6e0f47eb2c379216b425fc03b929c0e8e92f3f384739f4d6e4cd081b6ad23638f517e18aab0e75a4281cd138be4061f8377e083662c7807c3bbd3cabf630ef6e33cbc62347dd0a6f65ac49ebfa683505beb3025417e324697def26da680ad19b5fef52d2091701f2ff462f8c5c7759af0bedf7968f7958db6f51656b44bc5e97f3869344fc117d583001b1521184f6743ef4b7b0ea69967b20e0e0adbf5028250a8d105f5e8ee13aef00e7793234e982ee6a49b52a2a313e878dfb5e85b9399b38ef5f60b448cc8e9c78f3895ea149d2e5e4c684a50a2e254cd32824069d33dfee91ba7fc6cf6f4bd2a5e9639d3cae6ddd83929140e82b0faeb4569931939d46b1932394e332e8781207a944ff54155b52f8472ed46a2a9e5a28d77818333a8a4882c43f3b2f47d0ab6cb51a160066fda9aa88851c4780fc5a4f11335342d0bb0cd854398b54583f7727d53464a6542a1c98194d8c8c19366a88f31ebae3ec4370dd8b3a6c637fe5383c70fbdac2646de38471c360132b382f74e8e33c37ff6397fbdd28160ba3c85f122c7ec290bbc3340d4e11d711ddc9b4812a172cda15f2cf3ea7d3c8001eea81dd67ee633bfa3e5353a45bb097e15f95ce374df29b4699a60fd4ec7e941c14a + diff --git a/tests/LibHac.Tests/CryptoTests/TestVectors/XTSAES128Long.rsp b/tests/LibHac.Tests/CryptoTests/TestVectors/XTSAES128Long.rsp new file mode 100644 index 00000000..9069c406 --- /dev/null +++ b/tests/LibHac.Tests/CryptoTests/TestVectors/XTSAES128Long.rsp @@ -0,0 +1,22 @@ +# Large AES-XTS-128 test vectors + +[ENCRYPT] + +COUNT = 0 +DataUnitLen = 4224 +Key = abe2a7fa9b9ef3b971158c7832dff7a7ba4805384867d0672bd22d95c59d9938 +i = 3a574e50ed8de48f70a9b1cea6a1bb7c +PT = 0d39a7de0800f7458a11d8b5dc79bae8e4965e5620c4f4d7feea4bab4c2587f5008eb76396144da787e2f7f3878484fdb5959f8ff685ce47335183a17307616e06892ed04754788fa203a1d40370ecfaf3ad760b86e68b630d1ab4aea0fff36f5f318ffe7c1efbad013d5e57c44a7313135f648e6db549c04425b6d9b3016d4a73708d7363db59fa111b37516a4d3c497900de151388f6edeace04a3f8556f2aa354e3885e200d61917ef13a0a5b12f33bb64acf8bb9d54c500658856cd37c594caa5b239552dd686b1e4452d884252ac62dc594cfe21027b1776d38d134c746681572bccffc9ae1f8d1f194f9cfa4a4ed3794943d824511b812cc9a96b18b83373b32b5e8df64ac66d93a10ac17b06206a6c179d32f32ce05bae35f61c8f4048e48319bc603e3994de0125dbf472e5537187c92c3cfc94e16c83029ee50474799d91c4530a64f9252d794abd66585965c369444b150e06b3a0b53f8cb2b3ba1d962f954dd6fb03a7572d387ac24ff86df7ded63caf4e4a37bb1305ead70900955ed02ced4e63c7c4336558cd822bc8d60ffb32dc552a42b5219f9b6f8073879e6f938ffbcd6a3c53244e84499e0585eaa76628a34dd65cafafab5d4916b182dd6b506577287ca4cc5eedda6bb5f5ab180619f8a0c11f314e1291a4a037383c1f0a384508712037147811ff5108bc15fcbe009a00570072048f1c312260a89597488f5af77faa62e29de9edeb23a1e9d +CT = ca939e1e905d72092b20bd779732587cab1250f61d4caa36e244c7fcfb9a04ac8d4dec1d42bbe8dc989a2ed4aa18a756d195215695c96db80b5310d4a86ada1afef7535b3866fea036311b6cbaf7ee6887441b2ef83ab40ec1ef937a74275437208f33f646fb799fd7d78a0d0b466b36351264c1a6a8a4dad7f4a25e886d9b8ccc3074166655bfb11b52df57e274d2cd9e6ce0f019d19f41093b37032bf885e0859314d8b30c5b714b70de1a8b83350b4c4521d62c362eeaf9a54cc84a645775e324fe46d68b417b80d68f8e6fdcac6c7cecd90831470f475d710019b4b0d7919515b41ca177ec184b0f0052dbbbcd3a70af032806d2717f1aae9391943dbca5fb5baff59cbc6cfef2c540761425382a7307630db9a49b3321de954cca4c8ca26ec31bf3b224da2b2ef2062370c474e5ba3fadd3f5605f75dcdd6e49b857c7b83354fbd271b7cc33dc8243d837db316c30c59fe33256c4fdea47bcf3f2d0eb56ea1b042e459372666a90cd7ca6bb416a6f6b1d46aa2d58cbfc9ae7d835baaad43f0e8bd344e8622a8b3a48cf7a55c28b6aba74ca663df93f47586f3c8ebb5382fcc6a25905cebe4bd5b5031f4b94dd2800fd17827555bbbf2a23acd943721e8259b36e365ce9dbc4df4b0d8000ecbbea504623ee75dcbaa978da538eb96bcb15662d6390802bde8a338dd4266cee6a5220d20e052a6595831cece22e14687034ce0666bde7579efbdf02325c2bdfcd97 + + + +[DECRYPT] + +COUNT = 0 +DataUnitLen = 4224 +Key = abe2a7fa9b9ef3b971158c7832dff7a7ba4805384867d0672bd22d95c59d9938 +i = 3a574e50ed8de48f70a9b1cea6a1bb7c +PT = 0d39a7de0800f7458a11d8b5dc79bae8e4965e5620c4f4d7feea4bab4c2587f5008eb76396144da787e2f7f3878484fdb5959f8ff685ce47335183a17307616e06892ed04754788fa203a1d40370ecfaf3ad760b86e68b630d1ab4aea0fff36f5f318ffe7c1efbad013d5e57c44a7313135f648e6db549c04425b6d9b3016d4a73708d7363db59fa111b37516a4d3c497900de151388f6edeace04a3f8556f2aa354e3885e200d61917ef13a0a5b12f33bb64acf8bb9d54c500658856cd37c594caa5b239552dd686b1e4452d884252ac62dc594cfe21027b1776d38d134c746681572bccffc9ae1f8d1f194f9cfa4a4ed3794943d824511b812cc9a96b18b83373b32b5e8df64ac66d93a10ac17b06206a6c179d32f32ce05bae35f61c8f4048e48319bc603e3994de0125dbf472e5537187c92c3cfc94e16c83029ee50474799d91c4530a64f9252d794abd66585965c369444b150e06b3a0b53f8cb2b3ba1d962f954dd6fb03a7572d387ac24ff86df7ded63caf4e4a37bb1305ead70900955ed02ced4e63c7c4336558cd822bc8d60ffb32dc552a42b5219f9b6f8073879e6f938ffbcd6a3c53244e84499e0585eaa76628a34dd65cafafab5d4916b182dd6b506577287ca4cc5eedda6bb5f5ab180619f8a0c11f314e1291a4a037383c1f0a384508712037147811ff5108bc15fcbe009a00570072048f1c312260a89597488f5af77faa62e29de9edeb23a1e9d +CT = ca939e1e905d72092b20bd779732587cab1250f61d4caa36e244c7fcfb9a04ac8d4dec1d42bbe8dc989a2ed4aa18a756d195215695c96db80b5310d4a86ada1afef7535b3866fea036311b6cbaf7ee6887441b2ef83ab40ec1ef937a74275437208f33f646fb799fd7d78a0d0b466b36351264c1a6a8a4dad7f4a25e886d9b8ccc3074166655bfb11b52df57e274d2cd9e6ce0f019d19f41093b37032bf885e0859314d8b30c5b714b70de1a8b83350b4c4521d62c362eeaf9a54cc84a645775e324fe46d68b417b80d68f8e6fdcac6c7cecd90831470f475d710019b4b0d7919515b41ca177ec184b0f0052dbbbcd3a70af032806d2717f1aae9391943dbca5fb5baff59cbc6cfef2c540761425382a7307630db9a49b3321de954cca4c8ca26ec31bf3b224da2b2ef2062370c474e5ba3fadd3f5605f75dcdd6e49b857c7b83354fbd271b7cc33dc8243d837db316c30c59fe33256c4fdea47bcf3f2d0eb56ea1b042e459372666a90cd7ca6bb416a6f6b1d46aa2d58cbfc9ae7d835baaad43f0e8bd344e8622a8b3a48cf7a55c28b6aba74ca663df93f47586f3c8ebb5382fcc6a25905cebe4bd5b5031f4b94dd2800fd17827555bbbf2a23acd943721e8259b36e365ce9dbc4df4b0d8000ecbbea504623ee75dcbaa978da538eb96bcb15662d6390802bde8a338dd4266cee6a5220d20e052a6595831cece22e14687034ce0666bde7579efbdf02325c2bdfcd97 +