Carries out a NIST SP800-90 health check and FIPS140-2 statistical tests on the random number generator.
Public Declare Function RNG_Test Lib "diCrPKI.dll" (ByVal strFileName As String, ByVal nOptions As Long) As Long
nRet = RNG_Test(strFileName, nOptions)
long __stdcall RNG_Test(const char *szFileOut, long nOptions);
If successful, the return value is zero; otherwise it returns a nonzero error code.
This function carries out, on demand, the health testing procedure from section 11.3 of
[SP80090A] and the statistical tests for randomness from
section 4.9.1 of the October 2001 version of FIPS-140-2 [FIPS140].
The statistical test results and the 20,000-bit sample are written to a text file.
Specify an empty (""
) or NULL szFileName to avoid creating an output file and just
carry out the tests. The statistical tests have since been removed from FIPS-140-2, but we do them anyway.
If any tests fail, a nonzero error code will be returned.
Dim strFileName As String
Dim nRet As Long
strFileName = "pkiFips140.txt"
nRet = RNG_Test(strFileName, 0)
Debug.Print "RNG_Test('" & strFileName & "') returns " & nRet & " (expecting 0)"