security/nss/lib/freebl/mpi/utils/bbsrand.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/lib/freebl/mpi/utils/bbsrand.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +/*
     1.5 + *  bbsrand.c
     1.6 + *
     1.7 + *  Test driver for routines in bbs_rand.h
     1.8 + *
     1.9 + * This Source Code Form is subject to the terms of the Mozilla Public
    1.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this
    1.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.12 +
    1.13 +#include <stdio.h>
    1.14 +#include <stdlib.h>
    1.15 +#include <string.h>
    1.16 +#include <time.h>
    1.17 +#include <limits.h>
    1.18 +
    1.19 +#include "bbs_rand.h"
    1.20 +
    1.21 +#define NUM_TESTS   100
    1.22 +
    1.23 +int main(void)
    1.24 +{
    1.25 +  unsigned int   seed, result, ix;
    1.26 +
    1.27 +  seed = time(NULL);
    1.28 +  bbs_srand((unsigned char *)&seed, sizeof(seed));
    1.29 +
    1.30 +  for(ix = 0; ix < NUM_TESTS; ix++) {
    1.31 +    result = bbs_rand();
    1.32 +    
    1.33 +    printf("Test %3u: %08X\n", ix + 1, result);
    1.34 +  }
    1.35 +
    1.36 +  return 0;
    1.37 +}

mercurial