/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2003-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Phong Vo <kpv@research.att.com> *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#include "vctest.h"
#include "vccrypto.h"
/* Data from Appendix B of FIPS-193.pdf */
{ 0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d,
0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34
};
{ 0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d,
0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34,
0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d,
0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34
};
{ 0x39, 0x25, 0x84, 0x1d, 0x02, 0xdc, 0x09, 0xfb,
0xdc, 0x11, 0x85, 0x97, 0x19, 0x6a, 0x0b, 0x32
};
{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
};
{ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c,
0xa0, 0xfa, 0xfe, 0x17, 0x88, 0x54, 0x2c, 0xb1,
0x23, 0xa3, 0x39, 0x39, 0x2a, 0x6c, 0x76, 0x05,
0xf2, 0xc2, 0x95, 0xf2, 0x7a, 0x96, 0xb9, 0x43,
0x59, 0x35, 0x80, 0x7a, 0x73, 0x59, 0xf6, 0x7f,
0x3d, 0x80, 0x47, 0x7d, 0x47, 0x16, 0xfe, 0x3e,
0x1e, 0x23, 0x7e, 0x44, 0x6d, 0x7a, 0x88, 0x3b,
0xef, 0x44, 0xa5, 0x41, 0xa8, 0x52, 0x5b, 0x7f,
0xb6, 0x71, 0x25, 0x3b, 0xdb, 0x0b, 0xad, 0x00,
0xd4, 0xd1, 0xc6, 0xf8, 0x7c, 0x83, 0x9d, 0x87,
0xca, 0xf2, 0xb8, 0xbc, 0x11, 0xf9, 0x15, 0xbc,
0x6d, 0x88, 0xa3, 0x7a, 0x11, 0x0b, 0x3e, 0xfd,
0xdb, 0xf9, 0x86, 0x41, 0xca, 0x00, 0x93, 0xfd,
0x4e, 0x54, 0xf7, 0x0e, 0x5f, 0x5f, 0xc9, 0xf3,
0x84, 0xa6, 0x4f, 0xb2, 0x4e, 0xa6, 0xdc, 0x4f,
0xea, 0xd2, 0x73, 0x21, 0xb5, 0x8d, 0xba, 0xd2,
0x31, 0x2b, 0xf5, 0x60, 0x7f, 0x8d, 0x29, 0x2f,
0xac, 0x77, 0x66, 0xf3, 0x19, 0xfa, 0xdc, 0x21,
0x28, 0xd1, 0x29, 0x41, 0x57, 0x5c, 0x00, 0x6e,
0xd0, 0x14, 0xf9, 0xa8, 0xc9, 0xee, 0x25, 0x89,
0xe1, 0x3f, 0x0c, 0xc8, 0xb6, 0x63, 0x0c, 0xa6
};
int main()
{
/* test the subpackage for encryption */
terror("Initializing encryption handle");
terror("Encrypting test data");
/* save data in case buffer gets destroyed */
terror("Wrong decrypted size");
terror("Wrong decrypted data");
/* test transform */
terror("Can't open encryption handle");
terror("Can't open decryption handle");
for(k = 0; k < 4; ++k)
terror("Encryption error");
terror("Decryption error");
terror("Wrong decrypted size");
terror("Wrong decrypted data");
}
/* test chained blocks */
terror("Can't open encryption handle");
terror("Can't open decryption handle");
for(k = 0; k < 4; ++k)
terror("Encryption error");
terror("Decryption error");
terror("Wrong decrypted size");
terror("Wrong decrypted data");
}
/* test 128-bit transform with use of password */
terror("Can't open encryption handle");
terror("Can't open decryption handle");
for(k = 0; k < 4; ++k)
terror("Encryption error");
terror("Decryption error");
terror("Wrong decrypted size");
terror("Wrong decrypted data");
}
/* test 192-bit transform with use of password */
terror("Can't open encryption handle");
terror("Can't open decryption handle");
for(k = 0; k < 4; ++k)
terror("Encryption error");
terror("Decryption error");
terror("Wrong decrypted size");
terror("Wrong decrypted data");
}
/* test 256-bit transform with use of password */
terror("Can't open encryption handle");
terror("Can't open decryption handle");
for(k = 0; k < 4; ++k)
terror("Encryption error");
terror("Decryption error");
terror("Wrong decrypted size");
terror("Wrong decrypted data");
}
exit(0);
}