OpenCores
URL https://opencores.org/ocsvn/apbtoaes128/apbtoaes128/trunk

Subversion Repositories apbtoaes128

[/] [apbtoaes128/] [trunk/] [pli/] [env_aes.c] - Diff between revs 9 and 12

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 9 Rev 12
Line 124... Line 124...
unsigned long  int J;
unsigned long  int J;
unsigned long  int L;
unsigned long  int L;
unsigned long  int M;
unsigned long  int M;
unsigned long  int N;
unsigned long  int N;
 
 
 
unsigned long  int O;
 
 
int type_bfm;
int type_bfm;
 
 
int STATE;
int STATE;
int STATE_RESET;
int STATE_RESET;
 
 
int counter;
int counter;
int counter_monitor;
int counter_monitor;
int cycle_counter;
int cycle_counter;
 
 
 
 
int flag;
int flag;
 
 
 
int DATATYPE;
 
 
int reset_counter;
int reset_counter;
int counter_reset_enter;
int counter_reset_enter;
int counter_reset_wait;
int counter_reset_wait;
int FIPS_ENABLE;
int FIPS_ENABLE;
 
 
Line 148... Line 151...
 
 
int counter_write;
int counter_write;
int counter_read;
int counter_read;
int counter_wait;
int counter_wait;
 
 
 
/* DATATYPE */
 
#define TYPE_00 0
 
#define TYPE_01 1
 
#define TYPE_02 2
 
#define TYPE_03 3
 
 
/*AES REGISTERS*/
/*AES REGISTERS*/
#define ADDR_AES_CR 0
#define ADDR_AES_CR 0
#define ADDR_AES_SR 4
#define ADDR_AES_SR 4
#define ADDR_AES_DINR 8
#define ADDR_AES_DINR 8
 
 
Line 166... Line 175...
#define ADDR_AES_IVR2 40
#define ADDR_AES_IVR2 40
#define ADDR_AES_IVR3 44
#define ADDR_AES_IVR3 44
 
 
int vector_address[11];
int vector_address[11];
 
 
 
int vector_CR[233];
 
 
/*STATE MACHINE TO WORK WITH BFM*/
/*STATE MACHINE TO WORK WITH BFM*/
#define IDLE           0
#define IDLE           0
#define WRITE          1
#define WRITE          1
#define WAIT           2
#define WAIT           2
#define READ_RESULTS   3
#define READ_RESULTS   3
Line 187... Line 198...
#define GET_OUT_RESET 11
#define GET_OUT_RESET 11
 
 
 
 
#define AES_WR_ONLY 99
#define AES_WR_ONLY 99
#define AES_WR_ERROR_DINR_ONLY 100
#define AES_WR_ERROR_DINR_ONLY 100
#define AES_WR_ERROR_DOUTR_ONLY 100
#define AES_WR_ERROR_DOUTR_ONLY 101
 
 
/*TEST USING NAMES TO ENABLE BFMs*/
/*TEST USING NAMES TO ENABLE BFMs*/
#define ECB_ENCRYPTION                   1
#define ECB_ENCRYPTION                   1
#define ECB_DECRYPTION                   2
#define ECB_DECRYPTION                   2
#define ECB_KEY_GEN                      3
#define ECB_KEY_GEN                      3
Line 238... Line 249...
#define CTR_ENCRYPTION_CCFIE            33
#define CTR_ENCRYPTION_CCFIE            33
#define CTR_DECRYPTION_CCFIE            34
#define CTR_DECRYPTION_CCFIE            34
#define CTR_DERIVATION_DECRYPTION_CCFIE 35
#define CTR_DERIVATION_DECRYPTION_CCFIE 35
#define CTR_KEY_GEN_CCFIE               36
#define CTR_KEY_GEN_CCFIE               36
 
 
 
/*SUFLE TEST*/
 
#define SUFLE_TEST                      37
 
 
/*TYPE CONFIGURATION USED TO INSERT DATA ON DUT*/
/*TYPE CONFIGURATION USED TO INSERT DATA ON DUT*/
#define FIPS 0
#define FIPS 0
#define RANDOM_DATA 1
#define RANDOM_DATA 1
 
 
 
 
/*MAX PACKETS GENERATION*/
/*MAX PACKETS GENERATION*/
#define MAX_ITERATIONS 5
#define MAX_ITERATIONS 3
 
 
/*MAX RESET GENERATION */
/*MAX RESET GENERATION */
#define MAX_RESET_TIMES 4
#define MAX_RESET_TIMES 4
 
 
/*THIS IS USED BY MONITOR TO CATCH INPUTS AND OUTPUTS*/
/*THIS IS USED BY MONITOR TO CATCH INPUTS AND OUTPUTS*/
Line 261... Line 275...
unsigned char INPUT_TEXT[16];
unsigned char INPUT_TEXT[16];
unsigned char OUTPUT_TEXT[16];
unsigned char OUTPUT_TEXT[16];
 
 
 
 
/*THIS INCLUDE IS USED TO GENERATE DATA DO BE INSERTED ON DUT*/
/*THIS INCLUDE IS USED TO GENERATE DATA DO BE INSERTED ON DUT*/
 
unsigned char TEXT_FIPS_NOT_DATATYPE_DERIVATED[] = {0x22,0x33,0x00,0x11,0x66,0x77,0x44,0x55,0xAA,0xBB,0x88,0x99,0xEE,0xFF,0xCC,0xDD};
unsigned char TEXT_FIPS_NOT_DERIVATED[]     = {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF};
unsigned char TEXT_FIPS_NOT_DERIVATED[]     = {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF};
unsigned char KEY_FIPS_NOT_DERIVATED[]      = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
unsigned char KEY_FIPS_NOT_DERIVATED[]      = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
 
 
unsigned char TEXT_FIPS_DERIVATED[]         = {0x69,0xC4,0xE0,0xD8,0x6A,0x7B,0x04,0x30,0xD8,0xCD,0xB7,0x80,0x70,0xB4,0xC5,0x5A};
unsigned char TEXT_FIPS_DERIVATED[]         = {0x69,0xC4,0xE0,0xD8,0x6A,0x7B,0x04,0x30,0xD8,0xCD,0xB7,0x80,0x70,0xB4,0xC5,0x5A};
 
unsigned char TEXT_FIPS_DATATYPE_T01_DERIVATED[] = {0xE0,0xD8,0x69,0xC4,0x04,0x30,0x6A,0x7B,0xB7,0x80,0xD8,0xCD,0xC5,0x5A,0x70,0xB4};
 
unsigned char TEXT_FIPS_DATATYPE_T02_DERIVATED[] = {0x15,0xDA,0x8D,0x52,0x27,0x77,0xA3,0x69,0x6D,0x2C,0x49,0x5B,0x08,0x13,0xBF,0x90};
 
unsigned char TEXT_FIPS_DATATYPE_T03_DERIVATED[] = {0xA3,0xB4,0x12,0xDA,0x43,0x04,0x7B,0x7C,0x21,0xEC,0x50,0x0A,0xDF,0x0B,0xF6,0x77};
unsigned char KEY_FIPS_DERIVATED[]          = {0x13,0x11,0x1D,0x7F,0xE3,0x94,0x4A,0x17,0xF3,0x07,0xA7,0x8B,0x4D,0x2B,0x30,0xC5};
unsigned char KEY_FIPS_DERIVATED[]          = {0x13,0x11,0x1D,0x7F,0xE3,0x94,0x4A,0x17,0xF3,0x07,0xA7,0x8B,0x4D,0x2B,0x30,0xC5};
 
 
 
 
unsigned char KEY_FIPS_CBC_NOT_DERIVATED[]  = {0x2B,0x7E,0x15,0x16,0x28,0xAE,0xD2,0xA6,0xAB,0xF7,0x15,0x88,0x09,0xCF,0x4F,0x3C};
unsigned char KEY_FIPS_CBC_NOT_DERIVATED[]  = {0x2B,0x7E,0x15,0x16,0x28,0xAE,0xD2,0xA6,0xAB,0xF7,0x15,0x88,0x09,0xCF,0x4F,0x3C};
unsigned char IV_FIPS_CBC_NOT_DERIVATED[]   = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
unsigned char IV_FIPS_CBC_NOT_DERIVATED[]   = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
 
 
 
 
unsigned char TEXT_FIPS_CBC_NOT_DERIVATED[] = {0x6B,0xC1,0xBE,0xE2,0x2E,0x40,0x9F,0x96,0xE9,0x3D,0x7E,0x11,0x73,0x93,0x17,0x2A};
unsigned char TEXT_FIPS_CBC_NOT_DERIVATED[] = {0x6B,0xC1,0xBE,0xE2,0x2E,0x40,0x9F,0x96,0xE9,0x3D,0x7E,0x11,0x73,0x93,0x17,0x2A};
 
unsigned char TEXT_FIPS_CBC_NOT_DATATYPE_DERIVATED[] = {0xBE,0xE2,0x6B,0xC1,0x9F,0x96,0x2E,0x40,0x7E,0x11,0xE9,0x3D,0x17,0x2A,0x73,0x93};
unsigned char KEY_FIPS_CBC_DERIVATED[]      = {0xD0,0x14,0xF9,0xA8,0xC9,0xEE,0x25,0x89,0xE1,0x3F,0x0C,0xC8,0xB6,0x63,0x0C,0xA6};
unsigned char KEY_FIPS_CBC_DERIVATED[]      = {0xD0,0x14,0xF9,0xA8,0xC9,0xEE,0x25,0x89,0xE1,0x3F,0x0C,0xC8,0xB6,0x63,0x0C,0xA6};
 
 
 
 
unsigned char TEXT_CBC_FIPS_DERIVATED[]     = {0x76,0x49,0xAB,0xAC,0x81,0x19,0xB2,0x46,0xCE,0xE9,0x8E,0x9B,0x12,0xE9,0x19,0x7D};
unsigned char TEXT_CBC_FIPS_DERIVATED[]     = {0x76,0x49,0xAB,0xAC,0x81,0x19,0xB2,0x46,0xCE,0xE9,0x8E,0x9B,0x12,0xE9,0x19,0x7D};
 
unsigned char TEXT_CBC_FIPS_DATATYPE_T01_DERIVATED[] = {0xAB,0xAC,0x76,0x49,0xB2,0x46,0x81,0x19,0x8E,0x9B,0xCE,0xE9,0x19,0x7D,0x12,0xE9};
 
unsigned char TEXT_CBC_FIPS_DATATYPE_T02_DERIVATED[] = {0xCD,0x29,0x94,0xFC,0xF6,0xAE,0x27,0x96,0x7D,0xA4,0x45,0xFA,0x28,0x9E,0xE8,0x39};
 
unsigned char TEXT_CBC_FIPS_DATATYPE_T03_DERIVATED[] = {0x7F,0x59,0xFD,0x0E,0x0F,0x88,0xD0,0x32,0x7F,0x75,0x0E,0xB5,0x07,0x85,0xC3,0x4E};
 
 
 
 
unsigned char KEY_FIPS_CTR_NOT_DERIVATED[]  = {0x2B,0x7E,0x15,0x16,0x28,0xAE,0xD2,0xA6,0xAB,0xF7,0x15,0x88,0x09,0xCF,0x4F,0x3C};
unsigned char KEY_FIPS_CTR_NOT_DERIVATED[]  = {0x2B,0x7E,0x15,0x16,0x28,0xAE,0xD2,0xA6,0xAB,0xF7,0x15,0x88,0x09,0xCF,0x4F,0x3C};
unsigned char IV_FIPS_CTR_NOT_DERIVATED[]   = {0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF};
unsigned char IV_FIPS_CTR_NOT_DERIVATED[]   = {0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF};
unsigned char TEXT_FIPS_CTR_NOT_DERIVATED[] = {0x6B,0xC1,0xBE,0xE2,0x2E,0x40,0x9F,0x96,0xE9,0x3D,0x7E,0x11,0x73,0x93,0x17,0x2A};
unsigned char TEXT_FIPS_CTR_NOT_DERIVATED[] = {0x6B,0xC1,0xBE,0xE2,0x2E,0x40,0x9F,0x96,0xE9,0x3D,0x7E,0x11,0x73,0x93,0x17,0x2A};
 
unsigned char TEXT_FIPS_CTR_NOT_DATATYPE_DERIVATED[]  = {0xBE,0xE2,0x6B,0xC1,0x9F,0x96,0x2E,0x40,0x7E,0x11,0xE9,0x3D,0x17,0x2A,0x73,0x93};
 
 
unsigned char TEXT_CTR_FIPS_DERIVATED[]     = {0x87,0x4D,0x61,0x91,0xB6,0x20,0xE3,0x26,0x1B,0xEF,0x68,0x64,0x99,0x0D,0xB6,0xCE};
unsigned char TEXT_CTR_FIPS_DERIVATED[]     = {0x87,0x4D,0x61,0x91,0xB6,0x20,0xE3,0x26,0x1B,0xEF,0x68,0x64,0x99,0x0D,0xB6,0xCE};
 
unsigned char TEXT_CTR_FIPS_DATATYPE_T01_DERIVATED[]  = {0x61,0x91,0x87,0x4D,0xE3,0x26,0xB6,0x20,0x68,0x64,0x1B,0xEF,0xB6,0xCE,0x99,0x0D};
 
unsigned char TEXT_CTR_FIPS_DATATYPE_T02_DERIVATED[]  = {0xCD,0x3D,0xE7,0x2D,0x2F,0xEA,0x4E,0xD8,0x0B,0x07,0x3B,0xCF,0xF3,0x8B,0xED,0x79};
 
unsigned char TEXT_CTR_FIPS_DATATYPE_T03_DERIVATED[]  = {0x70,0x19,0x5A,0xF6,0x92,0xA8,0x28,0x59,0xD0,0x79,0xA2,0x72,0x30,0xAF,0x0A,0xC4};
unsigned char KEY_FIPS_CTR_DERIVATED[]  = {0xD0,0x14,0xF9,0xA8,0xC9,0xEE,0x25,0x89,0xE1,0x3F,0x0C,0xC8,0xB6,0x63,0x0C,0xA6};
unsigned char KEY_FIPS_CTR_DERIVATED[]  = {0xD0,0x14,0xF9,0xA8,0xC9,0xEE,0x25,0x89,0xE1,0x3F,0x0C,0xC8,0xB6,0x63,0x0C,0xA6};
 
 
unsigned char TEXT_NULL[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char TEXT_NULL[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 
 
/*BFM CONTROL FLOW*/
/*BFM CONTROL FLOW*/
Line 346... Line 372...
#include "bfm_ctr/aes_bfm_encryption_ccfie_ctr.h"
#include "bfm_ctr/aes_bfm_encryption_ccfie_ctr.h"
#include "bfm_ctr/aes_bfm_decryption_ccfie_ctr.h"
#include "bfm_ctr/aes_bfm_decryption_ccfie_ctr.h"
#include "bfm_ctr/aes_bfm_key_generation_ccfie_ctr.h"
#include "bfm_ctr/aes_bfm_key_generation_ccfie_ctr.h"
#include "bfm_ctr/aes_bfm_derivation_decryption_ccfie_ctr.h"
#include "bfm_ctr/aes_bfm_derivation_decryption_ccfie_ctr.h"
 
 
 
/*SUFLE TEST*/
 
 #include "random/aes_bfm_sufle.h"
 
 
/*ENV CONFIG */
/*ENV CONFIG */
#include "aes_init.h"
#include "aes_init.h"
#include "aes_monitor.h"
#include "aes_monitor.h"
#include "aes_bfm_reset.h"
#include "aes_bfm_reset.h"
#include "aes_init_reset.h"
#include "aes_init_reset.h"
Line 734... Line 763...
      tf_data.compiletf = 0;
      tf_data.compiletf = 0;
      tf_data.sizetf    = 0;
      tf_data.sizetf    = 0;
      tf_data.user_data = 0;
      tf_data.user_data = 0;
      vpi_register_systf(&tf_data);
      vpi_register_systf(&tf_data);
 
 
 
      //BFM SUFLE
 
 
 
      tf_data.type      = vpiSysTask;
 
      tf_data.sysfunctype = 0;
 
      tf_data.tfname    = "$bfm_sufle_aes128";
 
      tf_data.calltf    =  aes_bfm_sufle_calltf;
 
      tf_data.compiletf = 0;
 
      tf_data.sizetf    = 0;
 
      tf_data.user_data = 0;
 
      vpi_register_systf(&tf_data);
 
 
 
 
 
 
      // RESET BFM
      // RESET BFM
      tf_data.type      = vpiSysTask;
      tf_data.type      = vpiSysTask;
      tf_data.sysfunctype = 0;
      tf_data.sysfunctype = 0;
      tf_data.tfname    = "$reset_aes128";
      tf_data.tfname    = "$reset_aes128";
      tf_data.calltf    = aes_reset_calltf;
      tf_data.calltf    = aes_reset_calltf;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.