backport truncation for DSA digests

Fixes an issue with OpenSSL 1.0.0, 1.0.0a, and 1.0.0b. Changelog in the next PR.