//====================================================================== // // test-sha256.c // ------------- // test program for Cryptech Novena framwwork with EIM interface // using the sha256 core. // //====================================================================== //------------------------------------------------------------------------------ // Headers //------------------------------------------------------------------------------ #include #include #include #include "novena-eim.h" //------------------------------------------------------------------------------ // Defines //------------------------------------------------------------------------------ #define SHA256_PREFIX (0x14) #define SHA_BASE (EIM_BASE_ADDR + SHA256_PREFIX) //------------------------------------------------------------------------------ // Testing Parameters //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // main() //------------------------------------------------------------------------------ int main() { unsigned int read_addr; unsigned int read_data; // try to setup eim (return value should be 1) printf("Configuring EIM .. "); int ok = eim_setup(); if (ok < 1) { printf("ERROR\n"); return EXIT_FAILURE; } else { printf("EIM Setup ok.\n"); } // Dump register contents. See if we have the core. for (unsigned int i = 0 ; i < 100 ; i += 3) { read_addr = SHA_BASE + i; eim_read_32(read_addr, &read_data); printf("address 0x%08x = 0x%08x\n", read_addr, read_data); } return 0; } //====================================================================== // EOF test-sha256.c //======================================================================