Various fixes from !35
These bug fixes should be merged independently of the fixes for the test suite to pass in FIPS mode.
Edited  by Anderson Sasaki
These bug fixes should be merged independently of the fixes for the test suite to pass in FIPS mode.