In FIPS mode importing md5 Python module will not cause any error but calling md5.md5()
function will throw ValueError since md5 is not available.
Make sure md5.md5() actually works and if not, fall back to use hash replacement that
we already have in wafsamba.
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Sat Dec 8 13:30:07 CET 2012 on sn-devel-104
# make sure we have md5. some systems don't have it
try:
from hashlib import md5
+ try:
+ foo = md5.md5('abcd')
+ except ValueError:
+ raise
except:
try:
import md5
+ try:
+ foo = md5.md5('abcd')
+ except ValueError:
+ raise
except:
import Constants
Constants.SIG_NIL = hash('abcd')