Fixes to crypto to get device registration working.