[openssl-users] AES-GCM processing time

Michael Wojcik Michael.Wojcik at microfocus.com
Tue Apr 7 13:08:11 UTC 2015

> From: openssl-users [mailto:openssl-users-bounces at openssl.org] On Behalf Of Amir Reda
> Sent: Tuesday, April 07, 2015 08:50

> i am using Authenticated Encryption AES-GCM. i am trying to calculate the processing time for encrypting a data
> message of size 500 byte 

You'll need a pretty high-resolution timer to time encrypting 500 bytes.

>    startEncryption = clock();

The C library function clock() does not provide a high-resolution timer. In fact, it doesn't provide a timer at all. Consult the documentation, or, better, the C standard (ISO 9899).

> this made the processing time is 0 msec 

No, because "processing time" is not what clock() returns, and a zero difference doesn't mean "no time elapsed".

You need to consult the documentation for your platform to determine what high-resolution timers are available. Even with that, however, your test design is largely useless, because what you're trying to measure will be swamped by environmental effects (unless you're running on in an extremely restricted platform, like a single-task embedded system). At the very least, you need to measure many encryptions and take the average.

Michael Wojcik
Technology Specialist, Micro Focus

This message has been scanned for malware by Websense. www.websense.com

More information about the openssl-users mailing list