sara matheu
/
mbed_cyassl
rsa con cyassl
main.cpp@0:a0ac34d8494a, 2015-05-31 (annotated)
- Committer:
- saranieves92
- Date:
- Sun May 31 19:31:44 2015 +0000
- Revision:
- 0:a0ac34d8494a
rsa con cyassl
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
saranieves92 | 0:a0ac34d8494a | 1 | #include <mbed.h> |
saranieves92 | 0:a0ac34d8494a | 2 | #include <time.h> |
saranieves92 | 0:a0ac34d8494a | 3 | #include <string> |
saranieves92 | 0:a0ac34d8494a | 4 | #include <stdlib.h> |
saranieves92 | 0:a0ac34d8494a | 5 | #include <cstdio> |
saranieves92 | 0:a0ac34d8494a | 6 | #include <cstdlib> |
saranieves92 | 0:a0ac34d8494a | 7 | #include <alloca.h> |
saranieves92 | 0:a0ac34d8494a | 8 | #include <cyassl/asn.h> |
saranieves92 | 0:a0ac34d8494a | 9 | #include <cyassl/ctc_rsa.h> |
saranieves92 | 0:a0ac34d8494a | 10 | |
saranieves92 | 0:a0ac34d8494a | 11 | Serial pc(USBTX, USBRX); // tx, rx |
saranieves92 | 0:a0ac34d8494a | 12 | |
saranieves92 | 0:a0ac34d8494a | 13 | int main() { |
saranieves92 | 0:a0ac34d8494a | 14 | clock_t t_ini, t_fin; |
saranieves92 | 0:a0ac34d8494a | 15 | double secs; |
saranieves92 | 0:a0ac34d8494a | 16 | RsaKey genKey; |
saranieves92 | 0:a0ac34d8494a | 17 | RNG rng; |
saranieves92 | 0:a0ac34d8494a | 18 | InitRng(&rng); |
saranieves92 | 0:a0ac34d8494a | 19 | for (int i=0; i<30;i++){ |
saranieves92 | 0:a0ac34d8494a | 20 | t_ini = clock(); |
saranieves92 | 0:a0ac34d8494a | 21 | InitRsaKey(&genKey, 0); |
saranieves92 | 0:a0ac34d8494a | 22 | MakeRsaKey(&genKey, 512, 65537, &rng); |
saranieves92 | 0:a0ac34d8494a | 23 | FreeRsaKey(&genKey); |
saranieves92 | 0:a0ac34d8494a | 24 | t_fin = clock(); |
saranieves92 | 0:a0ac34d8494a | 25 | secs = (double)(t_fin - t_ini) / CLOCKS_PER_SEC; |
saranieves92 | 0:a0ac34d8494a | 26 | pc.printf("%.16g\n", secs * 1000.0); |
saranieves92 | 0:a0ac34d8494a | 27 | } |
saranieves92 | 0:a0ac34d8494a | 28 | } |