1#
2# Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the Apache License 2.0 (the "License").  You may not use
5# this file except in compliance with the License.  You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8
9Title = SM4 test vectors from IETF draft-ribose-cfrg-sm4
10
11Cipher = SM4-ECB
12Key = 0123456789ABCDEFFEDCBA9876543210
13Plaintext  = 0123456789ABCDEFFEDCBA9876543210
14Ciphertext = 681EDF34D206965E86B3E94F536E4246
15
16Cipher = SM4-CBC
17Key = 0123456789ABCDEFFEDCBA9876543210
18IV  = 0123456789ABCDEFFEDCBA9876543210
19Plaintext = 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210
20Ciphertext = 2677F46B09C122CC975533105BD4A22AF6125F7275CE552C3A2BBCF533DE8A3B
21
22Cipher = SM4-CBC
23Key = 0123456789ABCDEFFEDCBA9876543210
24IV  = 0123456789ABCDEFFEDCBA9876543210
25Plaintext = 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210
26Ciphertext = 2677F46B09C122CC975533105BD4A22AF6125F7275CE552C3A2BBCF533DE8A3BFFF5A4F208092C0901BA02D5772977369915E3FA2356C9F4EB6460ECC457E7f8E3CFA3DEEBFE9883E3A48BCF7C4A11AA3EC9E0D317C5D319BE72A5CDDDEC640C
27
28Cipher = SM4-CBC
29Key = 0123456789ABCDEFFEDCBA9876543210
30IV  = 0123456789ABCDEFFEDCBA9876543210
31Plaintext = 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210
32Ciphertext = 2677f46b09c122cc975533105bd4a22af6125f7275ce552c3a2bbcf533de8a3bfff5a4f208092c0901ba02d5772977369915e3fa2356c9f4eb6460ecc457e7f8e3cfa3deebfe9883e3a48bcf7c4a11aa3ec9e0d317c5d319be72a5cdddec640c6fc70bfa3ddaafffdd7c09b2774dcb2cec29f0c6f0b6773e985b3e395e924238505a8f120d9ca84de5c3cf7e45f097b14b3a46c5b1068669982a5c1f5f61be291b984f331d44ffb2758f771672448fc957fa1416c446427a41e25d5524a2418b9d96b2f17582f0f1aa9c204c6807f54f7b6833c5f00856659ddabc245936868c
33
34Cipher = SM4-OFB
35Key = 0123456789ABCDEFFEDCBA9876543210
36IV  = 0123456789ABCDEFFEDCBA9876543210
37Plaintext = 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210
38Ciphertext = 693D9A535BAD5BB1786F53D7253A7056F2075D28B5235F58D50027E4177D2BCE
39
40Cipher = SM4-CFB
41Key = 0123456789ABCDEFFEDCBA9876543210
42IV  = 0123456789ABCDEFFEDCBA9876543210
43Plaintext = 0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFEDCBA9876543210
44Ciphertext = 693D9A535BAD5BB1786F53D7253A70569ED258A85A0467CC92AAB393DD978995
45
46Cipher = SM4-CTR
47Key = 0123456789ABCDEFFEDCBA9876543210
48IV  = 0123456789ABCDEFFEDCBA9876543210
49Plaintext = AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAA
50Ciphertext = C2B4759E78AC3CF43D0852F4E8D5F9FD7256E8A5FCB65A350EE00630912E44492A0B17E1B85B060D0FBA612D8A95831638B361FD5FFACD942F081485A83CA35D
51
52Title = SM4 GCM test vectors from RFC8998
53
54Cipher = SM4-GCM
55Key = 0123456789abcdeffedcba9876543210
56IV = 00001234567800000000abcd
57AAD = feedfacedeadbeeffeedfacedeadbeefabaddad2
58Tag = 83de3541e4c2b58177e065a9bf7b62ec
59Plaintext = aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccddddddddddddddddeeeeeeeeeeeeeeeeffffffffffffffffeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaa
60Ciphertext = 17f399f08c67d5ee19d0dc9969c4bb7d5fd46fd3756489069157b282bb200735d82710ca5c22f0ccfa7cbf93d496ac15a56834cbcf98c397b4024a2691233b8d
61
62Title = SM4 CCM test vectors from RFC8998
63
64Cipher = SM4-CCM
65Key = 0123456789abcdeffedcba9876543210
66IV = 00001234567800000000abcd
67AAD = feedfacedeadbeeffeedfacedeadbeefabaddad2
68Tag = 16842d4fa186f56ab33256971fa110f4
69Plaintext = aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccddddddddddddddddeeeeeeeeeeeeeeeeffffffffffffffffeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaa
70Ciphertext = 48af93501fa62adbcd414cce6034d895dda1bf8f132f042098661572e7483094fd12e518ce062c98acee28d95df4416bed31a2f04476c18bb40c84a74b97dc5b
71
72Title = SM4 XTS test vectors from GB/T 17964-2021
73
74Cipher = SM4-XTS
75Key = 2B7E151628AED2A6ABF7158809CF4F3C000102030405060708090A0B0C0D0E0F
76IV = F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF
77Plaintext = 6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E5130C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17
78Ciphertext =  E9538251C71D7B80BBE4483FEF497BD12C5C581BD6242FC51E08964FB4F60FDB0BA42F63499279213D318D2C11F6886E903BE7F93A1B3479
79
80Cipher = SM4-XTS
81Key = 2B7E151628AED2A6ABF7158809CF4F3C000102030405060708090A0B0C0D0E0F
82IV = F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF
83Plaintext = 6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E5130C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17
84Ciphertext =  E9538251C71D7B80BBE4483FEF497BD12C5C581BD6242FC51E08964FB4F60FDB0BA42F63499279213D318D2C11F6886E903BE7F93A1B3479
85XTSStandard = GB
86
87Title = SM4 XTS test vectors, while the XTS mode is standardized in IEEE Std 1619-2007
88
89Cipher = SM4-XTS
90Key = 2B7E151628AED2A6ABF7158809CF4F3C000102030405060708090A0B0C0D0E0F
91IV = F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF
92Plaintext = 6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E5130C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17
93Ciphertext =  E9538251C71D7B80BBE4483FEF497BD1B3DB1A3E60408C575D63FF7DB39F83260869F9E2585FEC9F0B863BF8FD784B8627D16C0DB6D2CFC7
94XTSStandard = IEEE
95
96Cipher = SM4-XTS
97Key = FFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0
98IV = 9A785634120000000000000000000000
99Plaintext = 000102030405060708090A0B0C0D0E0F10
100Ciphertext =  9E52443A35410CA0BA5637B94C0766F469
101