chrisc wrote:

Hi jurkovi,

What Cortex-M4 processor are you using for your benchmarks?  And what public key size are you using (1024, 2048, 4096, ...)?

Are you using the wolfCrypt benchmark application to run the benchmarks?

Thanks,
Chris

Hi Chris,
sorry for not including the specifications:
I use TM4C123GH6PMI Cortex-M4 80 Mhz.

This is the first time I am working with a microcontroller, so I might have made a mistake somewhere.
The times on web are for 120 Mhz, but these are longer times, encrypting in order of magnitude, and decrypting 4x-longer.


When I used the same commands, I got
RSA 2048 encrypting: 620 ms
RSA 2048 decrypting: 5510 ms

Commands:
1191-byte DER-key inicialized in code (copied from benchmark.c)

   

// RSA crypting:

    int derSz = 1191;
    word32 idx = 0;    
    byte      message [] = "Everyone gets Friday off.";
    const int len = (int)strlen((char*)message);
    byte      enc[256];
    RNG rng; wc_InitRng(&rng);    
    wc_InitRsaKey(&rsaKey, NULL);     
    ret = wc_RsaPrivateKeyDecode(DERarray, &idx, &rsaKey, derSz);       
    word32 ciphreLen = wc_RsaPublicEncrypt(message, len, enc, sizeof(enc), &rsaKey, &rng);        

// RSA decrypting:
    
    byte  out[256];    
    wc_RsaPrivateDecrypt(enc, ciphreLen, out, sizeof(out), &rsaKey);

Hi there,

I'm trying to test how time-demanding is RSA de/crypting and DSA signing and verifying on Cortex-M4 ARM microcontroller.
Now at least 2 things are unclear to me:

  • According the benchmark the RSA crypting should take 88 ms and decrypting 1456.000 ms. My times are 630ms resp. 5570 ms. What can make the difference?

  • According the documentation "fastmath will speed up public key operations like RSA, DH, and DSA".
    So I tried the USE_FAST_MATH directive, but the times were 500 ms rsp. 8200 ms.

Does anybody have the similar experience, or know where do I make a mistake?

I use VisualGDB plugin for Visual Studio. These are directives (the first two commented for non-USE_FAST_MATH setup):

//#define USE_FAST_MATH
//#define TFM_TIMING_RESISTANT

#define WOLFCRYPT_ONLY
#define NO_DEV_RANDOM
#define NO_WRITEV
#define SINGLE_THREADED
#define NO_FILESYSTEM
#define NO_WRITEV
#define NO_TLS
#define NO_DH
#define WOLFSSL_USER_IO


Thanks to anybody who could help.