sara matheu / Mbed 2 deprecated mbed_cyassl

Dependencies:   cyassl_rsa mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include <mbed.h>
00002 #include <time.h>
00003 #include <string>
00004 #include <stdlib.h> 
00005 #include <cstdio>
00006 #include <cstdlib>
00007 #include <alloca.h>
00008 #include <cyassl/asn.h>
00009 #include <cyassl/ctc_rsa.h>
00010 
00011 Serial pc(USBTX, USBRX); // tx, rx
00012  
00013 int main() {
00014     clock_t t_ini, t_fin;
00015     double secs;  
00016     RsaKey genKey;
00017     RNG rng;
00018     InitRng(&rng);  
00019     for (int i=0; i<30;i++){ 
00020         t_ini = clock();       
00021         InitRsaKey(&genKey, 0); 
00022         MakeRsaKey(&genKey, 512, 65537, &rng);
00023         FreeRsaKey(&genKey);
00024         t_fin = clock();
00025         secs = (double)(t_fin - t_ini) / CLOCKS_PER_SEC;
00026         pc.printf("%.16g\n", secs * 1000.0);
00027     }  
00028 }