/* Microsoft Reference Implementation for TPM 2.0 | |
* | |
* The copyright in this software is being made available under the BSD License, | |
* included below. This software may be subject to other third party and | |
* contributor rights, including patent rights, and no such rights are granted | |
* under this license. | |
* | |
* Copyright (c) Microsoft Corporation | |
* | |
* All rights reserved. | |
* | |
* BSD License | |
* | |
* Redistribution and use in source and binary forms, with or without modification, | |
* are permitted provided that the following conditions are met: | |
* | |
* Redistributions of source code must retain the above copyright notice, this list | |
* of conditions and the following disclaimer. | |
* | |
* Redistributions in binary form must reproduce the above copyright notice, this | |
* list of conditions and the following disclaimer in the documentation and/or | |
* other materials provided with the distribution. | |
* | |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" | |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | |
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
*/ | |
// This is a vector for testing either encrypt or decrypt. The premise for decrypt | |
// is that the IV for decryption is the same as the IV for encryption. However, | |
// the ivOut value may be different for encryption and decryption. We will encrypt | |
// at least two blocks. This means that the chaining value will be used for each | |
// of the schemes (if any) and that implicitly checks that the chaining value | |
// is handled properly. | |
#if AES_128 | |
const BYTE key_AES128 [] = { | |
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, | |
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}; | |
const BYTE dataIn_AES128 [] = { | |
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, | |
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, | |
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, | |
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51}; | |
const BYTE dataOut_AES128_ECB [] = { | |
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60, | |
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97, | |
0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d, | |
0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf}; | |
const BYTE dataOut_AES128_CBC [] = { | |
0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, | |
0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d, | |
0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee, | |
0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2}; | |
const BYTE dataOut_AES128_CFB [] = { | |
0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20, | |
0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a, | |
0xc8, 0xa6, 0x45, 0x37, 0xa0, 0xb3, 0xa9, 0x3f, | |
0xcd, 0xe3, 0xcd, 0xad, 0x9f, 0x1c, 0xe5, 0x8b}; | |
const BYTE dataOut_AES128_OFB [] = { | |
0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20, | |
0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a, | |
0x77, 0x89, 0x50, 0x8d, 0x16, 0x91, 0x8f, 0x03, | |
0xf5, 0x3c, 0x52, 0xda, 0xc5, 0x4e, 0xd8, 0x25}; | |
const BYTE dataOut_AES128_CTR [] = { | |
0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26, | |
0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce, | |
0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff, | |
0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff}; | |
#endif | |
#if AES_192 | |
const BYTE key_AES192 [] = { | |
0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, | |
0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, | |
0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b}; | |
const BYTE dataIn_AES192 [] = { | |
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, | |
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, | |
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, | |
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51}; | |
const BYTE dataOut_AES192_ECB [] = { | |
0xbd, 0x33, 0x4f, 0x1d, 0x6e, 0x45, 0xf2, 0x5f, | |
0xf7, 0x12, 0xa2, 0x14, 0x57, 0x1f, 0xa5, 0xcc, | |
0x97, 0x41, 0x04, 0x84, 0x6d, 0x0a, 0xd3, 0xad, | |
0x77, 0x34, 0xec, 0xb3, 0xec, 0xee, 0x4e, 0xef}; | |
const BYTE dataOut_AES192_CBC [] = { | |
0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d, | |
0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8, | |
0xb4, 0xd9, 0xad, 0xa9, 0xad, 0x7d, 0xed, 0xf4, | |
0xe5, 0xe7, 0x38, 0x76, 0x3f, 0x69, 0x14, 0x5a}; | |
const BYTE dataOut_AES192_CFB [] = { | |
0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab, | |
0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74, | |
0x67, 0xce, 0x7f, 0x7f, 0x81, 0x17, 0x36, 0x21, | |
0x96, 0x1a, 0x2b, 0x70, 0x17, 0x1d, 0x3d, 0x7a}; | |
const BYTE dataOut_AES192_OFB [] = { | |
0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab, | |
0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74, | |
0xfc, 0xc2, 0x8b, 0x8d, 0x4c, 0x63, 0x83, 0x7c, | |
0x09, 0xe8, 0x17, 0x00, 0xc1, 0x10, 0x04, 0x01}; | |
const BYTE dataOut_AES192_CTR [] = { | |
0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, | |
0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b, | |
0x09, 0x03, 0x39, 0xec, 0x0a, 0xa6, 0xfa, 0xef, | |
0xd5, 0xcc, 0xc2, 0xc6, 0xf4, 0xce, 0x8e, 0x94}; | |
#endif | |
#if AES_256 | |
const BYTE key_AES256 [] = { | |
0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, | |
0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, | |
0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, | |
0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4}; | |
const BYTE dataIn_AES256 [] = { | |
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, | |
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, | |
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, | |
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51}; | |
const BYTE dataOut_AES256_ECB [] = { | |
0xf3, 0xee, 0xd1, 0xbd, 0xb5, 0xd2, 0xa0, 0x3c, | |
0x06, 0x4b, 0x5a, 0x7e, 0x3d, 0xb1, 0x81, 0xf8, | |
0x59, 0x1c, 0xcb, 0x10, 0xd4, 0x10, 0xed, 0x26, | |
0xdc, 0x5b, 0xa7, 0x4a, 0x31, 0x36, 0x28, 0x70}; | |
const BYTE dataOut_AES256_CBC [] = { | |
0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba, | |
0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6, | |
0x9c, 0xfc, 0x4e, 0x96, 0x7e, 0xdb, 0x80, 0x8d, | |
0x67, 0x9f, 0x77, 0x7b, 0xc6, 0x70, 0x2c, 0x7d}; | |
const BYTE dataOut_AES256_CFB [] = { | |
0xdc, 0x7e, 0x84, 0xbf, 0xda, 0x79, 0x16, 0x4b, | |
0x7e, 0xcd, 0x84, 0x86, 0x98, 0x5d, 0x38, 0x60, | |
0x39, 0xff, 0xed, 0x14, 0x3b, 0x28, 0xb1, 0xc8, | |
0x32, 0x11, 0x3c, 0x63, 0x31, 0xe5, 0x40, 0x7b}; | |
const BYTE dataOut_AES256_OFB [] = { | |
0xdc, 0x7e, 0x84, 0xbf, 0xda, 0x79, 0x16, 0x4b, | |
0x7e, 0xcd, 0x84, 0x86, 0x98, 0x5d, 0x38, 0x60, | |
0x4f, 0xeb, 0xdc, 0x67, 0x40, 0xd2, 0x0b, 0x3a, | |
0xc8, 0x8f, 0x6a, 0xd8, 0x2a, 0x4f, 0xb0, 0x8d}; | |
const BYTE dataOut_AES256_CTR [] = { | |
0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, | |
0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28, | |
0xf4, 0x43, 0xe3, 0xca, 0x4d, 0x62, 0xb5, 0x9a, | |
0xca, 0x84, 0xe9, 0x90, 0xca, 0xca, 0xf5, 0xc5}; | |
#endif | |