Bug 499385 - DRBG Reseed function needs to be tested on POST

r= nelson


git-svn-id: svn://10.0.0.236/trunk@257540 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rrelyea%redhat.com 2009-06-19 23:05:48 +00:00
parent 793b5b3215
commit 3623df413c

View File

@ -36,7 +36,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* $Id: fipstest.c,v 1.26 2009-06-05 17:01:57 glen.beasley%sun.com Exp $ */
/* $Id: fipstest.c,v 1.27 2009-06-19 23:05:48 rrelyea%redhat.com Exp $ */
#include "softoken.h" /* Required for RC2-ECB, RC2-CBC, RC4, DES-ECB, */
/* DES-CBC, DES3-ECB, DES3-CBC, RSA */
@ -1936,7 +1936,7 @@ sftk_fips_RNG_PowerUpSelfTest( void )
0x7f,0x7e,0xc8,0xae,0x9c,0x09,0x99,0x7d,
0xbb,0x9e,0x48,0x7f,0xbb,0x96,0x46,0xb3,
0x03,0x75,0xf8,0xc8,0x69,0x45,0x3f,0x97,
0x5e,0x2e,0x48,0xe1,0x5d,0x58,0x97,0x4c};
0x5e,0x2e,0x48,0xe1,0x5d,0x58,0x97,0x4c };
static const PRUint8 rng_known_result[] = {
0x16,0xe1,0x8c,0x57,0x21,0xd8,0xf1,0x7e,
0x5a,0xa0,0x16,0x0b,0x7e,0xa6,0x25,0xb4,
@ -1944,67 +1944,36 @@ sftk_fips_RNG_PowerUpSelfTest( void )
0xbb,0xaa,0x2a,0x1b,0x22,0x33,0x2e,0x4a,
0x14,0x07,0x9d,0x52,0xfc,0x73,0x61,0x48,
0xac,0xc1,0x22,0xfc,0xa4,0xfc,0xac,0xa4,
0xdb,0xda,0x5b,0x27,0x33,0xc4,0xb3,0xec,
0xb0,0xf2,0xee,0x63,0x11,0x61,0xdb,0x30,
0xd3,0x04,0x6b,0x96,0x22,0x1e,0x17,0x24,
0x1a,0x54,0x70,0xf3,0x4d,0x1c,0x6a,0xb0,
0xf9,0xe3,0xc8,0x07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,0xa5,0xb6,0x4d,
0xc2,0x9f,0x9b,0xde,0xa3,0xda,0x67,0x0e,
0xd9,0x4b,0xfd,0x29,0xba,0x16,0x4e,0x03,
0xe9,0x04,0x9a,0x67,0xf8,0xc4,0xb7,0x01,
0xba,0x3c,0x5f,0xdd,0x8e,0x56,0xf3,0xea,
0xf4,0xfb,0x75,0x76,0x30,0x20,0xe6,0xec,
0x44,0xc9,0x76,0xb2,0x21,0x0c,0x1c,0xb9,
0x5f,0x27,0xff,0x09,0x45,0x2c,0x26,0xfd,
0x27,0xb0,0xca,0x67,0xd3,0xb0,0x77,0x3e,
0x10,0x46,0xdd,0x81,0x70,0x47,0x5c,0x12,
0xe7,0x37,0x49,0x17,0xf5,0x04,0xbc,0x62,
0xef,0xba,0x6e,0x1d,0xb9,0x42,0xb5,0xf9,
0xda,0x2f,0x5b,0x05,0xa7,0x34,0x19,0xf6,
0xa4,0xdb,0x45,0xb0,0x18,0x6b,0x32,0x75,
0x0f,0x34,0xc8,0x1c,0x14,0xca,0x4f,0xf9,
0x43,0x76,0xa5,0x41,0xeb,0xd4,0x37,0xc9,
0xc8,0x94,0xe7,0x0f,0x4a,0xa1,0x72,0xc7,
0x48,0xbd,0x1c,0x84,0x74,0x73,0xd1,0x73,
0xcd,0x1e,0xf0,0xb9,0x66,0x00,0x63,0xab};
0xdb,0xda,0x5b,0x27,0x33,0xc4,0xb3 };
static const PRUint8 reseed_entropy[] = {
0xc6,0x0b,0x0a,0x30,0x67,0x07,0xf4,0xe2,
0x24,0xa7,0x51,0x6f,0x5f,0x85,0x3e,0x5d,
0x67,0x97,0xb8,0x3b,0x30,0x9c,0x7a,0xb1,
0x52,0xc6,0x1b,0xc9,0x46,0xa8,0x62,0x79 };
static const PRUint8 additional_input[] = {
0x86,0x82,0x28,0x98,0xe7,0xcb,0x01,0x14,
0xae,0x87,0x4b,0x1d,0x99,0x1b,0xc7,0x41,
0x33,0xff,0x33,0x66,0x40,0x95,0x54,0xc6,
0x67,0x4d,0x40,0x2a,0x1f,0xf9,0xeb,0x65 };
static const PRUint8 rng_reseed_result[] = {
0x02,0x0c,0xc6,0x17,0x86,0x49,0xba,0xc4,
0x7b,0x71,0x35,0x05,0xf0,0xdb,0x4a,0xc2,
0x2c,0x38,0xc1,0xa4,0x42,0xe5,0x46,0x4a,
0x7d,0xf0,0xbe,0x47,0x88,0xb8,0x0e,0xc6,
0x25,0x2b,0x1d,0x13,0xef,0xa6,0x87,0x96,
0xa3,0x7d,0x5b,0x80,0xc2,0x38,0x76,0x61,
0xc7,0x80,0x5d,0x0f,0x05,0x76,0x85 };
static const PRUint8 Q[] = {
0x85,0x89,0x9c,0x77,0xa3,0x79,0xff,0x1a,
0x86,0x6f,0x2f,0x3e,0x2e,0xf9,0x8c,0x9c,
0x9d,0xef,0xeb,0xed};
static const PRUint8 GENX[] = {
static const PRUint8 GENX[] = {
0x65,0x48,0xe3,0xca,0xac,0x64,0x2d,0xf7,
0x7b,0xd3,0x4e,0x79,0xc9,0x7d,0xa6,0xa8,
0xa2,0xc2,0x1f,0x8f,0xe9,0xb9,0xd3,0xa1,
0x3f,0xf7,0x0c,0xcd,0xa6,0xca,0xbf,0xce,
0x84,0x0e,0xb6,0xf1,0x0d,0xbe,0xa9,0xa3};
static const PRUint8 rng_known_DSAX[] = {
static const PRUint8 rng_known_DSAX[] = {
0x7a,0x86,0xf1,0x7f,0xbd,0x4e,0x6e,0xd9,
0x0a,0x26,0x21,0xd0,0x19,0xcb,0x86,0x73,
0x10,0x1f,0x60,0xd7};
@ -2012,6 +1981,7 @@ sftk_fips_RNG_PowerUpSelfTest( void )
SECStatus rng_status = SECSuccess;
PR_STATIC_ASSERT(sizeof(rng_known_result) >= sizeof(rng_reseed_result));
PRUint8 result[sizeof(rng_known_result)];
PRUint8 DSAX[FIPS_DSA_SUBPRIME_LENGTH];
@ -2023,10 +1993,24 @@ sftk_fips_RNG_PowerUpSelfTest( void )
if (rng_status != SECSuccess) {
return ( CKR_DEVICE_ERROR );
}
rng_status = PRNGTEST_Generate(result, sizeof result, NULL, 0);
rng_status = PRNGTEST_Generate(result, sizeof rng_known_result, NULL, 0);
if ( ( rng_status != SECSuccess) ||
( PORT_Memcmp( result, rng_known_result,
sizeof result ) != 0 ) ) {
sizeof rng_known_result ) != 0 ) ) {
PRNGTEST_Uninstantiate();
return ( CKR_DEVICE_ERROR );
}
rng_status = PRNGTEST_Reseed(reseed_entropy, sizeof reseed_entropy,
additional_input, sizeof additional_input);
if (rng_status != SECSuccess) {
PRNGTEST_Uninstantiate();
return ( CKR_DEVICE_ERROR );
}
rng_status = PRNGTEST_Generate(result, sizeof rng_reseed_result, NULL, 0);
if ( ( rng_status != SECSuccess) ||
( PORT_Memcmp( result, rng_reseed_result,
sizeof rng_reseed_result ) != 0 ) ) {
PRNGTEST_Uninstantiate();
return ( CKR_DEVICE_ERROR );
}
rng_status = PRNGTEST_Uninstantiate();