Attaching a cipher to a EVP_MD_CTX?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm cleaning up code that uses cmac.h
The context is NTP authentication with only 48 bytes of data for each packet.

The current code uses one context, several ciphers, and many keys.

CMAC_init() takes both a key and cipher.

EVP_MAC_init() takes a key and params.

If you want to switch ciphers, you have to put it into a param.  I'm using:
        params[0] =
          OSSL_PARAM_construct_utf8_string("cipher", 'AES-128-CBC", 0);
and
        EVP_MAC_CTX_set_params(ctx, params);

Is there something I've missed that would take a cipher and avoid the string 
compares?

Numbers, on a 3.5 GHz PC:
  AES-128, 48 byte packets:
   971 ns  load cipher and key each time
   462 ns, preload cipher, load key each time
   210 ns, preload cipher and key, EVP_MAC_init(ctx, NULL, 0, NULL)

   850 ns, CMAC_Init(ctx, key, keylength, cipher, NULL)

Notice that loading a key doubles the time to process short packets like 
these.  What's it doing?


But those numbers open the door to a time-space tradeoff.  I haven't been down 
that rathole yet.








-- 
These are my opinions.  I hate spam.






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux