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

Documentation of fips::enable doesn't seem to match what boringSSL does #150

Closed
cjpatton opened this issue Aug 14, 2023 · 0 comments
Closed

Comments

@cjpatton
Copy link
Collaborator

The fips module in the boring crate has the following method:

 /// Moves the library into or out of the FIPS 140-2 mode of operation.                                                                                                                                                                                               
 ///
 /// This corresponds to `FIPS_mode_set`.
 pub fn enable(enabled: bool) -> Result<(), ErrorStack> {
     unsafe { cvt(ffi::FIPS_mode_set(enabled as _)).map(|_| ()) } op:                                                                                                                                                                                                 
 }   

However this is not what FIPS_mode_set promises to do. From include/openssl/crypto.h in build-sys/deps/boringssl-fips:

 // FIPS_mode_set returns one if |on| matches whether BoringSSL was built with                                                                                                                                                                                          
 // |BORINGSSL_FIPS| and zero otherwise.
 OPENSSL_EXPORT int FIPS_mode_set(int on);

Indeed, here is the implementation:

int FIPS_mode_set(int on) { return on == FIPS_mode(); }
nox added a commit to nox/boring that referenced this issue Oct 9, 2023
In boringssl, FIPS_mode_set is more or less useless, and
it doesn't even set an error stack at all on failure,
so there is no point using it instead of FIPS_mode.
nox added a commit to nox/boring that referenced this issue Oct 9, 2023
In boringssl, FIPS_mode_set is more or less useless, and
it doesn't even set an error stack at all on failure,
so there is no point using it instead of FIPS_mode.
@ghedo ghedo closed this as completed in 6c681a4 Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant