URL
https://opencores.org/ocsvn/apbtoaes128/apbtoaes128/trunk
Subversion Repositories apbtoaes128
[/] [apbtoaes128/] [trunk/] [pli/] [aes_monitor.h] - Rev 11
Go to most recent revision | Compare with Previous | Blame | View Log
////////////////////////////////////////////////////////////////// //// //// //// AES CORE BLOCK //// //// //// //// This file is part of the APB to AES128 project //// //// http://www.opencores.org/cores/apbtoaes128/ //// //// //// //// Description //// //// Implementation of APB IP core according to //// //// aes128_spec IP core specification document. //// //// //// //// To Do: Things are right here but always all block can suffer changes //// //// //// //// //// //// Author(s): - Felipe Fernandes Da Costa, fefe2560@gmail.com //// ///////////////////////////////////////////////////////////////// //// //// //// Copyright (C) 2009 Authors and OPENCORES.ORG //// //// //// //// This source file may be used and distributed without //// //// restriction provided that this copyright statement is not //// //// removed from the file and that any derivative work contains //// the original copyright notice and the associated disclaimer. //// //// //// This source file is free software; you can redistribute it //// //// and/or modify it under the terms of the GNU Lesser General //// //// Public License as published by the Free Software Foundation; //// either version 2.1 of the License, or (at your option) any //// //// later version. //// //// //// //// This source is distributed in the hope that it will be //// //// useful, but WITHOUT ANY WARRANTY; without even the implied //// //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //// //// PURPOSE. See the GNU Lesser General Public License for more //// details. //// //// //// //// You should have received a copy of the GNU Lesser General //// //// Public License along with this source; if not, download it //// //// from http://www.opencores.org/lgpl.shtml //// //// /////////////////////////////////////////////////////////////////// static int mon_calltf(char*user_data) { vpiHandle PRESETn = vpi_handle_by_name("AES_GLADIC_tb.PRESETn", NULL); vpiHandle PWDATA = vpi_handle_by_name("AES_GLADIC_tb.PWDATA", NULL); vpiHandle PENABLE = vpi_handle_by_name("AES_GLADIC_tb.PENABLE", NULL); vpiHandle PSEL = vpi_handle_by_name("AES_GLADIC_tb.PSEL", NULL); vpiHandle PWRITE = vpi_handle_by_name("AES_GLADIC_tb.PWRITE", NULL); vpiHandle PADDR = vpi_handle_by_name("AES_GLADIC_tb.PADDR", NULL); vpiHandle PRDATA = vpi_handle_by_name("AES_GLADIC_tb.PRDATA", NULL); vpiHandle PREADY = vpi_handle_by_name("AES_GLADIC_tb.PREADY", NULL); vpiHandle PSLVERR = vpi_handle_by_name("AES_GLADIC_tb.PSLVERR", NULL); vpiHandle int_ccf = vpi_handle_by_name("AES_GLADIC_tb.int_ccf", NULL); vpiHandle int_err = vpi_handle_by_name("AES_GLADIC_tb.int_err", NULL); vpiHandle dma_req_wr = vpi_handle_by_name("AES_GLADIC_tb.dma_req_wr", NULL); vpiHandle dma_req_rd = vpi_handle_by_name("AES_GLADIC_tb.dma_req_rd", NULL); std::random_device rd; std::uniform_int_distribution<long int> data_in(0,4294967295); v_monitor.format=vpiIntVal; v_monitor_catch.format=vpiIntVal; vpi_get_value(PRESETn, &v_monitor); t_monitor.type = vpiScaledRealTime; t_monitor.real = 10; if(v_monitor.value.integer == 1) { vpi_get_value(PENABLE, &v_monitor); if(v_monitor.value.integer == 1) { vpi_get_value(PWRITE, &v_monitor); if(v_monitor.value.integer == 1) { vpi_get_value(PADDR, &v_monitor); if(v_monitor.value.integer == ADDR_AES_KEYR3) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); A=v_monitor_catch.value.integer; INPUT_KEYR[0]=A>>24; INPUT_KEYR[1]=A>>16; INPUT_KEYR[2]=A>>8; INPUT_KEYR[3]=A; } if(v_monitor.value.integer == ADDR_AES_KEYR2) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); B=v_monitor_catch.value.integer; INPUT_KEYR[4]=B>>24; INPUT_KEYR[5]=B>>16; INPUT_KEYR[6]=B>>8; INPUT_KEYR[7]=B; } if(v_monitor.value.integer == ADDR_AES_KEYR1) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); C=v_monitor_catch.value.integer; INPUT_KEYR[8]=C>>24; INPUT_KEYR[9]=C>>16; INPUT_KEYR[10]=C>>8; INPUT_KEYR[11]=C; } if(v_monitor.value.integer == ADDR_AES_KEYR0) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); D=v_monitor_catch.value.integer; INPUT_KEYR[12]=D>>24; INPUT_KEYR[13]=D>>16; INPUT_KEYR[14]=D>>8; INPUT_KEYR[15]=D; //printf("%x%x%x%x\n",INPUT_KEYR[0],INPUT_KEYR[1],INPUT_KEYR[2],INPUT_KEYR[3]); //printf("%x%x%x%x\n",KEYR[0],KEYR[1],KEYR[2],KEYR[3]); } if(v_monitor.value.integer == ADDR_AES_IVR3) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); E=v_monitor_catch.value.integer; INPUT_IVR[0]=E>>24; INPUT_IVR[1]=E>>16; INPUT_IVR[2]=E>>8; INPUT_IVR[3]=E; } if(v_monitor.value.integer == ADDR_AES_IVR2) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); F=v_monitor_catch.value.integer; INPUT_IVR[4]=F>>24; INPUT_IVR[5]=F>>16; INPUT_IVR[6]=F>>8; INPUT_IVR[7]=F; } if(v_monitor.value.integer == ADDR_AES_IVR1) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); G=v_monitor_catch.value.integer; INPUT_IVR[8]=G>>24; INPUT_IVR[9]=G>>16; INPUT_IVR[10]=G>>8; INPUT_IVR[11]=G; } if(v_monitor.value.integer == ADDR_AES_IVR0) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); H=v_monitor_catch.value.integer; INPUT_IVR[12]=H>>24; INPUT_IVR[13]=H>>16; INPUT_IVR[14]=H>>8; INPUT_IVR[15]=H; } if(v_monitor.value.integer == ADDR_AES_CR) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); I=v_monitor_catch.value.integer; } if(v_monitor.value.integer == ADDR_AES_DINR) { vpi_get_value(PWDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); if(counter_monitor == 0) { J=v_monitor_catch.value.integer; INPUT_TEXT[0]=J>>24; INPUT_TEXT[1]=J>>16; INPUT_TEXT[2]=J>>8; INPUT_TEXT[3]=J; counter_monitor++; }else if(counter_monitor == 1) { L=v_monitor_catch.value.integer; INPUT_TEXT[4]=L>>24; INPUT_TEXT[5]=L>>16; INPUT_TEXT[6]=L>>8; INPUT_TEXT[7]=L; counter_monitor++; }else if(counter_monitor == 2) { M=v_monitor_catch.value.integer; INPUT_TEXT[8]=M>>24; INPUT_TEXT[9]=M>>16; INPUT_TEXT[10]=M>>8; INPUT_TEXT[11]=M; counter_monitor++; }else if(counter_monitor == 3) { N=v_monitor_catch.value.integer; INPUT_TEXT[12]=N>>24; INPUT_TEXT[13]=N>>16; INPUT_TEXT[14]=N>>8; INPUT_TEXT[15]=N; counter_monitor=0; } } }else if(v_monitor.value.integer == 0){ vpi_get_value(PADDR, &v_monitor); if(v_monitor.value.integer == ADDR_AES_KEYR3) { vpi_get_value(PRDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); A=v_monitor_catch.value.integer; OUTPUT_KEYR[0]=A>>24; OUTPUT_KEYR[1]=A>>16; OUTPUT_KEYR[2]=A>>8; OUTPUT_KEYR[3]=A; counter_monitor++; //printf("%x%x%x%x\n",KEYR[0],KEYR[1],KEYR[2],KEYR[3]); } if(v_monitor.value.integer == ADDR_AES_KEYR2) { vpi_get_value(PRDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); B=v_monitor_catch.value.integer; OUTPUT_KEYR[4]=B>>24; OUTPUT_KEYR[5]=B>>16; OUTPUT_KEYR[6]=B>>8; OUTPUT_KEYR[7]=B; counter_monitor++; } if(v_monitor.value.integer == ADDR_AES_KEYR1) { vpi_get_value(PRDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); C=v_monitor_catch.value.integer; OUTPUT_KEYR[8]=C>>24; OUTPUT_KEYR[9]=C>>16; OUTPUT_KEYR[10]=C>>8; OUTPUT_KEYR[11]=C; counter_monitor++; } if(v_monitor.value.integer == ADDR_AES_KEYR0) { vpi_get_value(PRDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); D=v_monitor_catch.value.integer; OUTPUT_KEYR[12]=D>>24; OUTPUT_KEYR[13]=D>>16; OUTPUT_KEYR[14]=D>>8; OUTPUT_KEYR[15]=D; counter_monitor++; //printf("%x%x%x%x\n",KEYR[0],KEYR[1],KEYR[2],KEYR[3]); } if(v_monitor.value.integer == ADDR_AES_IVR3) { vpi_get_value(PRDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); E=v_monitor_catch.value.integer; OUTPUT_IVR[0]=E>>24; OUTPUT_IVR[1]=E>>16; OUTPUT_IVR[2]=E>>8; OUTPUT_IVR[3]=E; counter_monitor++; } if(v_monitor.value.integer == ADDR_AES_IVR2) { vpi_get_value(PRDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); F=v_monitor_catch.value.integer; OUTPUT_IVR[4]=F>>24; OUTPUT_IVR[5]=F>>16; OUTPUT_IVR[6]=F>>8; OUTPUT_IVR[7]=F; counter_monitor++; } if(v_monitor.value.integer == ADDR_AES_IVR1) { vpi_get_value(PRDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); G=v_monitor_catch.value.integer; OUTPUT_IVR[8]=G>>24; OUTPUT_IVR[9]=G>>16; OUTPUT_IVR[10]=G>>8; OUTPUT_IVR[11]=G; counter_monitor++; } if(v_monitor.value.integer == ADDR_AES_IVR0) { vpi_get_value(PRDATA, &v_monitor_catch); //printf("%X\n",v_monitor_catch.value.integer); H=v_monitor_catch.value.integer; OUTPUT_IVR[12]=H>>24; OUTPUT_IVR[13]=H>>16; OUTPUT_IVR[14]=H>>8; OUTPUT_IVR[15]=H; counter_monitor++; } if(v_monitor.value.integer == ADDR_AES_DOUTR) { vpi_get_value(PRDATA, &v_monitor_catch); //vpi_put_value(PRDATA, &v_monitor_catch, &t_monitor, vpiTransportDelay); //printf("%X\n",v_monitor_catch.value.integer); if(counter_monitor == 0) { J=v_monitor_catch.value.integer; OUTPUT_TEXT[0]=J>>24; OUTPUT_TEXT[1]=J>>16; OUTPUT_TEXT[2]=J>>8; OUTPUT_TEXT[3]=J; counter_monitor++; }else if(counter_monitor == 1) { L=v_monitor_catch.value.integer; OUTPUT_TEXT[4]=L>>24; OUTPUT_TEXT[5]=L>>16; OUTPUT_TEXT[6]=L>>8; OUTPUT_TEXT[7]=L; counter_monitor++; }else if(counter_monitor == 2) { M=v_monitor_catch.value.integer; OUTPUT_TEXT[8]=M>>24; OUTPUT_TEXT[9]=M>>16; OUTPUT_TEXT[10]=M>>8; OUTPUT_TEXT[11]=M; counter_monitor++; }else if(counter_monitor == 3) { N=v_monitor_catch.value.integer; OUTPUT_TEXT[12]=N>>24; OUTPUT_TEXT[13]=N>>16; OUTPUT_TEXT[14]=N>>8; OUTPUT_TEXT[15]=N; counter_monitor++; } } // vpi_mcd_printf(1,"%d\n",counter_monitor); if(counter_monitor == 12 && FIPS_ENABLE == FIPS) { printf("Checking results\n\n"); counter_monitor = 0; if(I == 4094)// WR { if(memcmp(TEXT_NULL,OUTPUT_TEXT,16) == 0) { printf("WRITE READ: TEXT CR DISABLED PASSED.\n"); }else { printf("WRITE READ: TEXT CR DISABLED FAIL.\n"); } if(memcmp(OUTPUT_KEYR,INPUT_KEYR,16) == 0) { printf("WRITE READ: KEYR WHEN CR DISABLED PASSED.\n"); }else { printf("WRITE READ: KEYR WHEN CR DISABLED FAIL.\n"); } if(memcmp(OUTPUT_IVR,INPUT_IVR,16) == 0) { printf("WRITE READ: IVR WHEN CR DISABLED PASSED.\n"); }else { printf("WRITE READ: IVR WHEN CR DISABLED FAIL.\n"); } }else if(I == 1)//ECB ENCRYPTION { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_DERIVATED,16) == 0) { printf("ECB ENCRYPTION: TEXT CYPHER PASSED.\n"); }else { printf("ECB ENCRYPTION: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("ECB ENCRYPTION: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB ENCRYPTION: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("ECB ENCRYPTION: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB ENCRYPTION: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6145 ) //ECB ENCRYPTION DMA { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_DERIVATED,16) == 0) { printf("ECB ENCRYPTION DMA: TEXT CYPHER WHEN CR ENABLE PASSED.\n"); }else { printf("ECB ENCRYPTION DMA: TEXT CYPHER WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("ECB ENCRYPTION DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB ENCRYPTION DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("ECB ENCRYPTION DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB ENCRYPTION DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if (I == 513) // ECB ENCRYPTION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_DERIVATED,16) == 0) { printf("ECB ENCRYPTION CCFIE: TEXT CYPHER PASSED.\n"); }else { printf("ECB ENCRYPTION CCFIE: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("ECB ENCRYPTION CCFIE: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB ENCRYPTION CCFIE: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("ECB ENCRYPTION CCFIE: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB ENCRYPTION CCFIE: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 25)// ECB DERIVATION DECRYPTION { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_NOT_DERIVATED,16) == 0) { printf("ECB DERIVATION DECRYPTION: TEXT CYPHER PASSED.\n"); }else { printf("ECB DERIVATION DECRYPTION: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("ECB DERIVATION DECRYPTION: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DERIVATION DECRYPTION: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("ECB DERIVATION DECRYPTION: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DERIVATION DECRYPTION: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6169)// ECB DERIVATION DECRYPTION DMA { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_NOT_DERIVATED,16) == 0) { printf("ECB DERIVATION DECRYPTION DMA: TEXT CYPHER PASSED.\n"); }else { printf("ECB DERIVATION DECRYPTION DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("ECB DERIVATION DECRYPTION DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DERIVATION DECRYPTION DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("ECB DERIVATION DECRYPTION DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DERIVATION DECRYPTION DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 537)// ECB DERIVATION DECRYPTION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_NOT_DERIVATED,16) == 0) { printf("ECB DERIVATION DECRYPTION DMA: TEXT CYPHER PASSED.\n"); }else { printf("ECB DERIVATION DECRYPTION DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("ECB DERIVATION DECRYPTION DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DERIVATION DECRYPTION DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("ECB DERIVATION DECRYPTION DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DERIVATION DECRYPTION DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 17)//ECB DECRYPTION { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_NOT_DERIVATED,16) == 0) { printf("ECB DECRYPTION: TEXT CYPHER PASSED.\n"); }else { printf("ECB DECRYPTION: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("ECB DECRYPTION: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DECRYPTION: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("ECB DECRYPTION: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DECRYPTION: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6161)//ECB DECRYPTION DMA { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_NOT_DERIVATED,16) == 0) { printf("ECB DECRYPTION DMA: TEXT CYPHER PASSED.\n"); }else { printf("ECB DECRYPTION DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("ECB DECRYPTION DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DECRYPTION DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("ECB DECRYPTION DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DECRYPTION DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 529)//ECB DECRYPTION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_NOT_DERIVATED,16) == 0) { printf("ECB DECRYPTION CCFIE: TEXT CYPHER PASSED.\n"); }else { printf("ECB DECRYPTION CCFIE: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("ECB DECRYPTION CCFIE: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DECRYPTION CCFIE: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("ECB DECRYPTION CCFIE: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB DECRYPTION CCFIE: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 9) //ECB KEY GENARATION { if(memcmp(OUTPUT_TEXT,TEXT_NULL,16) == 0) { printf("ECB KEY GEN : TEXT CYPHER PASSED.\n"); }else { printf("ECB KEY GEN : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,KEY_FIPS_DERIVATED,16) == 0) { printf("ECB KEY GEN: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB KEY GEN: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,KEY_FIPS_NOT_DERIVATED,16) == 0) { printf("ECB KEY GEN: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB KEY GEN: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6153)// ECB KEY GENARATION DMA { if(memcmp(OUTPUT_TEXT,TEXT_NULL,16) == 0) { printf("ECB KEY GEN DMA: TEXT CYPHER PASSED.\n"); }else { printf("ECB KEY GEN DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,KEY_FIPS_DERIVATED,16) == 0) { printf("ECB KEY GEN DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB KEY GEN DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,KEY_FIPS_NOT_DERIVATED,16) == 0) { printf("ECB KEY GEN DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB KEY GEN DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 521)// ECB KEY GENARATION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_NULL,16) == 0) { printf("ECB KEY GEN CCFIE: TEXT CYPHER PASSED.\n"); }else { printf("ECB KEY GEN CCFIE: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,KEY_FIPS_DERIVATED,16) == 0) { printf("ECB KEY GEN CCFIE: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB KEY GEN CCFIE: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,KEY_FIPS_NOT_DERIVATED,16) == 0) { printf("ECB KEY GEN CCFIE: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("ECB KEY GEN CCFIE: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 33) // ENCRYPTION CBC { if(memcmp(OUTPUT_TEXT,TEXT_CBC_FIPS_DERIVATED,16) == 0) { printf("CBC ENCRYPTION: TEXT CYPHER PASSED.\n"); }else { printf("CBC ENCRYPTION: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CBC ENCRYPTION: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC ENCRYPTION: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CBC ENCRYPTION: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC ENCRYPTION: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6177)//CBC ENCRYPTION DMA { if(memcmp(OUTPUT_TEXT,TEXT_CBC_FIPS_DERIVATED,16) == 0) { printf("CBC ENCRYPTION DMA: TEXT CYPHER PASSED.\n"); }else { printf("CBC ENCRYPTION DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CBC ENCRYPTION DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC ENCRYPTION DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CBC ENCRYPTION DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC ENCRYPTION DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 545)//CBC ENCRYPTION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_CBC_FIPS_DERIVATED,16) == 0) { printf("CBC ENCRYPTION CCFIE: TEXT CYPHER PASSED.\n"); }else { printf("CBC ENCRYPTION CCFIE: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CBC ENCRYPTION CCFIE: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC ENCRYPTION CCFIE: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CBC ENCRYPTION CCFIE: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC ENCRYPTION CCFIE: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 49)// CBC DECRYPTION { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CBC_NOT_DERIVATED,16) == 0) { printf("CBC DECRYPTION : TEXT CYPHER PASSED.\n"); }else { printf("CBC DECRYPTION : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CBC DECRYPTION : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DECRYPTION : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CBC DECRYPTION : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DECRYPTION : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 3121)//CBC DECRYPTION DMA { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CBC_NOT_DERIVATED,16) == 0) { printf("CBC DECRYPTION DMA : TEXT CYPHER PASSED.\n"); }else { printf("CBC DECRYPTION DMA : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CBC DECRYPTION DMA : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DECRYPTION DMA : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CBC DECRYPTION DMA : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DECRYPTION DMA : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 561)// CBC DECRYPTION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CBC_NOT_DERIVATED,16) == 0) { printf("CBC DECRYPTION : TEXT CYPHER PASSED.\n"); }else { printf("CBC DECRYPTION : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CBC DECRYPTION : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DECRYPTION : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CBC DECRYPTION : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DECRYPTION : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 41) //CBC KEY GENERATION { if(memcmp(OUTPUT_TEXT,TEXT_NULL,16) == 0) { printf("CBC KEY GEN : TEXT CYPHER PASSED.\n"); }else { printf("CBC KEY GEN : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,KEY_FIPS_CBC_DERIVATED,16) == 0) { printf("CBC KEY GEN : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC KEY GEN : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,IV_FIPS_CBC_NOT_DERIVATED,16) == 0) { printf("CBC KEY GEN : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC KEY GEN : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6185) //CBC KEY GENERATION DMA { if(memcmp(OUTPUT_TEXT,TEXT_NULL,16) == 0) { printf("CBC KEY GEN DMA : TEXT CYPHER PASSED.\n"); }else { printf("CBC KEY GEN DMA : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,KEY_FIPS_CBC_DERIVATED,16) == 0) { printf("CBC KEY GEN DMA : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC KEY GEN DMA : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,IV_FIPS_CBC_NOT_DERIVATED,16) == 0) { printf("CBC KEY GEN DMA : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC KEY GEN DMA : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 297 ) //CBC KEY GENERATION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_NULL,16) == 0) { printf("CBC KEY GEN CCFIE : TEXT CYPHER PASSED.\n"); }else { printf("CBC KEY GEN CCFIE : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,KEY_FIPS_CBC_DERIVATED,16) == 0) { printf("CBC KEY GEN CCFIE : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC KEY GEN CCFIE : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,IV_FIPS_CBC_NOT_DERIVATED,16) == 0) { printf("CBC KEY GEN CCFIE : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC KEY GEN CCFIE : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 57)// CBC DERIVATION DECRYPTION { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CBC_NOT_DERIVATED,16) == 0) { printf("CBC DERIVATION DECRYPTION : TEXT CYPHER PASSED.\n"); }else { printf("CBC DERIVATION DECRYPTION : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CBC DERIVATION DECRYPTION : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DERIVATION DECRYPTION : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CBC DERIVATION DECRYPTION : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DERIVATION DECRYPTION : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6201) // CBC DERIVATION DECRYPTION DMA { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CBC_NOT_DERIVATED,16) == 0) { printf("CBC DERIVATION DECRYPTION DMA : TEXT CYPHER PASSED.\n"); }else { printf("CBC DERIVATION DECRYPTION DMA : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CBC DERIVATION DECRYPTION DMA : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DERIVATION DECRYPTION DMA : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CBC DERIVATION DECRYPTION DMA : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DERIVATION DECRYPTION DMA : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 569) // CBC DERIVATION DECRYPTION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CBC_NOT_DERIVATED,16) == 0) { printf("CBC DERIVATION DECRYPTION CCFIE : TEXT CYPHER PASSED.\n"); }else { printf("CBC DERIVATION DECRYPTION CCFIE : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CBC DERIVATION DECRYPTION CCFIE : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DERIVATION DECRYPTION CCFIE : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CBC DERIVATION DECRYPTION CCFIE : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CBC DERIVATION DECRYPTION CCFIE : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 65)// CTR ENCFRYPTION { if(memcmp(OUTPUT_TEXT,TEXT_CTR_FIPS_DERIVATED,16) == 0) { printf("CTR ENCRYPTION: TEXT CYPHER PASSED.\n"); }else { printf("CTR ENCRYPTION: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CTR ENCRYPTION: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR ENCRYPTION: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CTR ENCRYPTION: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR ENCRYPTION: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6209)// CTR ENCRYPTION DMA { if(memcmp(OUTPUT_TEXT,TEXT_CTR_FIPS_DERIVATED,16) == 0) { printf("CTR ENCRYPTION DMA: TEXT CYPHER PASSED.\n"); }else { printf("CTR ENCRYPTION DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CTR ENCRYPTION DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR ENCRYPTION DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CTR ENCRYPTION DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR ENCRYPTION DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 577)// CTR ENCRYPTION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_CTR_FIPS_DERIVATED,16) == 0) { printf("CTR ENCRYPTION CCFIE: TEXT CYPHER PASSED.\n"); }else { printf("CTR ENCRYPTION CCFIE: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CTR ENCRYPTION CCFIE: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR ENCRYPTION CCFIE: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CTR ENCRYPTION CCFIE: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR ENCRYPTION CCFIE: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 81) //CTR DECRYPTION { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CTR_NOT_DERIVATED,16) == 0) { printf("CTR DECRYPTION : TEXT CYPHER PASSED.\n"); }else { printf("CTR DECRYPTION : TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CTR DECRYPTION : KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DECRYPTION : KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CTR DECRYPTION : IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DECRYPTION : IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6225) //CTR DECRYPTION DMA { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CTR_NOT_DERIVATED,16) == 0) { printf("CTR DECRYPTION DMA: TEXT CYPHER PASSED.\n"); }else { printf("CTR DECRYPTION DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CTR DECRYPTION DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DECRYPTION DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CTR DECRYPTION DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DECRYPTION DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 593) //CTR DECRYPTION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CTR_NOT_DERIVATED,16) == 0) { printf("CTR DECRYPTION CCFIE: TEXT CYPHER PASSED.\n"); }else { printf("CTR DECRYPTION CCFIE: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CTR DECRYPTION CCFIE: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DECRYPTION CCFIE: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CTR DECRYPTION CCFIE: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DECRYPTION CCFIE: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 89) //CTR DERIVATION DECRYPTION { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CTR_NOT_DERIVATED,16) == 0) { printf("CTR DERIVATION DECRYPTION: TEXT CYPHER PASSED.\n"); }else { printf("CTR DERIVATION DECRYPTION: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CTR DERIVATION DECRYPTION: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DERIVATION DECRYPTION: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CTR DERIVATION DECRYPTION: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DERIVATION DECRYPTION: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6233) //CTR DERIVATION DECRYPTION DMA { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CTR_NOT_DERIVATED,16) == 0) { printf("CTR DERIVATION DECRYPTION DMA: TEXT CYPHER PASSED.\n"); }else { printf("CTR DERIVATION DECRYPTION DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CTR DERIVATION DECRYPTION DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DERIVATION DECRYPTION DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CTR DERIVATION DECRYPTION DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DERIVATION DECRYPTION DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 601) //CTR DERIVATION DECRYPTION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_FIPS_CTR_NOT_DERIVATED,16) == 0) { printf("CTR DERIVATION DECRYPTION DMA: TEXT CYPHER PASSED.\n"); }else { printf("CTR DERIVATION DECRYPTION DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,TEXT_NULL,16) == 0) { printf("CTR DERIVATION DECRYPTION DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DERIVATION DECRYPTION DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,TEXT_NULL,16) == 0) { printf("CTR DERIVATION DECRYPTION DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR DERIVATION DECRYPTION DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 73)// CTR KEY GENERATION { if(memcmp(OUTPUT_TEXT,TEXT_NULL,16) == 0) { printf("CTR KEY GEN: TEXT CYPHER PASSED.\n"); }else { printf("CTR KEY GEN: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,KEY_FIPS_CTR_DERIVATED,16) == 0) { printf("CTR KEY GEN: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR KEY GEN: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,IV_FIPS_CTR_NOT_DERIVATED,16) == 0) { printf("CTR KEY GEN: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR KEY GEN: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 6217) // CTR KEY GENERATION DMA { if(memcmp(OUTPUT_TEXT,TEXT_NULL,16) == 0) { printf("CTR KEY GEN DMA: TEXT CYPHER PASSED.\n"); }else { printf("CTR KEY GEN DMA: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,KEY_FIPS_CTR_DERIVATED,16) == 0) { printf("CTR KEY GEN DMA: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR KEY GEN DMA: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,IV_FIPS_CTR_NOT_DERIVATED,16) == 0) { printf("CTR KEY GEN DMA: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR KEY GEN DMA: IVR WHEN CR ENABLE FAIL.\n"); } }else if(I == 585) // CTR KEY GENERATION CCFIE { if(memcmp(OUTPUT_TEXT,TEXT_NULL,16) == 0) { printf("CTR KEY GEN CCFIE: TEXT CYPHER PASSED.\n"); }else { printf("CTR KEY GEN CCFIE: TEXT CYPHER FAIL.\n"); } if(memcmp(OUTPUT_KEYR,KEY_FIPS_CTR_DERIVATED,16) == 0) { printf("CTR KEY GEN CCFIE: KEYR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR KEY GEN CCFIE: KEYR WHEN CR ENABLE FAIL.\n"); } if(memcmp(OUTPUT_IVR,IV_FIPS_CTR_NOT_DERIVATED,16) == 0) { printf("CTR KEY GEN CCFIE: IVR WHEN CR ENABLE PASSED.\n"); }else { printf("CTR KEY GEN CCFIE: IVR WHEN CR ENABLE FAIL.\n"); } } }//counter == 12 } } } return 0; }
Go to most recent revision | Compare with Previous | Blame | View Log