Skip to content

Commit

Permalink
fix CertificateVerify signatures for tlsfuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Apr 2, 2019
1 parent 1016aa3 commit 7872e15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tlslite/keyexchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def verifyServerKeyExchange(serverKeyExchange, publicKey, clientRandom,
@staticmethod
def calcVerifyBytes(version, handshakeHashes, signatureAlg,
premasterSecret, clientRandom, serverRandom,
prf_name = None, peer_tag=b'client'):
prf_name = None, peer_tag=b'client', key_type="rsa"):
"""Calculate signed bytes for Certificate Verify"""
if version == (3, 0):
masterSecret = calcMasterSecret(version,
Expand All @@ -265,10 +265,9 @@ def calcVerifyBytes(version, handshakeHashes, signatureAlg,
serverRandom)
verifyBytes = handshakeHashes.digestSSL(masterSecret, b"")
elif version in ((3, 1), (3, 2)):
if not signatureAlg:
if key_type != "ecdsa":
verifyBytes = handshakeHashes.digest()
else:
assert signatureAlg[1] == SignatureAlgorithm.ecdsa
verifyBytes = handshakeHashes.digest("sha1")
elif version == (3, 3):
if signatureAlg[1] != SignatureAlgorithm.ecdsa:
Expand Down Expand Up @@ -336,7 +335,8 @@ def makeCertificateVerify(version, handshakeHashes, validSigAlgs,
signatureAlgorithm,
premasterSecret,
clientRandom,
serverRandom)
serverRandom,
privateKey.key_type)
if signatureAlgorithm[1] == SignatureAlgorithm.ecdsa:
padding = None
hashName = HashAlgorithm.toRepr(signatureAlgorithm[0])
Expand Down
3 changes: 2 additions & 1 deletion tlslite/tlsconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3759,7 +3759,8 @@ def _serverCertKeyExchange(self, clientHello, serverHello,
signatureAlgorithm,
premasterSecret,
clientHello.random,
serverHello.random)
serverHello.random,
key_type=clientCertChain.x509List[0].certAlg)
publicKey = clientCertChain.getEndEntityPublicKey()
if clientCertChain.x509List[0].certAlg != "ecdsa" and \
len(publicKey) < settings.minKeySize:
Expand Down

0 comments on commit 7872e15

Please sign in to comment.