"Fossies" - the Fresh Open Source Software Archive

Member "src/Common/Tests.c" (10 Oct 2018, 81102 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Tests.c" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.21_Source_vs_1.22_Source.

    1 /*
    2  Legal Notice: Some portions of the source code contained in this file were
    3  derived from the source code of TrueCrypt 7.1a, which is
    4  Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
    5  governed by the TrueCrypt License 3.0, also from the source code of
    6  Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
    7  and which is governed by the 'License Agreement for Encryption for the Masses'
    8  Modifications and additions to the original source code (contained in this file)
    9  and all other portions of this file are Copyright (c) 2013-2017 IDRIX
   10  and are governed by the Apache License 2.0 the full text of which is
   11  contained in the file License.txt included in VeraCrypt binary and source
   12  code distribution packages. */
   13 
   14 #include "Tcdefs.h"
   15 #include "Crc.h"
   16 #include "Crypto.h"
   17 #include "Common/Endian.h"
   18 #include "Tests.h"
   19 #include "Xts.h"
   20 #include <string.h>
   21 #include "Pkcs5.h"
   22 #include "cpu.h"
   23 
   24 typedef struct {
   25     CRYPTOPP_ALIGN_DATA(16) unsigned __int8 key1[32];
   26     CRYPTOPP_ALIGN_DATA(16) unsigned __int8 key2[32];
   27     unsigned __int8 dataUnitNo[8];
   28     unsigned int blockNo;
   29     unsigned __int8 plaintext[ENCRYPTION_DATA_UNIT_SIZE];
   30     unsigned __int8 ciphertext[ENCRYPTION_DATA_UNIT_SIZE];
   31 } XTS_TEST;
   32 
   33 #define XTS_TEST_COUNT 5
   34 
   35 XTS_TEST XTS_vectors[XTS_TEST_COUNT] = {
   36 /* XTS-AES-256 */
   37 {
   38     // IEEE 1619 - Vector 10
   39 
   40     { 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 },
   41     { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
   42     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff },
   43     0,
   44     {
   45         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
   46         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
   47         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
   48         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
   49         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
   50         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
   51         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
   52         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
   53         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
   54         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
   55         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
   56         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
   57         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
   58         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
   59         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
   60         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
   61     },
   62     {
   63         0x1c, 0x3b, 0x3a, 0x10, 0x2f, 0x77, 0x03, 0x86, 0xe4, 0x83, 0x6c, 0x99, 0xe3, 0x70, 0xcf, 0x9b, 0xea, 0x00, 0x80, 0x3f, 0x5e, 0x48, 0x23, 0x57, 0xa4, 0xae, 0x12, 0xd4, 0x14, 0xa3, 0xe6, 0x3b,
   64         0x5d, 0x31, 0xe2, 0x76, 0xf8, 0xfe, 0x4a, 0x8d, 0x66, 0xb3, 0x17, 0xf9, 0xac, 0x68, 0x3f, 0x44, 0x68, 0x0a, 0x86, 0xac, 0x35, 0xad, 0xfc, 0x33, 0x45, 0xbe, 0xfe, 0xcb, 0x4b, 0xb1, 0x88, 0xfd,
   65         0x57, 0x76, 0x92, 0x6c, 0x49, 0xa3, 0x09, 0x5e, 0xb1, 0x08, 0xfd, 0x10, 0x98, 0xba, 0xec, 0x70, 0xaa, 0xa6, 0x69, 0x99, 0xa7, 0x2a, 0x82, 0xf2, 0x7d, 0x84, 0x8b, 0x21, 0xd4, 0xa7, 0x41, 0xb0,
   66         0xc5, 0xcd, 0x4d, 0x5f, 0xff, 0x9d, 0xac, 0x89, 0xae, 0xba, 0x12, 0x29, 0x61, 0xd0, 0x3a, 0x75, 0x71, 0x23, 0xe9, 0x87, 0x0f, 0x8a, 0xcf, 0x10, 0x00, 0x02, 0x08, 0x87, 0x89, 0x14, 0x29, 0xca,
   67         0x2a, 0x3e, 0x7a, 0x7d, 0x7d, 0xf7, 0xb1, 0x03, 0x55, 0x16, 0x5c, 0x8b, 0x9a, 0x6d, 0x0a, 0x7d, 0xe8, 0xb0, 0x62, 0xc4, 0x50, 0x0d, 0xc4, 0xcd, 0x12, 0x0c, 0x0f, 0x74, 0x18, 0xda, 0xe3, 0xd0,
   68         0xb5, 0x78, 0x1c, 0x34, 0x80, 0x3f, 0xa7, 0x54, 0x21, 0xc7, 0x90, 0xdf, 0xe1, 0xde, 0x18, 0x34, 0xf2, 0x80, 0xd7, 0x66, 0x7b, 0x32, 0x7f, 0x6c, 0x8c, 0xd7, 0x55, 0x7e, 0x12, 0xac, 0x3a, 0x0f,
   69         0x93, 0xec, 0x05, 0xc5, 0x2e, 0x04, 0x93, 0xef, 0x31, 0xa1, 0x2d, 0x3d, 0x92, 0x60, 0xf7, 0x9a, 0x28, 0x9d, 0x6a, 0x37, 0x9b, 0xc7, 0x0c, 0x50, 0x84, 0x14, 0x73, 0xd1, 0xa8, 0xcc, 0x81, 0xec,
   70         0x58, 0x3e, 0x96, 0x45, 0xe0, 0x7b, 0x8d, 0x96, 0x70, 0x65, 0x5b, 0xa5, 0xbb, 0xcf, 0xec, 0xc6, 0xdc, 0x39, 0x66, 0x38, 0x0a, 0xd8, 0xfe, 0xcb, 0x17, 0xb6, 0xba, 0x02, 0x46, 0x9a, 0x02, 0x0a,
   71         0x84, 0xe1, 0x8e, 0x8f, 0x84, 0x25, 0x20, 0x70, 0xc1, 0x3e, 0x9f, 0x1f, 0x28, 0x9b, 0xe5, 0x4f, 0xbc, 0x48, 0x14, 0x57, 0x77, 0x8f, 0x61, 0x60, 0x15, 0xe1, 0x32, 0x7a, 0x02, 0xb1, 0x40, 0xf1,
   72         0x50, 0x5e, 0xb3, 0x09, 0x32, 0x6d, 0x68, 0x37, 0x8f, 0x83, 0x74, 0x59, 0x5c, 0x84, 0x9d, 0x84, 0xf4, 0xc3, 0x33, 0xec, 0x44, 0x23, 0x88, 0x51, 0x43, 0xcb, 0x47, 0xbd, 0x71, 0xc5, 0xed, 0xae,
   73         0x9b, 0xe6, 0x9a, 0x2f, 0xfe, 0xce, 0xb1, 0xbe, 0xc9, 0xde, 0x24, 0x4f, 0xbe, 0x15, 0x99, 0x2b, 0x11, 0xb7, 0x7c, 0x04, 0x0f, 0x12, 0xbd, 0x8f, 0x6a, 0x97, 0x5a, 0x44, 0xa0, 0xf9, 0x0c, 0x29,
   74         0xa9, 0xab, 0xc3, 0xd4, 0xd8, 0x93, 0x92, 0x72, 0x84, 0xc5, 0x87, 0x54, 0xcc, 0xe2, 0x94, 0x52, 0x9f, 0x86, 0x14, 0xdc, 0xd2, 0xab, 0xa9, 0x91, 0x92, 0x5f, 0xed, 0xc4, 0xae, 0x74, 0xff, 0xac,
   75         0x6e, 0x33, 0x3b, 0x93, 0xeb, 0x4a, 0xff, 0x04, 0x79, 0xda, 0x9a, 0x41, 0x0e, 0x44, 0x50, 0xe0, 0xdd, 0x7a, 0xe4, 0xc6, 0xe2, 0x91, 0x09, 0x00, 0x57, 0x5d, 0xa4, 0x01, 0xfc, 0x07, 0x05, 0x9f,
   76         0x64, 0x5e, 0x8b, 0x7e, 0x9b, 0xfd, 0xef, 0x33, 0x94, 0x30, 0x54, 0xff, 0x84, 0x01, 0x14, 0x93, 0xc2, 0x7b, 0x34, 0x29, 0xea, 0xed, 0xb4, 0xed, 0x53, 0x76, 0x44, 0x1a, 0x77, 0xed, 0x43, 0x85,
   77         0x1a, 0xd7, 0x7f, 0x16, 0xf5, 0x41, 0xdf, 0xd2, 0x69, 0xd5, 0x0d, 0x6a, 0x5f, 0x14, 0xfb, 0x0a, 0xab, 0x1c, 0xbb, 0x4c, 0x15, 0x50, 0xbe, 0x97, 0xf7, 0xab, 0x40, 0x66, 0x19, 0x3c, 0x4c, 0xaa,
   78         0x77, 0x3d, 0xad, 0x38, 0x01, 0x4b, 0xd2, 0x09, 0x2f, 0xa7, 0x55, 0xc8, 0x24, 0xbb, 0x5e, 0x54, 0xc4, 0xf3, 0x6f, 0xfd, 0xa9, 0xfc, 0xea, 0x70, 0xb9, 0xc6, 0xe6, 0x93, 0xe1, 0x48, 0xc1, 0x51
   79     }
   80 },
   81 {
   82     // IEEE 1619 - Vector 11
   83 
   84     { 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 },
   85     { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
   86     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff },
   87     0,
   88     {
   89         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
   90         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
   91         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
   92         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
   93         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
   94         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
   95         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
   96         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
   97         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
   98         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
   99         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
  100         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
  101         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
  102         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
  103         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
  104         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
  105     },
  106     {
  107         0x77, 0xa3, 0x12, 0x51, 0x61, 0x8a, 0x15, 0xe6, 0xb9, 0x2d, 0x1d, 0x66, 0xdf, 0xfe, 0x7b, 0x50, 0xb5, 0x0b, 0xad, 0x55, 0x23, 0x05, 0xba, 0x02, 0x17, 0xa6, 0x10, 0x68, 0x8e, 0xff, 0x7e, 0x11,
  108         0xe1, 0xd0, 0x22, 0x54, 0x38, 0xe0, 0x93, 0x24, 0x2d, 0x6d, 0xb2, 0x74, 0xfd, 0xe8, 0x01, 0xd4, 0xca, 0xe0, 0x6f, 0x20, 0x92, 0xc7, 0x28, 0xb2, 0x47, 0x85, 0x59, 0xdf, 0x58, 0xe8, 0x37, 0xc2,
  109         0x46, 0x9e, 0xe4, 0xa4, 0xfa, 0x79, 0x4e, 0x4b, 0xbc, 0x7f, 0x39, 0xbc, 0x02, 0x6e, 0x3c, 0xb7, 0x2c, 0x33, 0xb0, 0x88, 0x8f, 0x25, 0xb4, 0xac, 0xf5, 0x6a, 0x2a, 0x98, 0x04, 0xf1, 0xce, 0x6d,
  110         0x3d, 0x6e, 0x1d, 0xc6, 0xca, 0x18, 0x1d, 0x4b, 0x54, 0x61, 0x79, 0xd5, 0x55, 0x44, 0xaa, 0x77, 0x60, 0xc4, 0x0d, 0x06, 0x74, 0x15, 0x39, 0xc7, 0xe3, 0xcd, 0x9d, 0x2f, 0x66, 0x50, 0xb2, 0x01,
  111         0x3f, 0xd0, 0xee, 0xb8, 0xc2, 0xb8, 0xe3, 0xd8, 0xd2, 0x40, 0xcc, 0xae, 0x2d, 0x4c, 0x98, 0x32, 0x0a, 0x74, 0x42, 0xe1, 0xc8, 0xd7, 0x5a, 0x42, 0xd6, 0xe6, 0xcf, 0xa4, 0xc2, 0xec, 0xa1, 0x79,
  112         0x8d, 0x15, 0x8c, 0x7a, 0xec, 0xdf, 0x82, 0x49, 0x0f, 0x24, 0xbb, 0x9b, 0x38, 0xe1, 0x08, 0xbc, 0xda, 0x12, 0xc3, 0xfa, 0xf9, 0xa2, 0x11, 0x41, 0xc3, 0x61, 0x3b, 0x58, 0x36, 0x7f, 0x92, 0x2a,
  113         0xaa, 0x26, 0xcd, 0x22, 0xf2, 0x3d, 0x70, 0x8d, 0xae, 0x69, 0x9a, 0xd7, 0xcb, 0x40, 0xa8, 0xad, 0x0b, 0x6e, 0x27, 0x84, 0x97, 0x3d, 0xcb, 0x60, 0x56, 0x84, 0xc0, 0x8b, 0x8d, 0x69, 0x98, 0xc6,
  114         0x9a, 0xac, 0x04, 0x99, 0x21, 0x87, 0x1e, 0xbb, 0x65, 0x30, 0x1a, 0x46, 0x19, 0xca, 0x80, 0xec, 0xb4, 0x85, 0xa3, 0x1d, 0x74, 0x42, 0x23, 0xce, 0x8d, 0xdc, 0x23, 0x94, 0x82, 0x8d, 0x6a, 0x80,
  115         0x47, 0x0c, 0x09, 0x2f, 0x5b, 0xa4, 0x13, 0xc3, 0x37, 0x8f, 0xa6, 0x05, 0x42, 0x55, 0xc6, 0xf9, 0xdf, 0x44, 0x95, 0x86, 0x2b, 0xbb, 0x32, 0x87, 0x68, 0x1f, 0x93, 0x1b, 0x68, 0x7c, 0x88, 0x8a,
  116         0xbf, 0x84, 0x4d, 0xfc, 0x8f, 0xc2, 0x83, 0x31, 0xe5, 0x79, 0x92, 0x8c, 0xd1, 0x2b, 0xd2, 0x39, 0x0a, 0xe1, 0x23, 0xcf, 0x03, 0x81, 0x8d, 0x14, 0xde, 0xdd, 0xe5, 0xc0, 0xc2, 0x4c, 0x8a, 0xb0,
  117         0x18, 0xbf, 0xca, 0x75, 0xca, 0x09, 0x6f, 0x2d, 0x53, 0x1f, 0x3d, 0x16, 0x19, 0xe7, 0x85, 0xf1, 0xad, 0xa4, 0x37, 0xca, 0xb9, 0x2e, 0x98, 0x05, 0x58, 0xb3, 0xdc, 0xe1, 0x47, 0x4a, 0xfb, 0x75,
  118         0xbf, 0xed, 0xbf, 0x8f, 0xf5, 0x4c, 0xb2, 0x61, 0x8e, 0x02, 0x44, 0xc9, 0xac, 0x0d, 0x3c, 0x66, 0xfb, 0x51, 0x59, 0x8c, 0xd2, 0xdb, 0x11, 0xf9, 0xbe, 0x39, 0x79, 0x1a, 0xbe, 0x44, 0x7c, 0x63,
  119         0x09, 0x4f, 0x7c, 0x45, 0x3b, 0x7f, 0xf8, 0x7c, 0xb5, 0xbb, 0x36, 0xb7, 0xc7, 0x9e, 0xfb, 0x08, 0x72, 0xd1, 0x70, 0x58, 0xb8, 0x3b, 0x15, 0xab, 0x08, 0x66, 0xad, 0x8a, 0x58, 0x65, 0x6c, 0x5a,
  120         0x7e, 0x20, 0xdb, 0xdf, 0x30, 0x8b, 0x24, 0x61, 0xd9, 0x7c, 0x0e, 0xc0, 0x02, 0x4a, 0x27, 0x15, 0x05, 0x52, 0x49, 0xcf, 0x3b, 0x47, 0x8d, 0xdd, 0x47, 0x40, 0xde, 0x65, 0x4f, 0x75, 0xca, 0x68,
  121         0x6e, 0x0d, 0x73, 0x45, 0xc6, 0x9e, 0xd5, 0x0c, 0xdc, 0x2a, 0x8b, 0x33, 0x2b, 0x1f, 0x88, 0x24, 0x10, 0x8a, 0xc9, 0x37, 0xeb, 0x05, 0x05, 0x85, 0x60, 0x8e, 0xe7, 0x34, 0x09, 0x7f, 0xc0, 0x90,
  122         0x54, 0xfb, 0xff, 0x89, 0xee, 0xae, 0xea, 0x79, 0x1f, 0x4a, 0x7a, 0xb1, 0xf9, 0x86, 0x82, 0x94, 0xa4, 0xf9, 0xe2, 0x7b, 0x42, 0xaf, 0x81, 0x00, 0xcb, 0x9d, 0x59, 0xce, 0xf9, 0x64, 0x58, 0x03
  123     }
  124 },
  125 {
  126     // IEEE 1619 - Vector 12
  127 
  128     { 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 },
  129     { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
  130     { 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff },
  131     0,
  132     {
  133         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  134         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
  135         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
  136         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
  137         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
  138         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
  139         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
  140         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
  141         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  142         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
  143         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
  144         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
  145         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
  146         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
  147         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
  148         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
  149     },
  150     {
  151         0xe3, 0x87, 0xaa, 0xa5, 0x8b, 0xa4, 0x83, 0xaf, 0xa7, 0xe8, 0xeb, 0x46, 0x97, 0x78, 0x31, 0x7e, 0xcf, 0x4c, 0xf5, 0x73, 0xaa, 0x9d, 0x4e, 0xac, 0x23, 0xf2, 0xcd, 0xf9, 0x14, 0xe4, 0xe2, 0x00,
  152         0xa8, 0xb4, 0x90, 0xe4, 0x2e, 0xe6, 0x46, 0x80, 0x2d, 0xc6, 0xee, 0x2b, 0x47, 0x1b, 0x27, 0x81, 0x95, 0xd6, 0x09, 0x18, 0xec, 0xec, 0xb4, 0x4b, 0xf7, 0x99, 0x66, 0xf8, 0x3f, 0xab, 0xa0, 0x49,
  153         0x92, 0x98, 0xeb, 0xc6, 0x99, 0xc0, 0xc8, 0x63, 0x47, 0x15, 0xa3, 0x20, 0xbb, 0x4f, 0x07, 0x5d, 0x62, 0x2e, 0x74, 0xc8, 0xc9, 0x32, 0x00, 0x4f, 0x25, 0xb4, 0x1e, 0x36, 0x10, 0x25, 0xb5, 0xa8,
  154         0x78, 0x15, 0x39, 0x1f, 0x61, 0x08, 0xfc, 0x4a, 0xfa, 0x6a, 0x05, 0xd9, 0x30, 0x3c, 0x6b, 0xa6, 0x8a, 0x12, 0x8a, 0x55, 0x70, 0x5d, 0x41, 0x59, 0x85, 0x83, 0x2f, 0xde, 0xaa, 0xe6, 0xc8, 0xe1,
  155         0x91, 0x10, 0xe8, 0x4d, 0x1b, 0x1f, 0x19, 0x9a, 0x26, 0x92, 0x11, 0x9e, 0xdc, 0x96, 0x13, 0x26, 0x58, 0xf0, 0x9d, 0xa7, 0xc6, 0x23, 0xef, 0xce, 0xc7, 0x12, 0x53, 0x7a, 0x3d, 0x94, 0xc0, 0xbf,
  156         0x5d, 0x7e, 0x35, 0x2e, 0xc9, 0x4a, 0xe5, 0x79, 0x7f, 0xdb, 0x37, 0x7d, 0xc1, 0x55, 0x11, 0x50, 0x72, 0x1a, 0xdf, 0x15, 0xbd, 0x26, 0xa8, 0xef, 0xc2, 0xfc, 0xaa, 0xd5, 0x68, 0x81, 0xfa, 0x9e,
  157         0x62, 0x46, 0x2c, 0x28, 0xf3, 0x0a, 0xe1, 0xce, 0xac, 0xa9, 0x3c, 0x34, 0x5c, 0xf2, 0x43, 0xb7, 0x3f, 0x54, 0x2e, 0x20, 0x74, 0xa7, 0x05, 0xbd, 0x26, 0x43, 0xbb, 0x9f, 0x7c, 0xc7, 0x9b, 0xb6,
  158         0xe7, 0x09, 0x1e, 0xa6, 0xe2, 0x32, 0xdf, 0x0f, 0x9a, 0xd0, 0xd6, 0xcf, 0x50, 0x23, 0x27, 0x87, 0x6d, 0x82, 0x20, 0x7a, 0xbf, 0x21, 0x15, 0xcd, 0xac, 0xf6, 0xd5, 0xa4, 0x8f, 0x6c, 0x18, 0x79,
  159         0xa6, 0x5b, 0x11, 0x5f, 0x0f, 0x8b, 0x3c, 0xb3, 0xc5, 0x9d, 0x15, 0xdd, 0x8c, 0x76, 0x9b, 0xc0, 0x14, 0x79, 0x5a, 0x18, 0x37, 0xf3, 0x90, 0x1b, 0x58, 0x45, 0xeb, 0x49, 0x1a, 0xdf, 0xef, 0xe0,
  160         0x97, 0xb1, 0xfa, 0x30, 0xa1, 0x2f, 0xc1, 0xf6, 0x5b, 0xa2, 0x29, 0x05, 0x03, 0x15, 0x39, 0x97, 0x1a, 0x10, 0xf2, 0xf3, 0x6c, 0x32, 0x1b, 0xb5, 0x13, 0x31, 0xcd, 0xef, 0xb3, 0x9e, 0x39, 0x64,
  161         0xc7, 0xef, 0x07, 0x99, 0x94, 0xf5, 0xb6, 0x9b, 0x2e, 0xdd, 0x83, 0xa7, 0x1e, 0xf5, 0x49, 0x97, 0x1e, 0xe9, 0x3f, 0x44, 0xea, 0xc3, 0x93, 0x8f, 0xcd, 0xd6, 0x1d, 0x01, 0xfa, 0x71, 0x79, 0x9d,
  162         0xa3, 0xa8, 0x09, 0x1c, 0x4c, 0x48, 0xaa, 0x9e, 0xd2, 0x63, 0xff, 0x07, 0x49, 0xdf, 0x95, 0xd4, 0x4f, 0xef, 0x6a, 0x0b, 0xb5, 0x78, 0xec, 0x69, 0x45, 0x6a, 0xa5, 0x40, 0x8a, 0xe3, 0x2c, 0x7a,
  163         0xf0, 0x8a, 0xd7, 0xba, 0x89, 0x21, 0x28, 0x7e, 0x3b, 0xbe, 0xe3, 0x1b, 0x76, 0x7b, 0xe0, 0x6a, 0x0e, 0x70, 0x5c, 0x86, 0x4a, 0x76, 0x91, 0x37, 0xdf, 0x28, 0x29, 0x22, 0x83, 0xea, 0x81, 0xa2,
  164         0x48, 0x02, 0x41, 0xb4, 0x4d, 0x99, 0x21, 0xcd, 0xbe, 0xc1, 0xbc, 0x28, 0xdc, 0x1f, 0xda, 0x11, 0x4b, 0xd8, 0xe5, 0x21, 0x7a, 0xc9, 0xd8, 0xeb, 0xaf, 0xa7, 0x20, 0xe9, 0xda, 0x4f, 0x9a, 0xce,
  165         0x23, 0x1c, 0xc9, 0x49, 0xe5, 0xb9, 0x6f, 0xe7, 0x6f, 0xfc, 0x21, 0x06, 0x3f, 0xdd, 0xc8, 0x3a, 0x6b, 0x86, 0x79, 0xc0, 0x0d, 0x35, 0xe0, 0x95, 0x76, 0xa8, 0x75, 0x30, 0x5b, 0xed, 0x5f, 0x36,
  166         0xed, 0x24, 0x2c, 0x89, 0x00, 0xdd, 0x1f, 0xa9, 0x65, 0xbc, 0x95, 0x0d, 0xfc, 0xe0, 0x9b, 0x13, 0x22, 0x63, 0xa1, 0xee, 0xf5, 0x2d, 0xd6, 0x88, 0x8c, 0x30, 0x9f, 0x5a, 0x7d, 0x71, 0x28, 0x26
  167     }
  168 },
  169 {
  170     // IEEE 1619 - Vector 13
  171 
  172     { 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 },
  173     { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
  174     { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
  175     0,
  176     {
  177         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  178         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
  179         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
  180         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
  181         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
  182         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
  183         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
  184         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
  185         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  186         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
  187         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
  188         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
  189         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
  190         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
  191         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
  192         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
  193     },
  194     {
  195         0xbf, 0x53, 0xd2, 0xda, 0xde, 0x78, 0xe8, 0x22, 0xa4, 0xd9, 0x49, 0xa9, 0xbc, 0x67, 0x66, 0xb0, 0x1b, 0x06, 0xa8, 0xef, 0x70, 0xd2, 0x67, 0x48, 0xc6, 0xa7, 0xfc, 0x36, 0xd8, 0x0a, 0xe4, 0xc5,
  196         0x52, 0x0f, 0x7c, 0x4a, 0xb0, 0xac, 0x85, 0x44, 0x42, 0x4f, 0xa4, 0x05, 0x16, 0x2f, 0xef, 0x5a, 0x6b, 0x7f, 0x22, 0x94, 0x98, 0x06, 0x36, 0x18, 0xd3, 0x9f, 0x00, 0x03, 0xcb, 0x5f, 0xb8, 0xd1,
  197         0xc8, 0x6b, 0x64, 0x34, 0x97, 0xda, 0x1f, 0xf9, 0x45, 0xc8, 0xd3, 0xbe, 0xde, 0xca, 0x4f, 0x47, 0x97, 0x02, 0xa7, 0xa7, 0x35, 0xf0, 0x43, 0xdd, 0xb1, 0xd6, 0xaa, 0xad, 0xe3, 0xc4, 0xa0, 0xac,
  198         0x7c, 0xa7, 0xf3, 0xfa, 0x52, 0x79, 0xbe, 0xf5, 0x6f, 0x82, 0xcd, 0x7a, 0x2f, 0x38, 0x67, 0x2e, 0x82, 0x48, 0x14, 0xe1, 0x07, 0x00, 0x30, 0x0a, 0x05, 0x5e, 0x16, 0x30, 0xb8, 0xf1, 0xcb, 0x0e,
  199         0x91, 0x9f, 0x5e, 0x94, 0x20, 0x10, 0xa4, 0x16, 0xe2, 0xbf, 0x48, 0xcb, 0x46, 0x99, 0x3d, 0x3c, 0xb6, 0xa5, 0x1c, 0x19, 0xba, 0xcf, 0x86, 0x47, 0x85, 0xa0, 0x0b, 0xc2, 0xec, 0xff, 0x15, 0xd3,
  200         0x50, 0x87, 0x5b, 0x24, 0x6e, 0xd5, 0x3e, 0x68, 0xbe, 0x6f, 0x55, 0xbd, 0x7e, 0x05, 0xcf, 0xc2, 0xb2, 0xed, 0x64, 0x32, 0x19, 0x8a, 0x64, 0x44, 0xb6, 0xd8, 0xc2, 0x47, 0xfa, 0xb9, 0x41, 0xf5,
  201         0x69, 0x76, 0x8b, 0x5c, 0x42, 0x93, 0x66, 0xf1, 0xd3, 0xf0, 0x0f, 0x03, 0x45, 0xb9, 0x61, 0x23, 0xd5, 0x62, 0x04, 0xc0, 0x1c, 0x63, 0xb2, 0x2c, 0xe7, 0x8b, 0xaf, 0x11, 0x6e, 0x52, 0x5e, 0xd9,
  202         0x0f, 0xde, 0xa3, 0x9f, 0xa4, 0x69, 0x49, 0x4d, 0x38, 0x66, 0xc3, 0x1e, 0x05, 0xf2, 0x95, 0xff, 0x21, 0xfe, 0xa8, 0xd4, 0xe6, 0xe1, 0x3d, 0x67, 0xe4, 0x7c, 0xe7, 0x22, 0xe9, 0x69, 0x8a, 0x1c,
  203         0x10, 0x48, 0xd6, 0x8e, 0xbc, 0xde, 0x76, 0xb8, 0x6f, 0xcf, 0x97, 0x6e, 0xab, 0x8a, 0xa9, 0x79, 0x02, 0x68, 0xb7, 0x06, 0x8e, 0x01, 0x7a, 0x8b, 0x9b, 0x74, 0x94, 0x09, 0x51, 0x4f, 0x10, 0x53,
  204         0x02, 0x7f, 0xd1, 0x6c, 0x37, 0x86, 0xea, 0x1b, 0xac, 0x5f, 0x15, 0xcb, 0x79, 0x71, 0x1e, 0xe2, 0xab, 0xe8, 0x2f, 0x5c, 0xf8, 0xb1, 0x3a, 0xe7, 0x30, 0x30, 0xef, 0x5b, 0x9e, 0x44, 0x57, 0xe7,
  205         0x5d, 0x13, 0x04, 0xf9, 0x88, 0xd6, 0x2d, 0xd6, 0xfc, 0x4b, 0x94, 0xed, 0x38, 0xba, 0x83, 0x1d, 0xa4, 0xb7, 0x63, 0x49, 0x71, 0xb6, 0xcd, 0x8e, 0xc3, 0x25, 0xd9, 0xc6, 0x1c, 0x00, 0xf1, 0xdf,
  206         0x73, 0x62, 0x7e, 0xd3, 0x74, 0x5a, 0x5e, 0x84, 0x89, 0xf3, 0xa9, 0x5c, 0x69, 0x63, 0x9c, 0x32, 0xcd, 0x6e, 0x1d, 0x53, 0x7a, 0x85, 0xf7, 0x5c, 0xc8, 0x44, 0x72, 0x6e, 0x8a, 0x72, 0xfc, 0x00,
  207         0x77, 0xad, 0x22, 0x00, 0x0f, 0x1d, 0x50, 0x78, 0xf6, 0xb8, 0x66, 0x31, 0x8c, 0x66, 0x8f, 0x1a, 0xd0, 0x3d, 0x5a, 0x5f, 0xce, 0xd5, 0x21, 0x9f, 0x2e, 0xab, 0xbd, 0x0a, 0xa5, 0xc0, 0xf4, 0x60,
  208         0xd1, 0x83, 0xf0, 0x44, 0x04, 0xa0, 0xd6, 0xf4, 0x69, 0x55, 0x8e, 0x81, 0xfa, 0xb2, 0x4a, 0x16, 0x79, 0x05, 0xab, 0x4c, 0x78, 0x78, 0x50, 0x2a, 0xd3, 0xe3, 0x8f, 0xdb, 0xe6, 0x2a, 0x41, 0x55,
  209         0x6c, 0xec, 0x37, 0x32, 0x57, 0x59, 0x53, 0x3c, 0xe8, 0xf2, 0x5f, 0x36, 0x7c, 0x87, 0xbb, 0x55, 0x78, 0xd6, 0x67, 0xae, 0x93, 0xf9, 0xe2, 0xfd, 0x99, 0xbc, 0xbc, 0x5f, 0x2f, 0xbb, 0xa8, 0x8c,
  210         0xf6, 0x51, 0x61, 0x39, 0x42, 0x0f, 0xcf, 0xf3, 0xb7, 0x36, 0x1d, 0x86, 0x32, 0x2c, 0x4b, 0xd8, 0x4c, 0x82, 0xf3, 0x35, 0xab, 0xb1, 0x52, 0xc4, 0xa9, 0x34, 0x11, 0x37, 0x3a, 0xaa, 0x82, 0x20
  211     }
  212 },
  213 {
  214     // IEEE 1619 - Vector 14
  215 
  216     /* This vector must always be the last one in XTS_vectors[] because TestSectorBufEncryption() relies on it. */
  217 
  218     { 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 },
  219     { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
  220     { 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff },
  221     0,
  222     {
  223         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  224         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
  225         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
  226         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
  227         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
  228         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
  229         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
  230         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
  231         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  232         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
  233         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
  234         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
  235         0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
  236         0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
  237         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
  238         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
  239     },
  240     {
  241         0x64, 0x49, 0x7e, 0x5a, 0x83, 0x1e, 0x4a, 0x93, 0x2c, 0x09, 0xbe, 0x3e, 0x53, 0x93, 0x37, 0x6d, 0xaa, 0x59, 0x95, 0x48, 0xb8, 0x16, 0x03, 0x1d, 0x22, 0x4b, 0xbf, 0x50, 0xa8, 0x18, 0xed, 0x23,
  242         0x50, 0xea, 0xe7, 0xe9, 0x60, 0x87, 0xc8, 0xa0, 0xdb, 0x51, 0xad, 0x29, 0x0b, 0xd0, 0x0c, 0x1a, 0xc1, 0x62, 0x08, 0x57, 0x63, 0x5b, 0xf2, 0x46, 0xc1, 0x76, 0xab, 0x46, 0x3b, 0xe3, 0x0b, 0x80,
  243         0x8d, 0xa5, 0x48, 0x08, 0x1a, 0xc8, 0x47, 0xb1, 0x58, 0xe1, 0x26, 0x4b, 0xe2, 0x5b, 0xb0, 0x91, 0x0b, 0xbc, 0x92, 0x64, 0x71, 0x08, 0x08, 0x94, 0x15, 0xd4, 0x5f, 0xab, 0x1b, 0x3d, 0x26, 0x04,
  244         0xe8, 0xa8, 0xef, 0xf1, 0xae, 0x40, 0x20, 0xcf, 0xa3, 0x99, 0x36, 0xb6, 0x68, 0x27, 0xb2, 0x3f, 0x37, 0x1b, 0x92, 0x20, 0x0b, 0xe9, 0x02, 0x51, 0xe6, 0xd7, 0x3c, 0x5f, 0x86, 0xde, 0x5f, 0xd4,
  245         0xa9, 0x50, 0x78, 0x19, 0x33, 0xd7, 0x9a, 0x28, 0x27, 0x2b, 0x78, 0x2a, 0x2e, 0xc3, 0x13, 0xef, 0xdf, 0xcc, 0x06, 0x28, 0xf4, 0x3d, 0x74, 0x4c, 0x2d, 0xc2, 0xff, 0x3d, 0xcb, 0x66, 0x99, 0x9b,
  246         0x50, 0xc7, 0xca, 0x89, 0x5b, 0x0c, 0x64, 0x79, 0x1e, 0xea, 0xa5, 0xf2, 0x94, 0x99, 0xfb, 0x1c, 0x02, 0x6f, 0x84, 0xce, 0x5b, 0x5c, 0x72, 0xba, 0x10, 0x83, 0xcd, 0xdb, 0x5c, 0xe4, 0x54, 0x34,
  247         0x63, 0x16, 0x65, 0xc3, 0x33, 0xb6, 0x0b, 0x11, 0x59, 0x3f, 0xb2, 0x53, 0xc5, 0x17, 0x9a, 0x2c, 0x8d, 0xb8, 0x13, 0x78, 0x2a, 0x00, 0x48, 0x56, 0xa1, 0x65, 0x30, 0x11, 0xe9, 0x3f, 0xb6, 0xd8,
  248         0x76, 0xc1, 0x83, 0x66, 0xdd, 0x86, 0x83, 0xf5, 0x34, 0x12, 0xc0, 0xc1, 0x80, 0xf9, 0xc8, 0x48, 0x59, 0x2d, 0x59, 0x3f, 0x86, 0x09, 0xca, 0x73, 0x63, 0x17, 0xd3, 0x56, 0xe1, 0x3e, 0x2b, 0xff,
  249         0x3a, 0x9f, 0x59, 0xcd, 0x9a, 0xeb, 0x19, 0xcd, 0x48, 0x25, 0x93, 0xd8, 0xc4, 0x61, 0x28, 0xbb, 0x32, 0x42, 0x3b, 0x37, 0xa9, 0xad, 0xfb, 0x48, 0x2b, 0x99, 0x45, 0x3f, 0xbe, 0x25, 0xa4, 0x1b,
  250         0xf6, 0xfe, 0xb4, 0xaa, 0x0b, 0xef, 0x5e, 0xd2, 0x4b, 0xf7, 0x3c, 0x76, 0x29, 0x78, 0x02, 0x54, 0x82, 0xc1, 0x31, 0x15, 0xe4, 0x01, 0x5a, 0xac, 0x99, 0x2e, 0x56, 0x13, 0xa3, 0xb5, 0xc2, 0xf6,
  251         0x85, 0xb8, 0x47, 0x95, 0xcb, 0x6e, 0x9b, 0x26, 0x56, 0xd8, 0xc8, 0x81, 0x57, 0xe5, 0x2c, 0x42, 0xf9, 0x78, 0xd8, 0x63, 0x4c, 0x43, 0xd0, 0x6f, 0xea, 0x92, 0x8f, 0x28, 0x22, 0xe4, 0x65, 0xaa,
  252         0x65, 0x76, 0xe9, 0xbf, 0x41, 0x93, 0x84, 0x50, 0x6c, 0xc3, 0xce, 0x3c, 0x54, 0xac, 0x1a, 0x6f, 0x67, 0xdc, 0x66, 0xf3, 0xb3, 0x01, 0x91, 0xe6, 0x98, 0x38, 0x0b, 0xc9, 0x99, 0xb0, 0x5a, 0xbc,
  253         0xe1, 0x9d, 0xc0, 0xc6, 0xdc, 0xc2, 0xdd, 0x00, 0x1e, 0xc5, 0x35, 0xba, 0x18, 0xde, 0xb2, 0xdf, 0x1a, 0x10, 0x10, 0x23, 0x10, 0x83, 0x18, 0xc7, 0x5d, 0xc9, 0x86, 0x11, 0xa0, 0x9d, 0xc4, 0x8a,
  254         0x0a, 0xcd, 0xec, 0x67, 0x6f, 0xab, 0xdf, 0x22, 0x2f, 0x07, 0xe0, 0x26, 0xf0, 0x59, 0xb6, 0x72, 0xb5, 0x6e, 0x5c, 0xbc, 0x8e, 0x1d, 0x21, 0xbb, 0xd8, 0x67, 0xdd, 0x92, 0x72, 0x12, 0x05, 0x46,
  255         0x81, 0xd7, 0x0e, 0xa7, 0x37, 0x13, 0x4c, 0xdf, 0xce, 0x93, 0xb6, 0xf8, 0x2a, 0xe2, 0x24, 0x23, 0x27, 0x4e, 0x58, 0xa0, 0x82, 0x1c, 0xc5, 0x50, 0x2e, 0x2d, 0x0a, 0xb4, 0x58, 0x5e, 0x94, 0xde,
  256         0x69, 0x75, 0xbe, 0x5e, 0x0b, 0x4e, 0xfc, 0xe5, 0x1c, 0xd3, 0xe7, 0x0c, 0x25, 0xa1, 0xfb, 0xbb, 0xd6, 0x09, 0xd2, 0x73, 0xad, 0x5b, 0x0d, 0x59, 0x63, 0x1c, 0x53, 0x1f, 0x6a, 0x0a, 0x57, 0xb9
  257     }
  258 } };    // XTS_TEST XTS_vectors[]
  259 
  260 
  261 BOOL XTSAesTest (PCRYPTO_INFO ci)
  262 {
  263     unsigned __int8 p[ENCRYPTION_DATA_UNIT_SIZE];
  264     UINT64_STRUCT dataUnitNo;
  265     int i;
  266 
  267     for (i = 0; i < XTS_TEST_COUNT; i++)
  268     {
  269         ci->ea = EAGetByName (L"AES");
  270         if (ci->ea == 0)
  271             return FALSE;
  272 
  273         ci->mode = XTS;
  274 
  275         if (EAInit (ci->ea, XTS_vectors[i].key1, ci->ks) != ERR_SUCCESS)
  276             return FALSE;
  277 
  278         memcpy (&ci->k2, XTS_vectors[i].key2, sizeof (XTS_vectors[i].key2));
  279 
  280         if (!EAInitMode (ci))
  281             return FALSE;
  282 
  283         memcpy (p, XTS_vectors[i].plaintext, sizeof (p));
  284 
  285         dataUnitNo.Value = BE64 (*((unsigned __int64 *) XTS_vectors[i].dataUnitNo));
  286 
  287         EncryptBufferXTS (p, sizeof (p), &dataUnitNo, XTS_vectors[i].blockNo, (unsigned char *) (ci->ks), (unsigned char *) ci->ks2, AES);
  288 
  289         if (memcmp (XTS_vectors[i].ciphertext, p, sizeof (p)) != 0)
  290             return FALSE;
  291     }
  292 
  293     return TRUE;
  294 }
  295 
  296 
  297 // AES ECB test vectors FIPS-197
  298 
  299 #define AES_TEST_COUNT 1
  300 
  301 typedef struct {
  302     unsigned char key[32];
  303     unsigned char plaintext[16];
  304     unsigned char ciphertext[16];
  305     } AES_TEST;
  306 
  307 AES_TEST aes_ecb_vectors[AES_TEST_COUNT] = {
  308 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
  309 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
  310 
  311 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff,
  312 
  313 0x8e,0xa2,0xb7,0xca,0x51,0x67,0x45,0xbf,0xea,0xfc,0x49,0x90,0x4b,0x49,0x60,0x89
  314 };
  315 
  316 // Serpent ECB test vectors
  317 
  318 #define SERPENT_TEST_COUNT 1
  319 
  320 typedef struct {
  321     unsigned char key[32];
  322     unsigned char plaintext[16];
  323     unsigned char ciphertext[16];
  324     } SERPENT_TEST;
  325 
  326 SERPENT_TEST serpent_vectors[SERPENT_TEST_COUNT] = {
  327 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  328 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  329 
  330 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  331 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8, 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c
  332 };
  333 
  334 // Twofish ECB test vectors
  335 
  336 #define TWOFISH_TEST_COUNT 1
  337 
  338 typedef struct {
  339     unsigned char key[32];
  340     unsigned char plaintext[16];
  341     unsigned char ciphertext[16];
  342     } TWOFISH_TEST;
  343 
  344 TWOFISH_TEST twofish_vectors[TWOFISH_TEST_COUNT] = {
  345 0xD4, 0x3B, 0xB7, 0x55, 0x6E, 0xA3, 0x2E, 0x46, 0xF2, 0xA2, 0x82, 0xB7, 0xD4, 0x5B, 0x4E, 0x0D,
  346 0x57, 0xFF, 0x73, 0x9D, 0x4D, 0xC9, 0x2C, 0x1B, 0xD7, 0xFC, 0x01, 0x70, 0x0C, 0xC8, 0x21, 0x6F,
  347 
  348 0x90, 0xAF, 0xE9, 0x1B, 0xB2, 0x88, 0x54, 0x4F, 0x2C, 0x32, 0xDC, 0x23, 0x9B, 0x26, 0x35, 0xE6,
  349 0x6C, 0xB4, 0x56, 0x1C, 0x40, 0xBF, 0x0A, 0x97, 0x05, 0x93, 0x1C, 0xB6, 0xD4, 0x08, 0xE7, 0xFA
  350 };
  351 
  352 // Camellia ECB test vectors
  353 #define CAMELLIA_TEST_COUNT 2
  354 
  355 typedef struct {
  356     unsigned char key[32];
  357     unsigned char plaintext[16];
  358     unsigned char ciphertext[16];
  359     } CAMELLIA_TEST;
  360 
  361 CAMELLIA_TEST camellia_vectors[CAMELLIA_TEST_COUNT] = {
  362 {
  363     0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0xFE, 0xDC, 0xBA, 0x98,
  364     0x76, 0x54, 0x32, 0x10, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
  365     0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x01, 0x23, 0x45, 0x67,
  366     0x89, 0xAB, 0xCD, 0xEF, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
  367     0x9A, 0xCC, 0x23, 0x7D, 0xFF, 0x16, 0xD7, 0x6C, 0x20, 0xEF, 0x7C, 0x91,
  368     0x9E, 0x3A, 0x75, 0x09
  369 },
  370 {
  371     0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00, 0x95, 0x2C, 0x49, 0x10,
  372     0x48, 0x81, 0xFF, 0x48, 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00,
  373     0x95, 0x2C, 0x49, 0x10, 0x48, 0x81, 0xFF, 0x48, 0xE6, 0x84, 0x42, 0x17,
  374     0x16, 0xFC, 0x0B, 0x01, 0xAE, 0xB5, 0xC6, 0x76, 0x51, 0x20, 0xF9, 0x5F,
  375     0xEA, 0x02, 0x47, 0x14, 0xAD, 0x5C, 0x4D, 0x84, 0xEA, 0x02, 0x47, 0x14,
  376     0xAD, 0x5C, 0x4D, 0x84
  377 }
  378 };
  379 #if defined(CIPHER_GOST89)
  380 // GOST89 ECB test vectors
  381 #define GOST89_TEST_COUNT 1
  382 
  383 typedef struct {
  384     unsigned char key[32];
  385     unsigned char plaintext[16];
  386     unsigned char ciphertext[16];
  387     } GOST89_TEST;
  388 
  389 GOST89_TEST gost89_vectors[GOST89_TEST_COUNT] = {
  390 {
  391     0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44,
  392     0x33, 0x22, 0x11, 0x00, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
  393     0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0xFE, 0xDC, 0xBA, 0x98, 
  394     0x76, 0x54, 0x32, 0x10, 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88,
  395     0x8F, 0xC6, 0xFE, 0xB8, 0x91, 0x51, 0x4C, 0x37, 0x4D, 0x51, 0x46, 0xEF,
  396     0x02, 0x9D, 0xBD, 0x9F
  397 }
  398 };
  399 #endif
  400 
  401 // Kuznyechik ECB test vectors
  402 #define KUZNYECHIK_TEST_COUNT 4
  403 
  404 typedef struct {
  405     unsigned char key[32];
  406     unsigned char plaintext[16];
  407     unsigned char ciphertext[16];
  408     } KUZNYECHIK_TEST;
  409 
  410 KUZNYECHIK_TEST kuznyechik_vectors[KUZNYECHIK_TEST_COUNT] = {
  411 {
  412     0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33,
  413     0x44, 0x55, 0x66, 0x77, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
  414     0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x11, 0x22, 0x33, 0x44, 
  415     0x55, 0x66, 0x77, 0x00, 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88,
  416     0x7F, 0x67, 0x9D, 0x90, 0xBE, 0xBC, 0x24, 0x30, 0x5A, 0x46, 0x8D, 0x42,
  417     0xB9, 0xD4, 0xED, 0xCD
  418 },
  419 {
  420     0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33,
  421     0x44, 0x55, 0x66, 0x77, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
  422     0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x00, 0x11, 0x22, 0x33, 
  423     0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xEE, 0xFF, 0x0A, 
  424     0xB4, 0x29, 0x91, 0x2C, 0x6E, 0x00, 0x32, 0xF9, 0x28, 0x54, 0x52, 0xD7, 
  425     0x67, 0x18, 0xD0, 0x8B
  426 },
  427 {
  428     0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33,
  429     0x44, 0x55, 0x66, 0x77, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
  430     0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x11, 0x22, 0x33, 0x44, 
  431     0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xEE, 0xFF, 0x0A, 0x00, 
  432     0xF0, 0xCA, 0x33, 0x54, 0x9D, 0x24, 0x7C, 0xEE, 0xF3, 0xF5, 0xA5, 0x31, 
  433     0x3B, 0xD4, 0xB1, 0x57
  434 },
  435 {
  436     0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33,
  437     0x44, 0x55, 0x66, 0x77, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
  438     0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x22, 0x33, 0x44, 0x55, 
  439     0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xEE, 0xFF, 0x0A, 0x00, 0x11, 
  440     0xD0, 0xB0, 0x9C, 0xCD, 0xE8, 0x30, 0xB9, 0xEB, 0x3A, 0x02, 0xC4, 0xC5, 
  441     0xAA, 0x8A, 0xDA, 0x98
  442 }
  443 };
  444 
  445 
  446 /* Test vectors from FIPS 198a, RFC 4231, RFC 2104, RFC 2202, and other sources. */
  447 
  448 char *hmac_sha256_test_keys[] =
  449 {
  450     "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
  451     "Jefe",
  452     "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
  453     "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
  454     "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
  455     "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
  456 };
  457 
  458 char *hmac_sha256_test_data[] =
  459 {
  460     "Hi There",
  461     "what do ya want for nothing?",
  462     "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
  463     "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
  464     "Test Using Larger Than Block-Size Key - Hash Key First",
  465     "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
  466 };
  467 
  468 char *hmac_sha256_test_vectors[] =
  469 {
  470     "\xb0\x34\x4c\x61\xd8\xdb\x38\x53\x5c\xa8\xaf\xce\xaf\x0b\xf1\x2b\x88\x1d\xc2\x00\xc9\x83\x3d\xa7\x26\xe9\x37\x6c\x2e\x32\xcf\xf7",
  471     "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e\x6a\x04\x24\x26\x08\x95\x75\xc7\x5a\x00\x3f\x08\x9d\x27\x39\x83\x9d\xec\x58\xb9\x64\xec\x38\x43",
  472     "\x77\x3e\xa9\x1e\x36\x80\x0e\x46\x85\x4d\xb8\xeb\xd0\x91\x81\xa7\x29\x59\x09\x8b\x3e\xf8\xc1\x22\xd9\x63\x55\x14\xce\xd5\x65\xfe",
  473     "\x82\x55\x8a\x38\x9a\x44\x3c\x0e\xa4\xcc\x81\x98\x99\xf2\x08\x3a\x85\xf0\xfa\xa3\xe5\x78\xf8\x07\x7a\x2e\x3f\xf4\x67\x29\x66\x5b",
  474     "\x60\xe4\x31\x59\x1e\xe0\xb6\x7f\x0d\x8a\x26\xaa\xcb\xf5\xb7\x7f\x8e\x0b\xc6\x21\x37\x28\xc5\x14\x05\x46\x04\x0f\x0e\xe3\x7f\x54",
  475     "\x9b\x09\xff\xa7\x1b\x94\x2f\xcb\x27\x63\x5f\xbc\xd5\xb0\xe9\x44\xbf\xdc\x63\x64\x4f\x07\x13\x93\x8a\x7f\x51\x53\x5c\x3a\x35\xe2",
  476 };
  477 
  478 char *hmac_sha512_test_keys[] =
  479 {
  480     "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
  481     "Jefe",
  482     "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
  483     "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
  484     "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
  485     "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
  486 };
  487 
  488 char *hmac_sha512_test_data[] =
  489 {
  490     "Hi There",
  491     "what do ya want for nothing?",
  492     "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
  493     "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
  494     "Test Using Larger Than Block-Size Key - Hash Key First",
  495     "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
  496 };
  497 
  498 char *hmac_sha512_test_vectors[] =
  499 {
  500     "\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a\x1d\x6c\xb0\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0\xb3\x05\x45\xe1\x7c\xde\xda\xa8\x33\xb7\xd6\xb8\xa7\x02\x03\x8b\x27\x4e\xae\xa3\xf4\xe4\xbe\x9d\x91\x4e\xeb\x61\xf1\x70\x2e\x69\x6c\x20\x3a\x12\x68\x54",
  501     "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b\x56\xe0\xa3\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27\x0c\xd7\xea\x25\x05\x54\x97\x58\xbf\x75\xc0\x5a\x99\x4a\x6d\x03\x4f\x65\xf8\xf0\xe6\xfd\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a\x38\xbc\xe7\x37",
  502     "\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c\x89\x0b\xe9\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8\x3e\x33\xb2\x27\x9d\x39\xbf\x3e\x84\x82\x79\xa7\x22\xc8\x06\xb4\x85\xa4\x7e\x67\xc8\x07\xb9\x46\xa3\x37\xbe\xe8\x94\x26\x74\x27\x88\x59\xe1\x32\x92\xfb",
  503     "\xb0\xba\x46\x56\x37\x45\x8c\x69\x90\xe5\xa8\xc5\xf6\x1d\x4a\xf7\xe5\x76\xd9\x7f\xf9\x4b\x87\x2d\xe7\x6f\x80\x50\x36\x1e\xe3\xdb\xa9\x1c\xa5\xc1\x1a\xa2\x5e\xb4\xd6\x79\x27\x5c\xc5\x78\x80\x63\xa5\xf1\x97\x41\x12\x0c\x4f\x2d\xe2\xad\xeb\xeb\x10\xa2\x98\xdd",
  504     "\x80\xb2\x42\x63\xc7\xc1\xa3\xeb\xb7\x14\x93\xc1\xdd\x7b\xe8\xb4\x9b\x46\xd1\xf4\x1b\x4a\xee\xc1\x12\x1b\x01\x37\x83\xf8\xf3\x52\x6b\x56\xd0\x37\xe0\x5f\x25\x98\xbd\x0f\xd2\x21\x5d\x6a\x1e\x52\x95\xe6\x4f\x73\xf6\x3f\x0a\xec\x8b\x91\x5a\x98\x5d\x78\x65\x98",
  505     "\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba\xa4\xdf\xa9\xf9\x6e\x5e\x3f\xfd\xde\xbd\x71\xf8\x86\x72\x89\x86\x5d\xf5\xa3\x2d\x20\xcd\xc9\x44\xb6\x02\x2c\xac\x3c\x49\x82\xb1\x0d\x5e\xeb\x55\xc3\xe4\xde\x15\x13\x46\x76\xfb\x6d\xe0\x44\x60\x65\xc9\x74\x40\xfa\x8c\x6a\x58",
  506 };
  507 
  508 char *hmac_ripemd160_test_keys[] =
  509 {
  510     "\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff\x01\x23\x45\x67",
  511     "\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10\x00\x11\x22\x33",
  512 };
  513 
  514 char *hmac_ripemd160_test_data[] =
  515 {
  516     "message digest",
  517     "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
  518 };
  519 
  520 char *hmac_ripemd160_test_vectors[] =
  521 {
  522     "\xf8\x36\x62\xcc\x8d\x33\x9c\x22\x7e\x60\x0f\xcd\x63\x6c\x57\xd2\x57\x1b\x1c\x34",
  523     "\x85\xf1\x64\x70\x3e\x61\xa6\x31\x31\xbe\x7e\x45\x95\x8e\x07\x94\x12\x39\x04\xf9",
  524 };
  525 
  526 char *hmac_whirlpool_test_key =
  527 {
  528     "\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF"
  529 };
  530 
  531 char *hmac_whirlpool_test_data =
  532 {
  533     "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
  534 };
  535 
  536 char *hmac_whirlpool_test_vectors =
  537 {
  538     "\x03\x91\xd2\x80\x00\xb6\x62\xbb\xb8\xe6\x23\x3e\xe8\x6c\xf2\xb2\x84\x74\x4c\x73"
  539     "\x8b\x58\x00\xba\x28\x12\xed\x52\x6f\xe3\x15\x3a\xb1\xba\xe7\xe2\x36\xbe\x96\x54"
  540     "\x49\x3f\x19\xfa\xce\xa6\x44\x1f\x60\xf5\xf0\x18\x93\x09\x11\xa5\xe5\xce\xd8\xf2"
  541     "\x6a\xbf\xa4\x02"
  542 };
  543 
  544 typedef struct _HashTestVector
  545 {
  546     const char* hexInput;
  547     const char* hexOutput;
  548 
  549 } HashTestVector;
  550 
  551 typedef int (__cdecl HashFunction) (unsigned char* input, unsigned long inputLen, unsigned char* output);
  552 
  553 unsigned char HexCharToByte (char c)
  554 {
  555    if (c >= ('0') && c <= ('9'))
  556       return c - ('0');
  557    else if (c >= ('A') && c <= ('F'))
  558       return c - ('A') + 10;
  559    else if (c >= ('a') && c <= ('f'))
  560       return c - ('a') + 10;
  561    else
  562       return 0xFF;
  563 }
  564 
  565 unsigned long HexStringToByteArray(const char* hexStr, unsigned char* pbData)
  566 {
  567     unsigned long count = 0;
  568     while (*hexStr)
  569     {
  570         *pbData++ = (HexCharToByte(hexStr[0]) << 4) | HexCharToByte(hexStr[1]);
  571         hexStr += 2;
  572         count++;
  573     }
  574     return count;
  575 }
  576 
  577 BOOL RunHashTest (HashFunction fn, HashTestVector* vector, BOOL bUseSSE)
  578 {
  579     CRYPTOPP_ALIGN_DATA (16) unsigned char input[256];
  580     unsigned char output[64];
  581     unsigned char digest[64];
  582     unsigned long i = 0, inputLen, outputLen, digestLen;
  583     BOOL bRet = TRUE;
  584 #if defined (DEVICE_DRIVER) && !defined (_WIN64)
  585     KFLOATING_SAVE floatingPointState;
  586     NTSTATUS saveStatus = STATUS_INVALID_PARAMETER;
  587     if (bUseSSE)
  588         saveStatus = KeSaveFloatingPointState (&floatingPointState);
  589 #endif
  590     while (vector[i].hexInput && vector[i].hexOutput)
  591     {
  592         inputLen = HexStringToByteArray (vector[i].hexInput, input);
  593         outputLen = HexStringToByteArray (vector[i].hexOutput, output);
  594         digestLen = fn (input, inputLen, digest);
  595         if ((digestLen != outputLen) || (0 != memcmp (digest, output, digestLen)))
  596         {
  597             bRet = FALSE;
  598             break;
  599         }
  600         i++;
  601     }
  602 
  603 #if defined (DEVICE_DRIVER) && !defined (_WIN64)
  604     if (NT_SUCCESS (saveStatus))
  605         KeRestoreFloatingPointState (&floatingPointState);
  606 #endif
  607 
  608     return bRet;
  609 }
  610 
  611 
  612 /* https://www.streebog.net/src/trunk/examples/ */
  613 HashTestVector Streebog512TestVectors[] = {
  614     /* M1 */
  615     {"303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132", 
  616      "1b54d01a4af5b9d5cc3d86d68d285462b19abc2475222f35c085122be4ba1ffa00ad30f8767b3a82384c6574f024c311e2a481332b08ef7f41797891c1646f48"
  617     },
  618     /* M2 */
  619     {"d1e520e2e5f2f0e82c20d1f2f0e8e1eee6e820e2edf3f6e82c20e2e5fef2fa20f120eceef0ff20f1f2f0e5ebe0ece820ede020f5f0e0e1f0fbff20efebfaeafb20c8e3eef0e5e2fb",
  620     "1e88e62226bfca6f9994f1f2d51569e0daf8475a3b0fe61a5300eee46d961376035fe83549ada2b8620fcd7c496ce5b33f0cb9dddc2b6460143b03dabac9fb28"
  621     },
  622     /* M3 */
  623     {"",
  624     "8e945da209aa869f0455928529bcae4679e9873ab707b55315f56ceb98bef0a7362f715528356ee83cda5f2aac4c6ad2ba3a715c1bcd81cb8e9f90bf4c1c1a8a"
  625     },
  626     /* M4 */
  627     {"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  628     "b0fd29ac1b0df441769ff3fdb8dc564df67721d6ac06fb28ceffb7bbaa7948c6c014ac999235b58cb26fb60fb112a145d7b4ade9ae566bf2611402c552d20db7"
  629     },
  630     {NULL, NULL}
  631 };
  632 
  633 unsigned char ks_tmp[MAX_EXPANDED_KEY];
  634 
  635 void CipherInit2(int cipher, void* key, void* ks, int key_len)
  636 {
  637     switch (cipher)
  638     {
  639 
  640     case AES:
  641         CipherInit(cipher,key,ks);
  642         break;
  643 
  644     case SERPENT:
  645         CipherInit(cipher,key,ks);
  646         break;
  647 
  648     case TWOFISH:
  649         CipherInit(cipher,key,ks);
  650         break;
  651         
  652     case CAMELLIA:
  653         CipherInit(cipher,key,ks);
  654         break;
  655 #if defined(CIPHER_GOST89)
  656     case GOST89:
  657         CipherInit(cipher,key,ks);
  658         break;
  659 #endif // defined(CIPHER_GOST89)
  660     case KUZNYECHIK:
  661         CipherInit(cipher, key, ks);
  662         break;
  663     default:
  664         /* Unknown/wrong ID */
  665         TC_THROW_FATAL_EXCEPTION;
  666     }
  667 }
  668 
  669 
  670 BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
  671 {
  672     unsigned char buf [ENCRYPTION_DATA_UNIT_SIZE * 4];
  673     unsigned int i;
  674     wchar_t name[64];
  675     unsigned __int32 crc;
  676     UINT64_STRUCT unitNo;
  677     uint32 nbrUnits;
  678     unsigned __int64 writeOffset;
  679     int testCase = 0;
  680     int nTestsPerformed = 0;
  681 
  682     static CRYPTOPP_ALIGN_DATA(16) unsigned char key1[] =
  683     {
  684         0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27,
  685         0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
  686         0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13
  687     };
  688 
  689 
  690     /* Encryption/decryption of data units (typically, volume data sectors) */
  691 
  692     nbrUnits = sizeof (buf) / ENCRYPTION_DATA_UNIT_SIZE;
  693 
  694     ci->mode = XTS; // we only implement XTS
  695 
  696     /* The buffer can accommodate 4 data units and we'll test 4 cases by "scrolling". The data unit 0xFFFFFFFFFF
  697     will "move" from the start of the buffer to its end. For a 512-byte data unit, the byte offset 562949953420800
  698     corresponds to the data unit 0xFFFFFFFFFF. */
  699     for (writeOffset = 562949953420800ULL;
  700         writeOffset > 562949953420800ULL - nbrUnits * ENCRYPTION_DATA_UNIT_SIZE;
  701         writeOffset -= ENCRYPTION_DATA_UNIT_SIZE)
  702     {
  703         unitNo.Value = writeOffset / ENCRYPTION_DATA_UNIT_SIZE;
  704 
  705         // Test all EAs that support this mode of operation
  706         for (ci->ea = EAGetFirst (); ci->ea != 0; ci->ea = EAGetNext (ci->ea))
  707         {
  708             if (!EAIsModeSupported (ci->ea, ci->mode))
  709                 continue;
  710 
  711             EAGetName (name, ci->ea, 0);
  712 
  713             if (EAInit (ci->ea, key1, ci->ks) != ERR_SUCCESS)
  714                 return FALSE;
  715 
  716             for (i = 0; i < sizeof (ci->k2); i++)
  717                 ci->k2[i] = (unsigned char) i;
  718 
  719             memcpy (&ci->k2, XTS_vectors[XTS_TEST_COUNT-1].key2, sizeof (XTS_vectors[XTS_TEST_COUNT-1].key2));
  720 
  721             if (!EAInitMode (ci))
  722                 return FALSE;
  723 
  724             // Each data unit will contain the same plaintext
  725             for (i = 0; i < nbrUnits; i++)
  726             {
  727                 memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE,
  728                     XTS_vectors[XTS_TEST_COUNT-1].plaintext,
  729                     ENCRYPTION_DATA_UNIT_SIZE);
  730             }
  731 
  732             EncryptDataUnits (buf, &unitNo, nbrUnits, ci);
  733 
  734             crc = GetCrc32 (buf, sizeof (buf));
  735 
  736             if (wcscmp (name, L"AES") == 0)
  737             {
  738                 // Verify the ciphertext of the "moving" data unit using the IEEE test vector #14
  739                 if (memcmp (XTS_vectors[XTS_TEST_COUNT-1].ciphertext,
  740                     (unsigned char *) buf + testCase * ENCRYPTION_DATA_UNIT_SIZE,
  741                     ENCRYPTION_DATA_UNIT_SIZE) != 0)
  742                 {
  743                     return FALSE;
  744                 }
  745 
  746                 // CRC of all data units in the buffer for each test case
  747                 switch (testCase)
  748                 {
  749                 case 0:
  750                     if (crc != 0x888f2990)
  751                         return FALSE;
  752                     nTestsPerformed++;
  753                     break;
  754                 case 1:
  755                     if (crc != 0xea28ea34)
  756                         return FALSE;
  757                     nTestsPerformed++;
  758                     break;
  759                 case 2:
  760                     if (crc != 0xe058f5a2)
  761                         return FALSE;
  762                     nTestsPerformed++;
  763                     break;
  764                 case 3:
  765                     if (crc != 0x10473dc9)
  766                         return FALSE;
  767                     nTestsPerformed++;
  768                     break;
  769                 }
  770             }
  771             else if (wcscmp (name, L"Serpent") == 0)
  772             {
  773                 switch (testCase)
  774                 {
  775                 case 0:
  776                     if (crc != 0x7edfecb3)
  777                         return FALSE;
  778                     nTestsPerformed++;
  779                     break;
  780                 case 1:
  781                     if (crc != 0x357baaaa)
  782                         return FALSE;
  783                     nTestsPerformed++;
  784                     break;
  785                 case 2:
  786                     if (crc != 0xc7b9fca5)
  787                         return FALSE;
  788                     nTestsPerformed++;
  789                     break;
  790                 case 3:
  791                     if (crc != 0xb5263e0c)
  792                         return FALSE;
  793                     nTestsPerformed++;
  794                     break;
  795                 }
  796             }
  797             else if (wcscmp (name, L"Twofish") == 0)
  798             {
  799                 switch (testCase)
  800                 {
  801                 case 0:
  802                     if (crc != 0x91525124)
  803                         return FALSE;
  804                     nTestsPerformed++;
  805                     break;
  806                 case 1:
  807                     if (crc != 0x2895cc47)
  808                         return FALSE;
  809                     nTestsPerformed++;
  810                     break;
  811                 case 2:
  812                     if (crc != 0x6bee346d)
  813                         return FALSE;
  814                     nTestsPerformed++;
  815                     break;
  816                 case 3:
  817                     if (crc != 0xb1c45759)
  818                         return FALSE;
  819                     nTestsPerformed++;
  820                     break;
  821                 }
  822             }
  823             else if (wcscmp (name, L"Camellia") == 0)
  824             {
  825                 switch (testCase)
  826                 {
  827                 case 0:
  828                     if (crc != 0x2436badb)
  829                         return FALSE;
  830                     nTestsPerformed++;
  831                     break;
  832                 case 1:
  833                     if (crc != 0x247d2272)
  834                         return FALSE;
  835                     nTestsPerformed++;
  836                     break;
  837                 case 2:
  838                     if (crc != 0x72b49cde)
  839                         return FALSE;
  840                     nTestsPerformed++;
  841                     break;
  842                 case 3:
  843                     if (crc != 0xb838d2c1)
  844                         return FALSE;
  845                     nTestsPerformed++;
  846                     break;
  847                 }
  848             }
  849 #if defined(CIPHER_GOST89)
  850             else if (wcscmp (name, L"GOST89") == 0)
  851             {
  852                 switch (testCase)
  853                 {
  854                 case 0:
  855                     if (crc != 0x12194ef5)
  856                         return FALSE;
  857                     nTestsPerformed++;
  858                     break;
  859                 case 1:
  860                     if (crc != 0xda8d429b)
  861                         return FALSE;
  862                     nTestsPerformed++;
  863                     break;
  864                 case 2:
  865                     if (crc != 0xdbf0b12e)
  866                         return FALSE;
  867                     nTestsPerformed++;
  868                     break;
  869                 case 3:
  870                     if (crc != 0xb986eb4a)
  871                         return FALSE;
  872                     nTestsPerformed++;
  873                     break;
  874                 }
  875             }
  876 #endif
  877             else if (wcscmp (name, L"Kuznyechik") == 0)
  878             {
  879                 switch (testCase)
  880                 {
  881                 case 0:
  882                     if (crc != 0x6b86e72e)
  883                         return FALSE;
  884                     nTestsPerformed++;
  885                     break;
  886                 case 1:
  887                     if (crc != 0xa4f8637d)
  888                         return FALSE;
  889                     nTestsPerformed++;
  890                     break;
  891                 case 2:
  892                     if (crc != 0xfd83e76d)
  893                         return FALSE;
  894                     nTestsPerformed++;
  895                     break;
  896                 case 3:
  897                     if (crc != 0xb24fc47b)
  898                         return FALSE;
  899                     nTestsPerformed++;
  900                     break;
  901                 }
  902             }            
  903             else if (wcscmp (name, L"AES-Twofish") == 0)
  904             {
  905                 switch (testCase)
  906                 {
  907                 case 0:
  908                     if (crc != 0x6cea7fa2)
  909                         return FALSE;
  910                     nTestsPerformed++;
  911                     break;
  912                 case 1:
  913                     if (crc != 0x69052c4c)
  914                         return FALSE;
  915                     nTestsPerformed++;
  916                     break;
  917                 case 2:
  918                     if (crc != 0x88db8de5)
  919                         return FALSE;
  920                     nTestsPerformed++;
  921                     break;
  922                 case 3:
  923                     if (crc != 0xf16fd8c5)
  924                         return FALSE;
  925                     nTestsPerformed++;
  926                     break;
  927                 }
  928             }
  929             else if (wcscmp (name, L"AES-Twofish-Serpent") == 0)
  930             {
  931                 switch (testCase)
  932                 {
  933                 case 0:
  934                     if (crc != 0xa2d7d82a)
  935                         return FALSE;
  936                     nTestsPerformed++;
  937                     break;
  938                 case 1:
  939                     if (crc != 0xdbf76412)
  940                         return FALSE;
  941                     nTestsPerformed++;
  942                     break;
  943                 case 2:
  944                     if (crc != 0xdf0ea03e)
  945                         return FALSE;
  946                     nTestsPerformed++;
  947                     break;
  948                 case 3:
  949                     if (crc != 0xdadedff7)
  950                         return FALSE;
  951                     nTestsPerformed++;
  952                     break;
  953                 }
  954             }
  955             else if (wcscmp (name, L"Serpent-AES") == 0)
  956             {
  957                 switch (testCase)
  958                 {
  959                 case 0:
  960                     if (crc != 0x6dd133b3)
  961                         return FALSE;
  962                     nTestsPerformed++;
  963                     break;
  964                 case 1:
  965                     if (crc != 0x0e5717d2)
  966                         return FALSE;
  967                     nTestsPerformed++;
  968                     break;
  969                 case 2:
  970                     if (crc != 0x39f83cd9)
  971                         return FALSE;
  972                     nTestsPerformed++;
  973                     break;
  974                 case 3:
  975                     if (crc != 0x8a79fa2c)
  976                         return FALSE;
  977                     nTestsPerformed++;
  978                     break;
  979                 }
  980             }
  981             else if (wcscmp (name, L"Serpent-Twofish-AES") == 0)
  982             {
  983                 switch (testCase)
  984                 {
  985                 case 0:
  986                     if (crc != 0xe536daf8)
  987                         return FALSE;
  988                     nTestsPerformed++;
  989                     break;
  990                 case 1:
  991                     if (crc != 0x3ae89e7f)
  992                         return FALSE;
  993                     nTestsPerformed++;
  994                     break;
  995                 case 2:
  996                     if (crc != 0x2cc1301a)
  997                         return FALSE;
  998                     nTestsPerformed++;
  999                     break;
 1000                 case 3:
 1001                     if (crc != 0xcac7bdc7)
 1002                         return FALSE;
 1003                     nTestsPerformed++;
 1004                     break;
 1005                 }
 1006             }
 1007             else if (wcscmp (name, L"Twofish-Serpent") == 0)
 1008             {
 1009                 switch (testCase)
 1010                 {
 1011                 case 0:
 1012                     if (crc != 0x2686c859)
 1013                         return FALSE;
 1014                     nTestsPerformed++;
 1015                     break;
 1016                 case 1:
 1017                     if (crc != 0x8a201780)
 1018                         return FALSE;
 1019                     nTestsPerformed++;
 1020                     break;
 1021                 case 2:
 1022                     if (crc != 0x8dd13796)
 1023                         return FALSE;
 1024                     nTestsPerformed++;
 1025                     break;
 1026                 case 3:
 1027                     if (crc != 0xe95196cb)
 1028                         return FALSE;
 1029                     nTestsPerformed++;
 1030                     break;
 1031                 }
 1032             }
 1033             else if (wcscmp (name, L"Camellia-Kuznyechik") == 0)
 1034             {
 1035                 switch (testCase)
 1036                 {
 1037                 case 0:
 1038                     if (crc != 0x4ea34e89)
 1039                         return FALSE;
 1040                     nTestsPerformed++;
 1041                     break;
 1042                 case 1:
 1043                     if (crc != 0xb3ad8559)
 1044                         return FALSE;
 1045                     nTestsPerformed++;
 1046                     break;
 1047                 case 2:
 1048                     if (crc != 0xde361313)
 1049                         return FALSE;
 1050                     nTestsPerformed++;
 1051                     break;
 1052                 case 3:
 1053                     if (crc != 0x519d2bf9)
 1054                         return FALSE;
 1055                     nTestsPerformed++;
 1056                     break;
 1057                 }
 1058             }
 1059             else if (wcscmp (name, L"Kuznyechik-Twofish") == 0)
 1060             {
 1061                 switch (testCase)
 1062                 {
 1063                 case 0:
 1064                     if (crc != 0x748f8631)
 1065                         return FALSE;
 1066                     nTestsPerformed++;
 1067                     break;
 1068                 case 1:
 1069                     if (crc != 0x8a4b0888)
 1070                         return FALSE;
 1071                     nTestsPerformed++;
 1072                     break;
 1073                 case 2:
 1074                     if (crc != 0xe0310188)
 1075                         return FALSE;
 1076                     nTestsPerformed++;
 1077                     break;
 1078                 case 3:
 1079                     if (crc != 0xfc2b6b45)
 1080                         return FALSE;
 1081                     nTestsPerformed++;
 1082                     break;
 1083                 }
 1084             }
 1085             else if (wcscmp (name, L"Camellia-Serpent") == 0)
 1086             {
 1087                 switch (testCase)
 1088                 {
 1089                 case 0:
 1090                     if (crc != 0x10569a42)
 1091                         return FALSE;
 1092                     nTestsPerformed++;
 1093                     break;
 1094                 case 1:
 1095                     if (crc != 0x4de95152)
 1096                         return FALSE;
 1097                     nTestsPerformed++;
 1098                     break;
 1099                 case 2:
 1100                     if (crc != 0xe17b5fe7)
 1101                         return FALSE;
 1102                     nTestsPerformed++;
 1103                     break;
 1104                 case 3:
 1105                     if (crc != 0xdbf993fa)
 1106                         return FALSE;
 1107                     nTestsPerformed++;
 1108                     break;
 1109                 }
 1110             }
 1111             else if (wcscmp (name, L"Kuznyechik-AES") == 0)
 1112             {
 1113                 switch (testCase)
 1114                 {
 1115                 case 0:
 1116                     if (crc != 0xc479f95d)
 1117                         return FALSE;
 1118                     nTestsPerformed++;
 1119                     break;
 1120                 case 1:
 1121                     if (crc != 0x58eaf88d)
 1122                         return FALSE;
 1123                     nTestsPerformed++;
 1124                     break;
 1125                 case 2:
 1126                     if (crc != 0xbe300cc2)
 1127                         return FALSE;
 1128                     nTestsPerformed++;
 1129                     break;
 1130                 case 3:
 1131                     if (crc != 0x9b681c2e)
 1132                         return FALSE;
 1133                     nTestsPerformed++;
 1134                     break;
 1135                 }
 1136             }
 1137             else if (wcscmp (name, L"Kuznyechik-Serpent-Camellia") == 0)
 1138             {
 1139                 switch (testCase)
 1140                 {
 1141                 case 0:
 1142                     if (crc != 0x9d8ac7ee)
 1143                         return FALSE;
 1144                     nTestsPerformed++;
 1145                     break;
 1146                 case 1:
 1147                     if (crc != 0x5d7d347f)
 1148                         return FALSE;
 1149                     nTestsPerformed++;
 1150                     break;
 1151                 case 2:
 1152                     if (crc != 0x884b62ee)
 1153                         return FALSE;
 1154                     nTestsPerformed++;
 1155                     break;
 1156                 case 3:
 1157                     if (crc != 0x5c6c3997)
 1158                         return FALSE;
 1159                     nTestsPerformed++;
 1160                     break;
 1161                 }
 1162             }
 1163 
 1164             if (crc == 0x9f5edd58)
 1165                 return FALSE;
 1166 
 1167             DecryptDataUnits (buf, &unitNo, nbrUnits, ci);
 1168 
 1169             if (GetCrc32 (buf, sizeof (buf)) != 0x9f5edd58)
 1170                 return FALSE;
 1171 
 1172             nTestsPerformed++;
 1173         }
 1174         testCase++;
 1175     }
 1176 
 1177     /* Encryption/decryption of a buffer (typically, a volume header) */
 1178 
 1179     nbrUnits = sizeof (buf) / ENCRYPTION_DATA_UNIT_SIZE;
 1180 
 1181     // Test all EAs that support this mode of operation
 1182     for (ci->ea = EAGetFirst (); ci->ea != 0; ci->ea = EAGetNext (ci->ea))
 1183     {
 1184         if (!EAIsModeSupported (ci->ea, ci->mode))
 1185             continue;
 1186 
 1187         EAGetName (name, ci->ea, 0);
 1188 
 1189         if (EAInit (ci->ea, key1, ci->ks) != ERR_SUCCESS)
 1190             return FALSE;
 1191 
 1192         memcpy (&ci->k2, XTS_vectors[XTS_TEST_COUNT-1].key2, sizeof (XTS_vectors[XTS_TEST_COUNT-1].key2));
 1193 
 1194         if (!EAInitMode (ci))
 1195             return FALSE;
 1196 
 1197         // Each data unit will contain the same plaintext
 1198         for (i = 0; i < nbrUnits; i++)
 1199         {
 1200             memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE,
 1201                 XTS_vectors[XTS_TEST_COUNT-1].plaintext,
 1202                 ENCRYPTION_DATA_UNIT_SIZE);
 1203         }
 1204 
 1205         EncryptBuffer (buf, sizeof (buf), ci);
 1206 
 1207         crc = GetCrc32 (buf, sizeof (buf));
 1208 
 1209         if (wcscmp (name, L"AES") == 0)
 1210         {
 1211             if (crc != 0x33b91fab)
 1212                 return FALSE;
 1213             nTestsPerformed++;
 1214         }
 1215         else if (wcscmp (name, L"Serpent") == 0)
 1216         {
 1217             if (crc != 0x3494d480)
 1218                 return FALSE;
 1219             nTestsPerformed++;
 1220         }
 1221         else if (wcscmp (name, L"Twofish") == 0)
 1222         {
 1223             if (crc != 0xc4d65b46)
 1224                 return FALSE;
 1225             nTestsPerformed++;
 1226         }
 1227         else if (wcscmp (name, L"Camellia") == 0)
 1228         {
 1229             if (crc != 0x8176b223)
 1230                 return FALSE;
 1231             nTestsPerformed++;
 1232         }
 1233 #if defined(CIPHER_GOST89)
 1234         else if (wcscmp (name, L"GOST89") == 0)
 1235         {
 1236             if (crc != 0x9e8653cb)
 1237                 return FALSE;
 1238             nTestsPerformed++;
 1239         }
 1240 #endif
 1241         else if (wcscmp (name, L"Kuznyechik") == 0)
 1242         {
 1243             if (crc != 0xd6d39cdb)
 1244                 return FALSE;
 1245             nTestsPerformed++;
 1246         }
 1247         else if (wcscmp (name, L"AES-Twofish") == 0)
 1248         {
 1249             if (crc != 0x14ce7385)
 1250                 return FALSE;
 1251             nTestsPerformed++;
 1252         }
 1253         else if (wcscmp (name, L"AES-Twofish-Serpent") == 0)
 1254         {
 1255             if (crc != 0x0ec81bf7)
 1256                 return FALSE;
 1257             nTestsPerformed++;
 1258         }
 1259         else if (wcscmp (name, L"Serpent-AES") == 0)
 1260         {
 1261             if (crc != 0x42f919ad)
 1262                 return FALSE;
 1263             nTestsPerformed++;
 1264         }
 1265         else if (wcscmp (name, L"Serpent-Twofish-AES") == 0)
 1266         {
 1267             if (crc != 0x208d5c58)
 1268                 return FALSE;
 1269             nTestsPerformed++;
 1270         }
 1271         else if (wcscmp (name, L"Twofish-Serpent") == 0)
 1272         {
 1273             if (crc != 0xbe78cec1)
 1274                 return FALSE;
 1275             nTestsPerformed++;
 1276         }
 1277         else if (wcscmp (name, L"Camellia-Kuznyechik") == 0)
 1278         {
 1279             if (crc != 0xe69d680d)
 1280                 return FALSE;
 1281             nTestsPerformed++;
 1282         }
 1283         else if (wcscmp (name, L"Kuznyechik-Twofish") == 0)
 1284         {
 1285             if (crc != 0xe0aef0d1)
 1286                 return FALSE;
 1287             nTestsPerformed++;
 1288         }
 1289         else if (wcscmp (name, L"Camellia-Serpent") == 0)
 1290         {
 1291             if (crc != 0x58aad727)
 1292                 return FALSE;
 1293             nTestsPerformed++;
 1294         }
 1295         else if (wcscmp (name, L"Kuznyechik-AES") == 0)
 1296         {
 1297             if (crc != 0x4641234a)
 1298                 return FALSE;
 1299             nTestsPerformed++;
 1300         }
 1301         else if (wcscmp (name, L"Kuznyechik-Serpent-Camellia") == 0)
 1302         {
 1303             if (crc != 0x755dad72)
 1304                 return FALSE;
 1305             nTestsPerformed++;
 1306         }
 1307 
 1308         if (crc == 0x9f5edd58)
 1309             return FALSE;
 1310 
 1311         DecryptBuffer (buf, sizeof (buf), ci);
 1312 
 1313         if (GetCrc32 (buf, sizeof (buf)) != 0x9f5edd58)
 1314             return FALSE;
 1315 
 1316         nTestsPerformed++;
 1317     }
 1318 #if defined(CIPHER_GOST89)
 1319     return (nTestsPerformed == 160);
 1320 #else
 1321     return (nTestsPerformed == 155);
 1322 #endif
 1323 }
 1324 
 1325 static BOOL DoAutoTestAlgorithms (void)
 1326 {
 1327     PCRYPTO_INFO ci;
 1328     CRYPTOPP_ALIGN_DATA(16) char key[32];
 1329     unsigned char tmp[16];
 1330     BOOL bFailed = FALSE;
 1331     int i;
 1332 
 1333     ci = crypto_open ();
 1334     if (!ci)
 1335         return FALSE;
 1336 
 1337     memset (ci, 0, sizeof (*ci));
 1338 
 1339     /* AES */
 1340 
 1341     for (i = 0; i < AES_TEST_COUNT; i++)
 1342     {
 1343         int cipher = AES;
 1344         memcpy(key, aes_ecb_vectors[i].key, 32);
 1345         memcpy(tmp, aes_ecb_vectors[i].plaintext, 16);
 1346         CipherInit(cipher, key, ks_tmp);
 1347 
 1348         EncipherBlock(cipher, tmp, ks_tmp);
 1349         if (memcmp(aes_ecb_vectors[i].ciphertext, tmp, 16) != 0)
 1350             break;
 1351 
 1352         DecipherBlock(cipher, tmp, ks_tmp);
 1353         if (memcmp(aes_ecb_vectors[i].plaintext, tmp, 16) != 0)
 1354             break;
 1355     }
 1356     if (i != AES_TEST_COUNT)
 1357         bFailed = TRUE;
 1358 
 1359     // AES EncipherBlocks()/DecipherBlocks()
 1360     {
 1361         byte testData[1024];
 1362         uint32 origCrc;
 1363         size_t i;
 1364 
 1365         for (i = 0; i < sizeof (testData); ++i)
 1366         {
 1367             testData[i] = (byte) i;
 1368         }
 1369 
 1370         origCrc = GetCrc32 (testData, sizeof (testData));
 1371 
 1372         CipherInit (AES, testData, ks_tmp);
 1373         EncipherBlocks (AES, testData, ks_tmp, sizeof (testData) / CipherGetBlockSize (AES));
 1374 
 1375         if (GetCrc32 (testData, sizeof (testData)) != 0xb5cd5631)
 1376             bFailed = TRUE;
 1377 
 1378         DecipherBlocks (AES, testData, ks_tmp, sizeof (testData) / CipherGetBlockSize (AES));
 1379 
 1380         if (origCrc != GetCrc32 (testData, sizeof (testData)))
 1381             bFailed = TRUE;
 1382     }
 1383 
 1384     /* Serpent */
 1385 
 1386     for (i = 0; i < SERPENT_TEST_COUNT; i++)
 1387     {
 1388         int cipher = SERPENT;
 1389         memcpy(key, serpent_vectors[i].key, 32);
 1390         memcpy(tmp, serpent_vectors[i].plaintext, 16);
 1391         CipherInit(cipher, key, ks_tmp);
 1392 
 1393         EncipherBlock(cipher, tmp, ks_tmp);
 1394         if (memcmp(serpent_vectors[i].ciphertext, tmp, 16) != 0)
 1395             break;
 1396 
 1397         DecipherBlock(cipher, tmp, ks_tmp);
 1398         if (memcmp(serpent_vectors[i].plaintext, tmp, 16) != 0)
 1399             break;
 1400     }
 1401     if (i != SERPENT_TEST_COUNT)
 1402         bFailed = TRUE;
 1403 
 1404 
 1405     /* Twofish */
 1406 
 1407     for (i = 0; i < TWOFISH_TEST_COUNT; i++)
 1408     {
 1409         int cipher = TWOFISH;
 1410         memcpy(key, twofish_vectors[i].key, 32);
 1411         memcpy(tmp, twofish_vectors[i].plaintext, 16);
 1412         CipherInit(cipher, key, ks_tmp);
 1413 
 1414         EncipherBlock(cipher, tmp, ks_tmp);
 1415         if (memcmp(twofish_vectors[i].ciphertext, tmp, 16) != 0)
 1416             break;
 1417 
 1418         DecipherBlock(cipher, tmp, ks_tmp);
 1419         if (memcmp(twofish_vectors[i].plaintext, tmp, 16) != 0)
 1420             break;
 1421     }
 1422     if (i != TWOFISH_TEST_COUNT)
 1423         bFailed = TRUE;
 1424     
 1425     /* Camellia */
 1426 
 1427     for (i = 0; i < CAMELLIA_TEST_COUNT; i++)
 1428     {
 1429         int cipher = CAMELLIA;
 1430         memcpy(key, camellia_vectors[i].key, 32);
 1431         memcpy(tmp, camellia_vectors[i].plaintext, 16);
 1432         CipherInit(cipher, key, ks_tmp);
 1433 
 1434         EncipherBlock(cipher, tmp, ks_tmp);
 1435         if (memcmp(camellia_vectors[i].ciphertext, tmp, 16) != 0)
 1436             break;
 1437 
 1438         DecipherBlock(cipher, tmp, ks_tmp);
 1439         if (memcmp(camellia_vectors[i].plaintext, tmp, 16) != 0)
 1440             break;
 1441     }
 1442     if (i != CAMELLIA_TEST_COUNT)
 1443         bFailed = TRUE;
 1444 
 1445     /* Kuznyechik */
 1446 
 1447     for (i = 0; i < KUZNYECHIK_TEST_COUNT; i++)
 1448     {
 1449         int cipher = KUZNYECHIK;
 1450         memcpy(key, kuznyechik_vectors[i].key, 32);
 1451         memcpy(tmp, kuznyechik_vectors[i].plaintext, 16);
 1452         CipherInit(cipher, key, ks_tmp);
 1453 
 1454         EncipherBlock(cipher, tmp, ks_tmp);
 1455         if (memcmp(kuznyechik_vectors[i].ciphertext, tmp, 16) != 0)
 1456             break;
 1457 
 1458         DecipherBlock(cipher, tmp, ks_tmp);
 1459         if (memcmp(kuznyechik_vectors[i].plaintext, tmp, 16) != 0)
 1460             break;
 1461     }
 1462     if (i != KUZNYECHIK_TEST_COUNT)
 1463         bFailed = TRUE;
 1464 
 1465 #if defined(CIPHER_GOST89)
 1466     /* GOST89 */
 1467 
 1468     for (i = 0; i < GOST89_TEST_COUNT; i++)
 1469     {
 1470         int cipher = GOST89;
 1471         memcpy(key, gost89_vectors[i].key, 32);
 1472         memcpy(tmp, gost89_vectors[i].plaintext, 16);
 1473         gost_set_key(key, (gost_kds*)ks_tmp, 0);
 1474 
 1475         EncipherBlock(cipher, tmp, ks_tmp);
 1476         if (memcmp(gost89_vectors[i].ciphertext, tmp, 16) != 0)
 1477             break;
 1478 
 1479         DecipherBlock(cipher, tmp, ks_tmp);
 1480         if (memcmp(gost89_vectors[i].plaintext, tmp, 16) != 0)
 1481             break;
 1482     }
 1483     if (i != GOST89_TEST_COUNT)
 1484         bFailed = TRUE;
 1485 #endif
 1486 
 1487     /* PKCS #5 and HMACs */
 1488     if (!test_pkcs5 ())
 1489         bFailed = TRUE;
 1490 
 1491     /* CRC-32 */
 1492     if (!crc32_selftests ())
 1493         bFailed = TRUE;
 1494 
 1495     /* GF multiplicator */
 1496 #if 0
 1497     if (!GfMulSelfTest ())
 1498         bFailed = TRUE;
 1499 #endif
 1500 
 1501     /* XTS-AES */
 1502     if (!XTSAesTest (ci))
 1503         bFailed = TRUE;
 1504 
 1505     /* Sector and buffer related algorithms */
 1506     if (!TestSectorBufEncryption (ci))
 1507         bFailed = TRUE;
 1508 
 1509     crypto_close (ci);
 1510     return !bFailed;
 1511 }
 1512 
 1513 
 1514 BOOL AutoTestAlgorithms (void)
 1515 {
 1516     BOOL result = TRUE;
 1517     BOOL hwEncryptionEnabled = IsHwEncryptionEnabled();
 1518 #if defined (_MSC_VER) && !defined (_UEFI)
 1519     BOOL exceptionCatched = FALSE;
 1520     __try
 1521     {
 1522 #endif
 1523         EnableHwEncryption (FALSE);
 1524 
 1525         if (!DoAutoTestAlgorithms())
 1526             result = FALSE;
 1527 
 1528         EnableHwEncryption (TRUE);
 1529 
 1530         if (!DoAutoTestAlgorithms())
 1531             result = FALSE;
 1532 
 1533         EnableHwEncryption (hwEncryptionEnabled);
 1534 #if defined (_MSC_VER) && !defined (_UEFI)
 1535     }
 1536     __except (EXCEPTION_EXECUTE_HANDLER)
 1537     {
 1538         exceptionCatched = TRUE;
 1539     }
 1540 
 1541     if (exceptionCatched)
 1542     {
 1543         /* unexepected exception raised. Disable all CPU extended feature and try again */
 1544         EnableHwEncryption (hwEncryptionEnabled);
 1545         DisableCPUExtendedFeatures ();
 1546         __try
 1547         {
 1548             result = DoAutoTestAlgorithms();
 1549         }
 1550         __except (EXCEPTION_EXECUTE_HANDLER)
 1551         {
 1552             /* exception still occuring. Report failure. */
 1553             result = FALSE;
 1554         }
 1555     }
 1556 #endif
 1557     return result;
 1558 }
 1559 
 1560 BOOL test_hmac_sha256 ()
 1561 {
 1562     unsigned int i;
 1563     int nTestsPerformed = 0;
 1564 
 1565     for (i = 0; i < sizeof (hmac_sha256_test_data) / sizeof(char *); i++)
 1566     {
 1567         char digest[1024]; /* large enough to hold digets and test vector inputs */
 1568         memcpy (digest, hmac_sha256_test_data[i], strlen (hmac_sha256_test_data[i]));
 1569         hmac_sha256 (hmac_sha256_test_keys[i], (int) strlen (hmac_sha256_test_keys[i]), digest, (int) strlen (hmac_sha256_test_data[i]));
 1570         if (memcmp (digest, hmac_sha256_test_vectors[i], SHA256_DIGESTSIZE) != 0)
 1571             return FALSE;
 1572         else
 1573             nTestsPerformed++;
 1574     }
 1575 
 1576     return (nTestsPerformed == 6);
 1577 }
 1578 
 1579 BOOL test_hmac_sha512 ()
 1580 {
 1581     unsigned int i;
 1582     int nTestsPerformed = 0;
 1583 
 1584     for (i = 0; i < sizeof (hmac_sha512_test_data) / sizeof(char *); i++)
 1585     {
 1586         char digest[1024]; /* large enough to hold digets and test vector inputs */
 1587         memcpy (digest, hmac_sha512_test_data[i], (int) strlen (hmac_sha512_test_data[i]));
 1588         hmac_sha512 (hmac_sha512_test_keys[i], (int) strlen (hmac_sha512_test_keys[i]), digest, (int) strlen (hmac_sha512_test_data[i]));
 1589         if (memcmp (digest, hmac_sha512_test_vectors[i], SHA512_DIGESTSIZE) != 0)
 1590             return FALSE;
 1591         else
 1592             nTestsPerformed++;
 1593     }
 1594 
 1595     return (nTestsPerformed == 6);
 1596 }
 1597 
 1598 BOOL test_hmac_ripemd160 ()
 1599 {
 1600     int nTestsPerformed = 0;
 1601     unsigned int i;
 1602 
 1603     for (i = 0; i < sizeof (hmac_ripemd160_test_data) / sizeof(char *); i++)
 1604     {
 1605         char digest[1024]; /* large enough to hold digets and test vector inputs */
 1606         memcpy (digest, hmac_ripemd160_test_data[i], strlen (hmac_ripemd160_test_data[i]));
 1607         hmac_ripemd160 (hmac_ripemd160_test_keys[i], RIPEMD160_DIGESTSIZE, digest, (int) strlen (hmac_ripemd160_test_data[i]));
 1608         if (memcmp (digest, hmac_ripemd160_test_vectors[i], RIPEMD160_DIGESTSIZE) != 0)
 1609             return FALSE;
 1610         else
 1611             nTestsPerformed++;
 1612     }
 1613 
 1614     return (nTestsPerformed == 2);
 1615 }
 1616 
 1617 BOOL test_hmac_whirlpool ()
 1618 {
 1619     unsigned char digest[1024]; /* large enough to hold digets and test vector inputs */
 1620 
 1621     memcpy (digest, hmac_whirlpool_test_data, strlen (hmac_whirlpool_test_data));
 1622     hmac_whirlpool (hmac_whirlpool_test_key, 64, digest, (int) strlen (hmac_whirlpool_test_data));
 1623     if (memcmp (digest, hmac_whirlpool_test_vectors, WHIRLPOOL_DIGESTSIZE) != 0)
 1624         return FALSE;
 1625 
 1626     return TRUE;
 1627 }
 1628 
 1629 /* http://www.tc26.ru/methods/recommendation/%D0%A2%D0%9A26%D0%90%D0%9B%D0%93.pdf */
 1630 /* https://tools.ietf.org/html/draft-smyshlyaev-gost-usage-00 */
 1631 /* https://datatracker.ietf.org/doc/rfc7836/?include_text=1 */
 1632 static const unsigned char gost3411_2012_hmac_k1[] = {
 1633     0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
 1634     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
 1635     0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
 1636     0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
 1637 };
 1638 static const unsigned char gost3411_2012_hmac_m1[] = {
 1639     0x01, 0x26, 0xbd, 0xb8, 0x78, 0x00, 0xaf, 0x21,
 1640     0x43, 0x41, 0x45, 0x65, 0x63, 0x78, 0x01, 0x00
 1641 };
 1642 static const unsigned char gost3411_2012_hmac_r1[] = {
 1643     0xA5, 0x9B, 0xAB, 0x22, 0xEC, 0xAE, 0x19, 0xC6, 0x5F, 0xBD, 0xE6, 0xE5,
 1644     0xF4, 0xE9, 0xF5, 0xD8, 0x54, 0x9D, 0x31, 0xF0, 0x37, 0xF9, 0xDF, 0x9B,
 1645     0x90, 0x55, 0x00, 0xE1, 0x71, 0x92, 0x3A, 0x77, 0x3D, 0x5F, 0x15, 0x30,
 1646     0xF2, 0xED, 0x7E, 0x96, 0x4C, 0xB2, 0xEE, 0xDC, 0x29, 0xE9, 0xAD, 0x2F,
 1647     0x3A, 0xFE, 0x93, 0xB2, 0x81, 0x4F, 0x79, 0xF5, 0x00, 0x0F, 0xFC, 0x03,
 1648     0x66, 0xC2, 0x51, 0xE6
 1649 };
 1650 
 1651 
 1652 BOOL test_hmac_streebog ()
 1653 {
 1654     CRYPTOPP_ALIGN_DATA(16) char digest[64]; /* large enough to hold digets and test vector inputs */
 1655 
 1656     memcpy (digest, gost3411_2012_hmac_m1, sizeof (gost3411_2012_hmac_m1));
 1657     hmac_streebog ((char*) gost3411_2012_hmac_k1, sizeof(gost3411_2012_hmac_k1), digest, (int) sizeof (gost3411_2012_hmac_m1));
 1658     if (memcmp (digest, gost3411_2012_hmac_r1, STREEBOG_DIGESTSIZE) != 0)
 1659         return FALSE;
 1660 
 1661     return TRUE;
 1662 }
 1663 
 1664 int __cdecl StreebogHash (unsigned char* input, unsigned long inputLen, unsigned char* output)
 1665 {
 1666     STREEBOG_CTX ctx;
 1667     STREEBOG_init (&ctx);
 1668     STREEBOG_add (&ctx, input, inputLen);
 1669     STREEBOG_finalize (&ctx, output);
 1670     return STREEBOG_DIGESTSIZE;
 1671 }
 1672 
 1673 BOOL test_pkcs5 ()
 1674 {
 1675     char dk[144];
 1676 
 1677     /* HMAC-SHA-256 tests */
 1678     if (!test_hmac_sha256())
 1679         return FALSE;
 1680 
 1681     /* HMAC-SHA-512 tests */
 1682     if (!test_hmac_sha512())
 1683         return FALSE;
 1684 
 1685     /* HMAC-RIPEMD-160 tests */
 1686     if (test_hmac_ripemd160() == FALSE)
 1687         return FALSE;
 1688 
 1689     /* HMAC-Whirlpool tests */
 1690     if (test_hmac_whirlpool() == FALSE)
 1691         return FALSE;
 1692 
 1693     /* HMAC-STREEBOG tests */
 1694     if (test_hmac_streebog() == FALSE)
 1695         return FALSE;
 1696 
 1697     /* STREEBOG hash tests */
 1698     if (RunHashTest (StreebogHash, Streebog512TestVectors, (HasSSE2() || HasSSE41())? TRUE : FALSE) == FALSE)
 1699         return FALSE;
 1700 
 1701     /* PKCS-5 test 1 with HMAC-SHA-256 used as the PRF (https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-00) */
 1702     derive_key_sha256 ("passwd", 6, "\x73\x61\x6C\x74", 4, 1, dk, 64);
 1703     if (memcmp (dk, "\x55\xac\x04\x6e\x56\xe3\x08\x9f\xec\x16\x91\xc2\x25\x44\xb6\x05\xf9\x41\x85\x21\x6d\xde\x04\x65\xe6\x8b\x9d\x57\xc2\x0d\xac\xbc\x49\xca\x9c\xcc\xf1\x79\xb6\x45\x99\x16\x64\xb3\x9d\x77\xef\x31\x7c\x71\xb8\x45\xb1\xe3\x0b\xd5\x09\x11\x20\x41\xd3\xa1\x97\x83", 64) != 0)
 1704         return FALSE;
 1705 
 1706     /* PKCS-5 test 2 with HMAC-SHA-256 used as the PRF (https://stackoverflow.com/questions/5130513/pbkdf2-hmac-sha2-test-vectors) */
 1707     derive_key_sha256 ("password", 8, "\x73\x61\x6C\x74", 4, 2, dk, 32);
 1708     if (memcmp (dk, "\xae\x4d\x0c\x95\xaf\x6b\x46\xd3\x2d\x0a\xdf\xf9\x28\xf0\x6d\xd0\x2a\x30\x3f\x8e\xf3\xc2\x51\xdf\xd6\xe2\xd8\x5a\x95\x47\x4c\x43", 32) != 0)
 1709         return FALSE;
 1710 
 1711     /* PKCS-5 test 3 with HMAC-SHA-256 used as the PRF (MS CryptoAPI) */
 1712     derive_key_sha256 ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4);
 1713     if (memcmp (dk, "\xf2\xa0\x4f\xb2", 4) != 0)
 1714         return FALSE;
 1715 
 1716     /* PKCS-5 test 4 with HMAC-SHA-256 used as the PRF (MS CryptoAPI) */
 1717     derive_key_sha256 ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 144);
 1718     if (memcmp (dk, "\xf2\xa0\x4f\xb2\xd3\xe9\xa5\xd8\x51\x0b\x5c\x06\xdf\x70\x8e\x24\xe9\xc7\xd9\x15\x3d\x22\xcd\xde\xb8\xa6\xdb\xfd\x71\x85\xc6\x99\x32\xc0\xee\x37\x27\xf7\x24\xcf\xea\xa6\xac\x73\xa1\x4c\x4e\x52\x9b\x94\xf3\x54\x06\xfc\x04\x65\xa1\x0a\x24\xfe\xf0\x98\x1d\xa6\x22\x28\xeb\x24\x55\x74\xce\x6a\x3a\x28\xe2\x04\x3a\x59\x13\xec\x3f\xf2\xdb\xcf\x58\xdd\x53\xd9\xf9\x17\xf6\xda\x74\x06\x3c\x0b\x66\xf5\x0f\xf5\x58\xa3\x27\x52\x8c\x5b\x07\x91\xd0\x81\xeb\xb6\xbc\x30\x69\x42\x71\xf2\xd7\x18\x42\xbe\xe8\x02\x93\x70\x66\xad\x35\x65\xbc\xf7\x96\x8e\x64\xf1\xc6\x92\xda\xe0\xdc\x1f\xb5\xf4", 144) != 0)
 1719         return FALSE;
 1720 
 1721     /* PKCS-5 test 1 with HMAC-SHA-512 used as the PRF */
 1722     derive_key_sha512 ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4);
 1723     if (memcmp (dk, "\x13\x64\xae\xf8", 4) != 0)
 1724         return FALSE;
 1725 
 1726     /* PKCS-5 test 2 with HMAC-SHA-512 used as the PRF (derives a key longer than the underlying
 1727     hash output size and block size) */
 1728     derive_key_sha512 ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 144);
 1729     if (memcmp (dk, "\x13\x64\xae\xf8\x0d\xf5\x57\x6c\x30\xd5\x71\x4c\xa7\x75\x3f\xfd\x00\xe5\x25\x8b\x39\xc7\x44\x7f\xce\x23\x3d\x08\x75\xe0\x2f\x48\xd6\x30\xd7\x00\xb6\x24\xdb\xe0\x5a\xd7\x47\xef\x52\xca\xa6\x34\x83\x47\xe5\xcb\xe9\x87\xf1\x20\x59\x6a\xe6\xa9\xcf\x51\x78\xc6\xb6\x23\xa6\x74\x0d\xe8\x91\xbe\x1a\xd0\x28\xcc\xce\x16\x98\x9a\xbe\xfb\xdc\x78\xc9\xe1\x7d\x72\x67\xce\xe1\x61\x56\x5f\x96\x68\xe6\xe1\xdd\xf4\xbf\x1b\x80\xe0\x19\x1c\xf4\xc4\xd3\xdd\xd5\xd5\x57\x2d\x83\xc7\xa3\x37\x87\xf4\x4e\xe0\xf6\xd8\x6d\x65\xdc\xa0\x52\xa3\x13\xbe\x81\xfc\x30\xbe\x7d\x69\x58\x34\xb6\xdd\x41\xc6", 144) != 0)
 1730         return FALSE;
 1731 
 1732     /* PKCS-5 test 1 with HMAC-RIPEMD-160 used as the PRF */
 1733     derive_key_ripemd160 ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4);
 1734     if (memcmp (dk, "\x7a\x3d\x7c\x03", 4) != 0)
 1735         return FALSE;
 1736 
 1737     /* PKCS-5 test 2 with HMAC-RIPEMD-160 used as the PRF (derives a key longer than the underlying hash) */
 1738     derive_key_ripemd160 ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 48);
 1739     if (memcmp (dk, "\x7a\x3d\x7c\x03\xe7\x26\x6b\xf8\x3d\x78\xfb\x29\xd2\x64\x1f\x56\xea\xf0\xe5\xf5\xcc\xc4\x3a\x31\xa8\x84\x70\xbf\xbd\x6f\x8e\x78\x24\x5a\xc0\x0a\xf6\xfa\xf0\xf6\xe9\x00\x47\x5f\x73\xce\xe1\x43", 48) != 0)
 1740         return FALSE;
 1741 
 1742     /* PKCS-5 test 1 with HMAC-Whirlpool used as the PRF */
 1743     derive_key_whirlpool ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4);
 1744     if (memcmp (dk, "\x50\x7c\x36\x6f", 4) != 0)
 1745         return FALSE;
 1746 
 1747     /* PKCS-5 test 2 with HMAC-Whirlpool used as the PRF (derives a key longer than the underlying hash) */
 1748     derive_key_whirlpool ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 96);
 1749     if (memcmp (dk, "\x50\x7c\x36\x6f\xee\x10\x2e\x9a\xe2\x8a\xd5\x82\x72\x7d\x27\x0f\xe8\x4d\x7f\x68\x7a\xcf\xb5\xe7\x43\x67\xaa\x98\x93\x52\x2b\x09\x6e\x42\xdf\x2c\x59\x4a\x91\x6d\x7e\x10\xae\xb2\x1a\x89\x8f\xb9\x8f\xe6\x31\xa9\xd8\x9f\x98\x26\xf4\xda\xcd\x7d\x65\x65\xde\x10\x95\x91\xb4\x84\x26\xae\x43\xa1\x00\x5b\x1e\xb8\x38\x97\xa4\x1e\x4b\xd2\x65\x64\xbc\xfa\x1f\x35\x85\xdb\x4f\x97\x65\x6f\xbd\x24", 96) != 0)
 1750         return FALSE;
 1751 
 1752     /* PKCS-5 test 1 with HMAC-STREEBOG used as the PRF */
 1753     derive_key_streebog ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4);
 1754     if (memcmp (dk, "\xd0\x53\xa2\x30", 4) != 0)
 1755         return FALSE;
 1756 
 1757     /* PKCS-5 test 2 with HMAC-STREEBOG used as the PRF (derives a key longer than the underlying hash) */
 1758     derive_key_streebog ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 96);
 1759     if (memcmp (dk, "\xd0\x53\xa2\x30\x6f\x45\x81\xeb\xbc\x06\x81\xc5\xe7\x53\xa8\x5d\xc7\xf1\x23\x33\x1e\xbe\x64\x2c\x3b\x0f\x26\xd7\x00\xe1\x95\xc9\x65\x26\xb1\x85\xbe\x1e\xe2\xf4\x9b\xfc\x6b\x14\x84\xda\x24\x61\xa0\x1b\x9e\x79\x5c\xee\x69\x6e\xf9\x25\xb1\x1d\xca\xa0\x31\xba\x02\x6f\x9e\x99\x0f\xdb\x25\x01\x5b\xf1\xc7\x10\x19\x53\x3b\x29\x3f\x18\x00\xd6\xfc\x85\x03\xdc\xf2\xe5\xe9\x5a\xb1\x1e\x61\xde", 96) != 0)
 1760         return FALSE;
 1761 
 1762     return TRUE;
 1763 }