-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error handling in soter_rand() (#485)
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.
- Loading branch information
Showing
3 changed files
with
29 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters