Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LowStar.ConstBuffer, all the way up to the top-level EverCrypt APIs #334

Open
niekbouman opened this issue Aug 7, 2020 · 2 comments

Comments

@niekbouman
Copy link

Hi,

When using the Evercrypt C API, I noticed that the API could slightly be improved by adding the keyword const at various places.

For example, the function prototype:

EverCrypt_Error_error_code
EverCrypt_CTR_create_in(
  Spec_Agile_Cipher_cipher_alg a,
  EverCrypt_CTR_state_s **dst,
  uint8_t *k,
  uint8_t *iv,
  uint32_t iv_len,
  uint32_t c
);

could be adapted to:

EverCrypt_Error_error_code
EverCrypt_CTR_create_in(
  Spec_Agile_Cipher_cipher_alg a,
  EverCrypt_CTR_state_s **dst,
  const uint8_t *k,
  const uint8_t *iv,
  uint32_t iv_len,
  uint32_t c
);

Would you agree, or is there a specific reason for not using const at those places?

Kind regards,
Niek

And last but not least: thank you all for doing this great work and contributing it as open source!

@msprotz
Copy link
Contributor

msprotz commented Aug 10, 2020

Hi Niek,

Absolutely agreed, it's just a matter of "upgrading" a bunch of code to use the (somewhat recent) const pointer abstraction that until recently was not available in our modeling of C. I'll leave this issue open so that we can post updates if we upgrade some code to rely on const more.

Thanks,

Jonathan

@niekbouman
Copy link
Author

Cool 👍

@msprotz msprotz changed the title const-correctness in Evercrypt API Use LowStar.ConstBuffer, all the way up to the top-level EverCrypt APIs Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants