Ejemplo n.º 1
0
void bench_aesgcm(void)
{
    Aes    enc;
    double start, total, persec;
    int    i;

    AesGcmSetKey(&enc, key, 16, iv);
    AesGcmSetExpIV(&enc, iv+4);
    start = current_time();

    for(i = 0; i < megs; i++)
        AesGcmEncrypt(&enc, cipher, plain, sizeof(plain),
                      tag, 16, additional, 13);

    total = current_time() - start;

    persec = 1 / total * megs;
    printf("AES-GCM  %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
           persec);
}
Ejemplo n.º 2
0
void bench_aesgcm(void)
{
    Aes    enc;
    double start, total, persec;
    int    i;

    AesGcmSetKey(&enc, key, 16);
    start = current_time(1);

    for(i = 0; i < numBlocks; i++)
        AesGcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12,
                        tag, 16, additional, 13);

    total = current_time(0) - start;

    persec = 1 / total * numBlocks;
#ifdef BENCH_EMBEDDED
    /* since using kB, convert to MB/s */
    persec = persec / 1024;
#endif

    printf("AES-GCM  %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
                                              blockType, total, persec);
}