Is there any simple kernel source that I can modify and use it?
The Intel RDRAND processor RDRAND pretty easy to understand. You can find its sources:
openssl-1.0.1f$ grep -R -i ENGINE_rdrand * crypto/engine/eng_rdrand.c:static ENGINE *ENGINE_rdrand(void) crypto/engine/eng_rdrand.c: ENGINE *toadd = ENGINE_rdrand();
Here you can download and install it as the default random number generator mechanism (from Random Numbers | Hardware ):
unsigned long err = 0; int rc = 0; OPENSSL_cpuid_setup(); ENGINE_load_rdrand(); ENGINE* eng = ENGINE_by_id("rdrand"); err = ERR_get_error(); if(NULL == eng) { fprintf(stderr, "ENGINE_load_rdrand failed, err = 0x%lx\n", err); abort(); } rc = ENGINE_init(eng); err = ERR_get_error(); if(0 == rc) { fprintf(stderr, "ENGINE_init failed, err = 0x%lx\n", err); abort(); } rc = ENGINE_set_default(eng, ENGINE_METHOD_RAND); err = ERR_get_error(); if(0 == rc) { fprintf(stderr, "ENGINE_set_default failed, err = 0x%lx\n", err); abort(); } ... ENGINE_finish(eng); ENGINE_free(eng);
jww
source share