aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/hazmat/backends/openssl/ec.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-06-02 07:51:09 -1000
committerAlex Gaynor <alex.gaynor@gmail.com>2017-06-02 13:51:09 -0400
commit26fcc5c24d7ef7e905181ba044447ed15746c73b (patch)
tree00d9d9d22f28434f57dab94fa03bd357558d6db0 /src/cryptography/hazmat/backends/openssl/ec.py
parenta7e9a22886418b43ecdebd4ea3b5acba5425e822 (diff)
downloadcryptography-26fcc5c24d7ef7e905181ba044447ed15746c73b.tar.gz
cryptography-26fcc5c24d7ef7e905181ba044447ed15746c73b.tar.bz2
cryptography-26fcc5c24d7ef7e905181ba044447ed15746c73b.zip
make signature and verification contexts error better re: prehashed (#3658)
* make signature and verification contexts error better re: prehashed * code review feedback
Diffstat (limited to 'src/cryptography/hazmat/backends/openssl/ec.py')
-rw-r--r--src/cryptography/hazmat/backends/openssl/ec.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/ec.py b/src/cryptography/hazmat/backends/openssl/ec.py
index 3a81f919..b70735dc 100644
--- a/src/cryptography/hazmat/backends/openssl/ec.py
+++ b/src/cryptography/hazmat/backends/openssl/ec.py
@@ -9,7 +9,7 @@ from cryptography.exceptions import (
InvalidSignature, UnsupportedAlgorithm, _Reasons
)
from cryptography.hazmat.backends.openssl.utils import (
- _calculate_digest_and_algorithm
+ _calculate_digest_and_algorithm, _check_not_prehashed
)
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import (
@@ -141,6 +141,7 @@ class _EllipticCurvePrivateKey(object):
def signer(self, signature_algorithm):
_check_signature_algorithm(signature_algorithm)
+ _check_not_prehashed(signature_algorithm.algorithm)
return _ECDSASignatureContext(
self._backend, self, signature_algorithm.algorithm
)
@@ -244,6 +245,7 @@ class _EllipticCurvePublicKey(object):
raise TypeError("signature must be bytes.")
_check_signature_algorithm(signature_algorithm)
+ _check_not_prehashed(signature_algorithm.algorithm)
return _ECDSAVerificationContext(
self._backend, self, signature, signature_algorithm.algorithm
)