123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- /* benchmark_main.c
- *
- * Copyright (C) 2006-2015 wolfSSL Inc.
- *
- * This file is part of wolfSSL. (formerly known as CyaSSL)
- *
- * wolfSSL is free software; you can redistribute it and/or modify
- * 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.
- *
- * wolfSSL 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 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
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
- #include <wolfssl/wolfcrypt/settings.h>
- #if defined(WOLFSSL_MICROCHIP_PIC32MZ)
- #define MICROCHIP_PIC32
- #include <xc.h>
- #pragma config ICESEL = ICS_PGx2
- /* ICE/ICD Comm Channel Select (Communicate on PGEC2/PGED2) */
- #include <stdio.h>
- #include <stdlib.h>
- #include "PIC32MZ-serial.h"
- #define SYSTEMConfigPerformance /* void out SYSTEMConfigPerformance(); */
- #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
- /*
- * Main driver for wolfCrypt benchmarks.
- */
- 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();
- 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
- #ifdef WOLFSSL_SHA512
- bench_sha512();
- #endif
- #ifdef CYASSL_RIPEMD
- bench_ripemd();
- #endif
- printf("\n");
- #ifndef NO_RSA
- bench_rsa();
- #endif
- #ifndef NO_DH
- bench_dh();
- #endif
- #if defined(WOLFSSL_KEY_GEN) && !defined(NO_RSA)
- bench_rsaKeyGen();
- #endif
- #ifdef HAVE_ECC
- bench_eccKeyGen();
- bench_eccKeyAgree();
- #endif
- printf("End of wolfCrypt Benchmark:\n");
- return 0;
- }
|