mirror of https://github.com/wolfSSL/wolfssl.git
Pic benchmark, clock config
parent
20f12af8ec
commit
6ac7b056ee
|
@ -187,21 +187,23 @@ void Md5Final(Md5* md5, byte* hash)
|
|||
#endif
|
||||
|
||||
#ifndef NO_SHA
|
||||
void InitSha(Sha* sha)
|
||||
int InitSha(Sha* sha)
|
||||
{
|
||||
CYASSL_ENTER("InitSha\n") ;
|
||||
XMEMSET((void *)sha, 0xcc, sizeof(Sha)) ;
|
||||
XMEMSET((void *)KVA0_TO_KVA1(sha), 0xcc, sizeof(Sha)) ;
|
||||
reset_engine(&(sha->desc), PIC32_ALGO_SHA1) ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
int ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
{
|
||||
CYASSL_ENTER("ShaUpdate\n") ;
|
||||
update_engine(&(sha->desc), data, len, sha->digest) ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ShaFinal(Sha* sha, byte* hash)
|
||||
int ShaFinal(Sha* sha, byte* hash)
|
||||
{
|
||||
CYASSL_ENTER("ShaFinal\n") ;
|
||||
start_engine(&(sha->desc)) ;
|
||||
|
@ -209,16 +211,18 @@ void ShaFinal(Sha* sha, byte* hash)
|
|||
XMEMCPY(hash, sha->digest, SHA1_HASH_SIZE) ;
|
||||
|
||||
InitSha(sha); /* reset state */
|
||||
return 0;
|
||||
}
|
||||
#endif /* NO_SHA */
|
||||
|
||||
#ifndef NO_SHA256
|
||||
void InitSha256(Sha256* sha256)
|
||||
int InitSha256(Sha256* sha256)
|
||||
{
|
||||
CYASSL_ENTER("InitSha256\n") ;
|
||||
XMEMSET((void *)sha256, 0xcc, sizeof(Sha256)) ;
|
||||
XMEMSET((void *)KVA0_TO_KVA1(sha256), 0xcc, sizeof(Sha256)) ;
|
||||
reset_engine(&(sha256->desc), PIC32_ALGO_SHA256) ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Sha256Update(Sha256* sha256, const byte* data, word32 len)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
/* Config bits for PI32MZ, Starter Kit */
|
||||
#pragma config FPLLIDIV = DIV_1 // System PLL Input Divider (1x Divider)
|
||||
#pragma config FPLLRNG = RANGE_5_10_MHZ
|
||||
#pragma config FPLLICLK = PLL_FRC // System PLL Input Clock Selection (FRC is input to the System PLL)
|
||||
#pragma config FPLLMULT = MUL_50 // System PLL Multiplier (PLL Multiply by 50)
|
||||
#pragma config FPLLODIV = DIV_2
|
||||
// DEVCFG1
|
||||
#pragma config FNOSC = SPLL // Oscillator Selection (System PLL)
|
||||
|
||||
#pragma config ICESEL = ICS_PGx2
|
||||
/* ICE/ICD Comm Channel Select (Communicate on PGEC2/PGED2) */
|
|
@ -7,12 +7,12 @@ static void init_serial() {
|
|||
SYSKEY = 0x00000000;
|
||||
SYSKEY = 0xAA996655;
|
||||
SYSKEY = 0x556699AA;
|
||||
PB2DIV = 0x00008018;
|
||||
PB2DIV = 0x00008808;
|
||||
SYSKEY = 0x33333333;
|
||||
|
||||
/* UART2 Init */
|
||||
// U2BRG = 0x0C;
|
||||
U2BRG = 0x7;
|
||||
U2BRG = 0x047;
|
||||
ANSELBCLR = 0x4000;
|
||||
ANSELGCLR = 0x0040;
|
||||
RPB14R = 0x02;
|
||||
|
|
|
@ -33,6 +33,8 @@ Included Project Files
|
|||
3. CTaoCrypt Benchmark App (ctaocrypt_benchmark.X)
|
||||
|
||||
This project builds the CTaoCrypt benchmark application.
|
||||
For the benchmark timer, adjust CLOCK value under
|
||||
"#elif defined MICROCHIP_PIC32" in ctaocrypt/benchmark/benchmark.c
|
||||
|
||||
PIC32MX/PIC32MZ
|
||||
---------------
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
#if defined(CYASSL_MICROCHIP_PIC32MZ)
|
||||
#define MICROCHIP_PIC32
|
||||
#include <xc.h>
|
||||
#pragma config ICESEL = ICS_PGx2
|
||||
/* ICE/ICD Comm Channel Select (Communicate on PGEC2/PGED2) */
|
||||
|
||||
#include "MZ-configBits.h"
|
||||
|
||||
#include "PIC32MZ-serial.h"
|
||||
#define SYSTEMConfigPerformance /* void out SYSTEMConfigPerformance(); */
|
||||
#else
|
||||
|
@ -66,11 +67,18 @@ void bench_eccKeyAgree(void);
|
|||
int main(int argc, char** argv) {
|
||||
volatile int i ;
|
||||
int j ;
|
||||
|
||||
|
||||
PRECONbits.PFMWS = 2;
|
||||
PRECONbits.PREFEN = 0b11;
|
||||
|
||||
init_serial() ; /* initialize PIC32MZ serial I/O */
|
||||
SYSTEMConfigPerformance(80000000);
|
||||
DBINIT();
|
||||
|
||||
for(j=0; j<100; j++) {
|
||||
for(i=0; i<10000000; i++);
|
||||
printf("time=%f\n", current_time(0)) ;
|
||||
}
|
||||
printf("wolfCrypt Benchmark:\n");
|
||||
|
||||
#ifndef NO_AES
|
||||
|
|
Loading…
Reference in New Issue