wolfssl/mplabx/benchmark_main.c

138 lines
2.9 KiB
C
Raw Normal View History

2013-11-11 17:12:01 -06:00
/* benchmark_main.c
*
2015-01-08 10:39:04 -06:00
* Copyright (C) 2006-2015 wolfSSL Inc.
2013-11-11 17:12:01 -06:00
*
2015-01-06 13:14:15 -06:00
* This file is part of wolfSSL. (formerly known as CyaSSL)
2013-11-11 17:12:01 -06:00
*
2015-01-06 13:14:15 -06:00
* wolfSSL is free software; you can redistribute it and/or modify
2013-11-11 17:12:01 -06:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
2015-01-06 13:14:15 -06:00
* wolfSSL is distributed in the hope that it will be useful,
2013-11-11 17:12:01 -06:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
2014-04-11 16:58:58 -05:00
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
2013-11-11 17:12:01 -06:00
*/
2014-03-10 21:32:16 -05:00
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
2015-02-17 16:38:41 -06:00
#include <wolfssl/wolfcrypt/settings.h>
2014-03-10 21:32:16 -05:00
2015-02-17 16:38:41 -06:00
#if defined(WOLFSSL_MICROCHIP_PIC32MZ)
2013-11-11 17:12:01 -06:00
#define MICROCHIP_PIC32
#include <xc.h>
2015-02-17 16:38:41 -06:00
#pragma config ICESEL = ICS_PGx2
/* ICE/ICD Comm Channel Select (Communicate on PGEC2/PGED2) */
#include <stdio.h>
#include <stdlib.h>
2013-11-11 17:12:01 -06:00
#include "PIC32MZ-serial.h"
2015-02-17 16:38:41 -06:00
#define SYSTEMConfigPerformance /* void out SYSTEMConfigPerformance(); */
2013-11-11 17:12:01 -06:00
#else
#define PIC32_STARTER_KIT
#include <p32xxxx.h>
#include <plib.h>
#include <sys/appio.h>
#define init_serial() /* void out init_serial() ; */
#endif
void bench_des(void);
void bench_arc4(void);
void bench_hc128(void);
void bench_rabbit(void);
void bench_aes(int);
void bench_aesgcm(void);
void bench_md5(void);
void bench_sha(void);
void bench_sha256(void);
void bench_sha512(void);
void bench_ripemd(void);
void bench_rsa(void);
void bench_rsaKeyGen(void);
void bench_dh(void);
#ifdef HAVE_ECC
void bench_eccKeyGen(void);
void bench_eccKeyAgree(void);
#endif
/*
2015-02-17 16:38:41 -06:00
* Main driver for wolfCrypt benchmarks.
2013-11-11 17:12:01 -06:00
*/
int main(int argc, char** argv) {
volatile int i ;
int j ;
2014-05-05 02:41:07 -05:00
PRECONbits.PFMWS = 2;
PRECONbits.PREFEN = 0b11;
2013-11-11 17:12:01 -06:00
init_serial() ; /* initialize PIC32MZ serial I/O */
SYSTEMConfigPerformance(80000000);
DBINIT();
printf("wolfCrypt Benchmark:\n");
#ifndef NO_AES
bench_aes(0);
bench_aes(1);
#endif
#ifdef HAVE_AESGCM
bench_aesgcm();
#endif
#ifndef NO_RC4
bench_arc4();
#endif
#ifdef HAVE_HC128
bench_hc128();
#endif
#ifndef NO_RABBIT
bench_rabbit();
#endif
#ifndef NO_DES3
bench_des();
#endif
printf("\n");
#ifndef NO_MD5
bench_md5();
#endif
bench_sha();
#ifndef NO_SHA256
bench_sha256();
#endif
2015-02-17 16:38:41 -06:00
#ifdef WOLFSSL_SHA512
2013-11-11 17:12:01 -06:00
bench_sha512();
#endif
#ifdef CYASSL_RIPEMD
bench_ripemd();
#endif
printf("\n");
#ifndef NO_RSA
bench_rsa();
#endif
#ifndef NO_DH
bench_dh();
#endif
2015-02-17 16:38:41 -06:00
#if defined(WOLFSSL_KEY_GEN) && !defined(NO_RSA)
2013-11-11 17:12:01 -06:00
bench_rsaKeyGen();
#endif
#ifdef HAVE_ECC
bench_eccKeyGen();
bench_eccKeyAgree();
#endif
printf("End of wolfCrypt Benchmark:\n");
return 0;
}