Commit a5ad942b authored by Ben Laurie's avatar Ben Laurie
Browse files

Improve selftests, check for stuck PRNG(!).

parent 0ae3ca9e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ void ERR_load_RAND_strings(void);
/* Reason codes. */
#define RAND_R_NON_FIPS_METHOD				 101
#define RAND_R_PRNG_NOT_SEEDED				 100
#define RAND_R_PRNG_STUCK				 102

#ifdef  __cplusplus
}
+2 −1
Original line number Diff line number Diff line
/* crypto/rand/rand_err.c */
/* ====================================================================
 * Copyright (c) 1999-2002 The OpenSSL Project.  All rights reserved.
 * Copyright (c) 1999-2003 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
@@ -76,6 +76,7 @@ static ERR_STRING_DATA RAND_str_reasons[]=
	{
{RAND_R_NON_FIPS_METHOD                  ,"non fips method"},
{RAND_R_PRNG_NOT_SEEDED                  ,"PRNG not seeded"},
{RAND_R_PRNG_STUCK                       ,"prng stuck"},
{0,NULL}
	};

+1 −1
Original line number Diff line number Diff line
SHA1(fips_aes_core.c)= 4cad001926dce3593181541ea19207256593171a
SHA1(fips_aes_selftest.c)= b41f520aa90f813de815ee77ade4e7c73ef147b0
SHA1(fips_aes_selftest.c)= 8f270e559d34a18b3771d7f0098b77dd7bf168c5
SHA1(fips_aes_locl.h)= a3c01d9a4f9d5211e9e785852f6f1a2febfd73b6
+15 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ int FIPS_selftest_aes()
    {
    int n;

    /* Encrypt and check against known ciphertext */
    for(n=0 ; n < 1 ; ++n)
	{
	AES_KEY key;
@@ -87,6 +88,20 @@ int FIPS_selftest_aes()
	    return 0;
	    }
	}
    /* Decrypt and check against known plaintext */
    for(n=0 ; n < 1 ; ++n)
	{
	AES_KEY key;
	unsigned char buf[16];

	AES_set_decrypt_key(tests[n].key,128,&key);
	AES_decrypt(tests[n].ciphertext,buf,&key);
	if(memcmp(buf,tests[n].plaintext,sizeof buf))
	    {
	    FIPSerr(FIPS_F_FIPS_SELFTEST_AES,FIPS_R_SELFTEST_FAILED);
	    return 0;
	    }
	}
    return 1;
    }
#endif
+1 −1
Original line number Diff line number Diff line
SHA1(fips_des_enc.c)= 41388beadcafe125a8025968ff91b7dc60b96c49
SHA1(fips_des_selftest.c)= d81ee4db762d89cca749138a99100d342f195665
SHA1(fips_des_selftest.c)= 1236ecc25bcbd5ad6af8c396426d6c7783cfe941
SHA1(fips_set_key.c)= 1e3dc1e0d02f0ab4d8fdd5e1f4db284cad1510f4
SHA1(fips_des_locl.h)= a4cf60ca32476a2483b3e4460ec9a19c0444fd20
Loading