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

Improve error handling in soter_rand() #485

Merged
merged 2 commits into from
Jul 4, 2019

Commits on Jul 3, 2019

  1. Improve error handling in soter_rand()

    First of all, RAND_bytes() may return -1 if the backend does not support
    cryptographically strong pseudo-random generators. Currently we treat
    this as success which is not okay. Report the error properly.
    
    There's also a minor API mismatch between OpenSSL and BoringSSL. OpenSSL
    still mostly uses `int` for buffer lengths while BoringSSL has updated
    its API to use `size_t`. We need to check for possible overflow when
    using OpenSSL, and we do not need to cast anything with BoringSSL.
    
    Finally, while we're here, improve the documentation to clarify when
    SOTER_FAIL may be returned and what it means. Other error codes are
    more or less self-explanatory so we don't mention them.
    ilammy committed Jul 3, 2019
    Configuration menu
    Copy the full SHA
    da288c9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c04fc32 View commit details
    Browse the repository at this point in the history