Re: [openssl-users] AES-GCM processing time

2015-04-07 Thread Salz, Rich
> At the
> very least, you need to measure many encryptions and take the average.

+1  Also look at the openssl speed app.

--  
Senior Architect, Akamai Technologies
IM: richs...@jabber.at Twitter: RichSalz


___
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] AES-GCM processing time

2015-04-07 Thread Michael Wojcik
> From: openssl-users [mailto:openssl-users-boun...@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
___
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


[openssl-users] AES-GCM processing time

2015-04-07 Thread Amir Reda
dear all
i am using Authenticated Encryption AES-GCM. i am trying to calculate the
processing time for encrypting a data message of size 500 byte

clock_t startEncryption, endEncryption;
double msecs1;

startEncryption = clock();

unsigned char plaintext[500] =
{'f','a','3','1','3','2','2','5','f','8','8','4','0','6','e','5','a','5','5','9','0','9','c','5','a','f','f','5','2','6','9','a','8','6','a','7','a','9','5','3','1','5','3','4','f','7','d','a','2','e','4','c','3','0','3','d','8','a','3','1','8','a','7','2','1','c','3','c','0','c','9','5','9','5','6','8','0','9','5','3','2','f','c','f','0','e','2','4','4','9','a','6','b','5','2','5','b','1','6','a','e','d','f','5','a','a','0','d','e','6','5','7','b','a','6','3','7','b','3','9','f','a','3','1','3','2','2','5','f','8','8','4','0','6','e','5','a','5','5','9','0','9','c','5','a','f','f','5','2','6','9','a','8','6','a','7','a','9','5','3','1','5','3','4','f','7','d','a','2','e','4','c','3','0','3','d','8','a','3','1','8','a','7','2','1','c','3','c','0','c','9','5','9','5','6','8','0','9','5','3','2','f','c','f','0','e','2','4','4','9','a','6','b','5','2','5','b','1','6','a','e','d','f','5','a','a','0','d','e','6','5','7','b','a','6','3','7','b','3','9',

'f','a','3','1','3','2','2','5','f','8','8','4','0','6','e','5','a','5','5','9','0','9','c','5','a','f','f','5','2','6','9','a','8','6','a','7','a','9','5','3','1','5','3','4','f','7','d','a','2','e','4','c','3','0','3','d','8','a','3','1','8','a','7','2','1','c','3','c','0','c','9','5','9','5','6','8','0','9','5','3','2','f','c','f','0','e','2','4','4','9','a','6','b','5','2','5','b','1','6','a','e','d','f','5','a','a','0','d','e','6','5','7','b','a','6','3','7','b','3','9'

,'f','a','3','1','3','2','2','5','f','8','8','4','0','6','e','5','a','5','5','9','0','9','c','5','a','f','f','5','2','6','9','a','8','6','a','7','a','9','5','3','1','5','3','4','f','7','d','a','2','e','4','c','3','0','3','d','8','a','3','1','8','a','7','2','1','c','3','c','0','c','9','5','9','5','6','8','0','9','5','3','2','f','c','f','0','e','2','4','4','9','a','6','b','5','2','5','b','1','6','a','e','d','f','5','a','a','0','d','e','6','5','7','b','a','6','3','7','b','3','9'

,'f','a','3','1','3','2','2','5','f','8','8','4','0','6','e','5','a','5','5','9'};
unsigned char key [32] =
{'f','e','f','f','e',9,9,2,8,6,6,5,7,3,1,'c',6,'d',6,'a',8,'f',9,4,6,7,3,0,8,3,0,8};
//unsigned char key [48] = "";

unsigned char aad[8] = {'f','e','e','d','f','a','c','e'};
//unsigned char iv[24] =
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
unsigned char iv[16] = {9,3,1,3,2,2,5,'d','f',8,8,4,0,6,'e',5};
unsigned char cipher[500];
unsigned char tag[16];

unsigned char extractedpalintext[500];

int encryptionsize = 0;
encryptionsize =
servertest.AuthenticationEncryption(plaintext,500,aad,8,key,32,iv,16,cipher,tag);
servertest.AuthenticationDecryption(cipher,500,aad,8,tag,key,32,iv,16,extractedpalintext);

servertest.AuthenticationDecryption(cipher,120,fakeaad,40,tag,key,32,iv,120,extractedpalintext);

endEncryption = clock();
msecs1 = ((double) (endEncryption - startEncryption)) * 100.0 /
CLOCKS_PER_SEC;
cout<<"time for encryption "<< " start "< 0)
 {
 cout<<"success final decryption"<___
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users