crypto: dh secret should be left-padded

fix #5239

Should be backported to v0.8.