10 #include <gnutls/gnutls.h>
11 #include <gnutls/crypto.h>
12 #include "../lib/random.h"
14 void mylogfn( int level
, const char*ptr
)
16 printf ("Got Logs: ");
21 int rng_init( void** ctx
)
26 int rng_rnd ( void* ctx
, int level
, void* data
, int datasize
)
28 memset(data
, 1,datasize
);
32 void rng_deinit( void* ctx
)
43 gnutls_crypto_rnd_st rng
= { rng_init
, rng_rnd
, rng_deinit
};
46 rc
= gnutls_crypto_rnd_register (0, &rng
);
48 gnutls_global_init ();
50 memset(buf2
, 1, sizeof(buf2
));
52 _gnutls_rnd(GNUTLS_RND_KEY
, buf1
, sizeof(buf1
));
54 if (memcmp( buf1
, buf2
, sizeof(buf1
))!=0)
57 gnutls_global_deinit ();
60 success("rng registered ok\n");
62 fail ("rng register test failed: %d\n", rc
);