From a66f96cd34fe33864066b632f696f025a4fe4b90 Mon Sep 17 00:00:00 2001 From: Alex Stapleton Date: Fri, 2 May 2014 13:21:28 +0100 Subject: Make sure the signature is truncated properly --- cryptography/hazmat/backends/openssl/backend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py index 729f1471..e00be92f 100644 --- a/cryptography/hazmat/backends/openssl/backend.py +++ b/cryptography/hazmat/backends/openssl/backend.py @@ -1419,8 +1419,9 @@ class _DSASignatureContext(object): 0, data_to_sign, len(data_to_sign), sig_buf, buflen, self._dsa_cdata) assert res == 1 + assert buflen[0] - return self._backend._ffi.buffer(sig_buf)[:] + return self._backend._ffi.buffer(sig_buf)[:buflen[0]] @utils.register_interface(interfaces.CMACContext) -- cgit v1.2.3