odp icon indicating copy to clipboard operation
odp copied to clipboard

API: crypto: return value of `odp_crypto_cipher_capability`/`odp_crypto_auth_capability`

Open lumag opened this issue 6 years ago • 2 comments

Currently we enforce that crypto capabilities retrieval functions always return same value for 'number of capability structures'. This helps one to use following code sequence easily:

int num_caps = odp_crypto_cipher_capability(ODP_CIPHER_ALG_AES_CBC, NULL, 0);
odp_crypto_cipher_capability_t capa[num_caps];
int ret = odp_crypto_cipher_capability(ODP_CIPHER_ALG_AES_CBC, capa, num_caps);
int i;

for (i = 0; i < num_capa; i++)
    do_something(&capa[i]);

For ODP-DPDK this might lead to inclusion of duplicate or overlapping entries in capabilties structure. Options to consider:

  • leave API as is, document that caps might include overlapping entries
  • change requirement so that ret <= num_capa, forcing users to loop till ret in the second loop
  • ???

lumag avatar Jul 23 '18 10:07 lumag

@lumag is this issue still current?

Bill-Fischofer-Linaro avatar Sep 13 '18 12:09 Bill-Fischofer-Linaro

@Bill-Fischofer-Linaro sure it is.

lumag avatar Sep 13 '18 19:09 lumag