Subject: | Disabling MD5 in FIPS mode |
FIPS 140-2 standard declares MD5 as insecure. The common practice is to disable all insecure algorithms when running a system in FIPS mode. I'm thinking how to extend Digest-MD5 to disable its service in FIPS mode.
First I wanted to modify new() constructor that would return undef instead of Digest::MD5 object. However this return value is not documented and thus not expected by Digest::MD5 users. Although this approach would make sense. (However there is no way how to pass the reason for this error to the caller).
Digest-MD5 provides functional interface too which means we have to affect these subroutines either.
Another approach is to check for FIPS mode and die at Digest::MD5 load time. Actually Digest::MD5 can already die (e.g. if it cannot load the XS module and there is not pure-Perl implementation). However again, this case is not documented so nobody expects it. It would also require to change any application to make using Digest::MD5 optional and keep the state to the point where the MD5 is used in the application. OTOH, one could say modern way how to use any digest algorithm is via Digest->new(), but can we rely on that?
What's you opinion? Where can you see the best place the Digest::MD5 should fail?