static PRUint8 rsa_exponent1[FIPS_RSA_EXPONENT1_LENGTH] = {
static const PRUint8 rsa_exponent1[FIPS_RSA_EXPONENT1_LENGTH] = {
pk11_fips_RSA_PowerUpSelfTest( void ){    /* RSA Known Modulus used in both Public/Private Key Values (520-bits). */    static PRUint8 rsa_modulus[FIPS_RSA_MODULUS_LENGTH] = {                                 0x00,0xa1,0xe9,0x5e,0x66,0x88,0xe2,0xf2,                                 0x2b,0xe7,0x70,0x36,0x33,0xbc,0xeb,0x55,                                 0x55,0xf1,0x60,0x18,0x3c,0xfb,0xd2,0x79,                                 0xf6,0xc4,0xb8,0x09,0xe3,0x12,0xf6,0x63,                                 0x6d,0xc7,0x8e,0x19,0xc0,0x0e,0x10,0x78,                                 0xc1,0xfe,0x2a,0x41,0x74,0x2d,0xf7,0xc4,                                 0x69,0xa7,0x3c,0xbc,0x8a,0xc8,0x31,0x2b,                                 0x4f,0x60,0xf0,0xf1,0xec,0x5a,0x29,0xec,                                 0x6b};    /* RSA Known Public Key Values (8-bits). */    static PRUint8 rsa_public_exponent[] = { 0x03 };    /* RSA Known Private Key Values (version                 is   8-bits), */    /*                              (private exponent        is 512-bits), */    /*                              (private prime0          is 264-bits), */    /*                              (private prime1          is 264-bits), */    /*                              (private prime exponent0 is 264-bits), */    /*                              (private prime exponent1 is 264-bits), */    /*                          and (private coefficient     is 256-bits). */    static PRUint8 rsa_version[] = { 0x00 };    static PRUint8 rsa_private_exponent[FIPS_RSA_PRIVATE_EXPONENT_LENGTH] = {				  0x6b,0xf0,0xe9,0x99,0xb0,0x97,0x4c,0x1d,				  0x44,0xf5,0x79,0x77,0xd3,0x47,0x8e,0x39,				  0x4b,0x95,0x65,0x7d,0xfd,0x36,0xfb,0xf9,				  0xd8,0x7a,0xb1,0x42,0x0c,0xa4,0x42,0x48,				  0x20,0x1c,0x6b,0x7d,0x5d,0xa3,0x58,0xd6,				  0x95,0xd6,0x41,0xe3,0xd6,0x73,0xad,0xdb,				  0x3b,0x89,0x00,0x8a,0xcd,0x1d,0xb9,0x06,				  0xac,0xac,0x0e,0x02,0x72,0x1c,0xf8,0xab };    static PRUint8 rsa_prime0[FIPS_RSA_PRIME0_LENGTH]   = {				      0x00,0xd2,0x2c,0x9d,0xef,0x7c,0x8f,0x58,				      0x93,0x19,0xa1,0x77,0x0e,0x38,0x3e,0x85,				      0xb4,0xaf,0xcc,0x99,0xa5,0x43,0xbf,0x97,				      0xdc,0x46,0xb8,0x3f,0x6e,0x85,0x18,0x00,				      0x81};    static PRUint8 rsa_prime1[FIPS_RSA_PRIME1_LENGTH]   = {				      0x00,0xc5,0x36,0xda,0x94,0x85,0x0c,0x1a,				      0xed,0x03,0xc7,0x67,0x90,0x34,0x0b,0xb9,				      0xec,0x1e,0x22,0xa2,0x15,0x50,0xc4,0xfd,				      0xe9,0x17,0x36,0x9d,0x7a,0x29,0xe6,0x76,				      0xeb};    static PRUint8 rsa_exponent0[FIPS_RSA_EXPONENT0_LENGTH] = {					 0x00,0x8c,0x1d,0xbe,0x9f,0xa8,					 0x5f,0x90,0x62,0x11,0x16,0x4f,					 0x5e,0xd0,0x29,0xae,0x78,0x75,					 0x33,0x11,0x18,0xd7,0xd5,0x0f,					 0xe8,0x2f,0x25,0x7f,0x9f,0x03,					 0x65,0x55,0xab};    static PRUint8 rsa_exponent1[FIPS_RSA_EXPONENT1_LENGTH] = {					 0x00,0x83,0x79,0xe7,0x0d,0xae,					 0x08,0x11,0xf3,0x57,0xda,0x45,					 0x0a,0xcd,0x5d,0x26,0x9d,0x69,					 0x6c,0x6c,0x0e,0x35,0xd8,0xa9,					 0x46,0x0f,0x79,0xbe,0x51,0x71,					 0x44,0x4f,0x47};    static PRUint8 rsa_coefficient[FIPS_RSA_COEFFICIENT_LENGTH] = {					 0x54,0x8d,0xb8,0xdc,0x8b,0xde,0xbb,					 0x08,0xc9,0x67,0xb7,0xa9,0x5f,0xa5,					 0xc4,0x5e,0x67,0xaa,0xfe,0x1a,0x08,					 0xeb,0x48,0x43,0xcb,0xb0,0xb9,0x38,					 0x3a,0x31,0x39,0xde};    /* RSA Known Plaintext (512-bits). */    static PRUint8 rsa_known_plaintext[] = {                                         "Known plaintext utilized for RSA"                                         " Encryption and Decryption test." };    /* RSA Known Ciphertext (512-bits). */    static PRUint8 rsa_known_ciphertext[] = {				      0x12,0x80,0x3a,0x53,0xee,0x93,0x81,0xa5,				      0xf7,0x40,0xc5,0xb1,0xef,0xd9,0x27,0xaf,				      0xef,0x4b,0x87,0x44,0x00,0xd0,0xda,0xcf,				      0x10,0x57,0x4c,0xd5,0xc3,0xed,0x84,0xdc,				      0x74,0x03,0x19,0x69,0x2c,0xd6,0x54,0x3e,				      0xd2,0xe3,0x90,0xb6,0x67,0x91,0x2f,0x1f,				      0x54,0x13,0x99,0x00,0x0b,0xfd,0x52,0x7f,				      0xd8,0xc6,0xdb,0x8a,0xfe,0x06,0xf3,0xb1};    /* RSA Known Message (128-bits). */    static PRUint8 rsa_known_message[]  = { "Netscape Forever" };    /* RSA Known Signed Hash (512-bits). */    static PRUint8 rsa_known_signature[] = {				     0x27,0x23,0xa6,0x71,0x57,0xc8,0x70,0x5f,				     0x70,0x0e,0x06,0x7b,0x96,0x6a,0xaa,0x41,				     0x6e,0xab,0x67,0x4b,0x5f,0x76,0xc4,0x53,				     0x23,0xd7,0x57,0x7a,0x3a,0xbc,0x4c,0x27,				     0x65,0xca,0xde,0x9f,0xd3,0x1d,0xa4,0x5a,				     0xf9,0x8f,0xb2,0x05,0xa3,0x86,0xf9,0x66,				     0x55,0x4c,0x68,0x50,0x66,0xa4,0xe9,0x17,				     0x45,0x11,0xb8,0x1a,0xfc,0xbc,0x79,0x3b};    static RSAPublicKey    bl_public_key = { NULL,       { FIPS_RSA_TYPE, rsa_modulus,         FIPS_RSA_MODULUS_LENGTH },      { FIPS_RSA_TYPE, rsa_public_exponent, FIPS_RSA_PUBLIC_EXPONENT_LENGTH }    };    static RSAPrivateKey   bl_private_key = { NULL,      { FIPS_RSA_TYPE, rsa_version,          FIPS_RSA_PRIVATE_VERSION_LENGTH },      { FIPS_RSA_TYPE, rsa_modulus,          FIPS_RSA_MODULUS_LENGTH },      { FIPS_RSA_TYPE, rsa_public_exponent,  FIPS_RSA_PUBLIC_EXPONENT_LENGTH },      { FIPS_RSA_TYPE, rsa_private_exponent, FIPS_RSA_PRIVATE_EXPONENT_LENGTH },      { FIPS_RSA_TYPE, rsa_prime0,           FIPS_RSA_PRIME0_LENGTH },      { FIPS_RSA_TYPE, rsa_prime1,           FIPS_RSA_PRIME1_LENGTH },      { FIPS_RSA_TYPE, rsa_exponent0,        FIPS_RSA_EXPONENT0_LENGTH },      { FIPS_RSA_TYPE, rsa_exponent1,        FIPS_RSA_EXPONENT1_LENGTH },      { FIPS_RSA_TYPE, rsa_coefficient,      FIPS_RSA_COEFFICIENT_LENGTH }    };    /* RSA variables. */#ifdef CREATE_TEMP_ARENAS    PLArenaPool *         rsa_public_arena;    PLArenaPool *         rsa_private_arena;#endif    NSSLOWKEYPublicKey *  rsa_public_key;    NSSLOWKEYPrivateKey * rsa_private_key;    unsigned int          rsa_bytes_signed;    SECStatus             rsa_status;    NSSLOWKEYPublicKey    low_public_key   = { NULL, NSSLOWKEYRSAKey, };    NSSLOWKEYPrivateKey   low_private_key  = { NULL, NSSLOWKEYRSAKey, };    PRUint8               rsa_computed_ciphertext[FIPS_RSA_ENCRYPT_LENGTH];    PRUint8               rsa_computed_plaintext[FIPS_RSA_DECRYPT_LENGTH];    PRUint8               rsa_computed_signature[FIPS_RSA_SIGNATURE_LENGTH];    /****************************************/    /* Compose RSA Public/Private Key Pair. */    /****************************************/    low_public_key.u.rsa  = bl_public_key;    low_private_key.u.rsa = bl_private_key;    rsa_public_key  = &low_public_key;    rsa_private_key = &low_private_key;#ifdef CREATE_TEMP_ARENAS    /* Create some space for the RSA public key. */    rsa_public_arena = PORT_NewArena( NSS_SOFTOKEN_DEFAULT_CHUNKSIZE );    if( rsa_public_arena == NULL ) {        PORT_SetError( SEC_ERROR_NO_MEMORY );        return( CKR_HOST_MEMORY );    }    /* Create some space for the RSA private key. */    rsa_private_arena = PORT_NewArena( NSS_SOFTOKEN_DEFAULT_CHUNKSIZE );    if( rsa_private_arena == NULL ) {        PORT_FreeArena( rsa_public_arena, PR_TRUE );        PORT_SetError( SEC_ERROR_NO_MEMORY );        return( CKR_HOST_MEMORY );    }    rsa_public_key->arena = rsa_public_arena;    rsa_private_key->arena = rsa_private_arena;#endif    /**************************************************/    /* RSA Single-Round Known Answer Encryption Test. */    /**************************************************/    /* Perform RSA Public Key Encryption. */    rsa_status = RSA_PublicKeyOp(&rsa_public_key->u.rsa,                                  rsa_computed_ciphertext, rsa_known_plaintext);    if( ( rsa_status != SECSuccess ) ||        ( PORT_Memcmp( rsa_computed_ciphertext, rsa_known_ciphertext,                       FIPS_RSA_ENCRYPT_LENGTH ) != 0 ) )        goto rsa_loser;    /**************************************************/    /* RSA Single-Round Known Answer Decryption Test. */    /**************************************************/    /* Perform RSA Private Key Decryption. */    rsa_status = RSA_PrivateKeyOp(&rsa_private_key->u.rsa,                                   rsa_computed_plaintext, rsa_known_ciphertext);    if( ( rsa_status != SECSuccess ) ||        ( PORT_Memcmp( rsa_computed_plaintext, rsa_known_plaintext,                       FIPS_RSA_DECRYPT_LENGTH ) != 0 ) )        goto rsa_loser;    /*************************************************/    /* RSA Single-Round Known Answer Signature Test. */    /*************************************************/    /* Perform RSA signature with the RSA private key. */    rsa_status = RSA_Sign( rsa_private_key, rsa_computed_signature,                           &rsa_bytes_signed,                           FIPS_RSA_SIGNATURE_LENGTH, rsa_known_message,                           FIPS_RSA_MESSAGE_LENGTH );    if( ( rsa_status != SECSuccess ) ||        ( rsa_bytes_signed != FIPS_RSA_SIGNATURE_LENGTH ) ||        ( PORT_Memcmp( rsa_computed_signature, rsa_known_signature,                       FIPS_RSA_SIGNATURE_LENGTH ) != 0 ) )        goto rsa_loser;    /****************************************************/    /* RSA Single-Round Known Answer Verification Test. */    /****************************************************/    /* Perform RSA verification with the RSA public key. */    rsa_status = RSA_CheckSign( rsa_public_key,                                rsa_computed_signature,                                FIPS_RSA_SIGNATURE_LENGTH,                                rsa_known_message,                                FIPS_RSA_MESSAGE_LENGTH );    if( rsa_status != SECSuccess )        goto rsa_loser;    /* Dispose of all RSA key material. */    nsslowkey_DestroyPublicKey( rsa_public_key );    nsslowkey_DestroyPrivateKey( rsa_private_key );    return( CKR_OK );rsa_loser:    nsslowkey_DestroyPublicKey( rsa_public_key );    nsslowkey_DestroyPrivateKey( rsa_private_key );    return( CKR_DEVICE_ERROR );}