Improve crypto for next

cherry picked from ```devel```'s PR