summaryrefslogtreecommitdiff
path: root/paramiko/kex_ecdh_nist.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2023-01-09 21:47:53 -0500
committerJeff Forcier <jeff@bitprophet.org>2023-01-09 23:26:00 -0500
commit7b8106e67c51e71fc4074f7851bbaebed4d5be0c (patch)
tree04d3db018d9c6df53fdecbd73a0593e533039b1f /paramiko/kex_ecdh_nist.py
parent76675c7c471c14ec0b3288cec2beaf400b757480 (diff)
downloadparamiko-7b8106e67c51e71fc4074f7851bbaebed4d5be0c.tar.gz
Remove or transmute all use of long()
- When wrapping literals: just go away - When wrapping variables whose values are already definitely integers (eg output of 'id()'): ditto - When wrapping variables of unknown provenance or which are definitely NOT integers: replaced with int()
Diffstat (limited to 'paramiko/kex_ecdh_nist.py')
-rw-r--r--paramiko/kex_ecdh_nist.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/paramiko/kex_ecdh_nist.py b/paramiko/kex_ecdh_nist.py
index eb9eff74..41fab46b 100644
--- a/paramiko/kex_ecdh_nist.py
+++ b/paramiko/kex_ecdh_nist.py
@@ -6,7 +6,6 @@ RFC 5656, Section 4
from hashlib import sha256, sha384, sha512
from paramiko.common import byte_chr
from paramiko.message import Message
-from paramiko.py3compat import long
from paramiko.ssh_exception import SSHException
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import ec
@@ -26,7 +25,7 @@ class KexNistp256:
def __init__(self, transport):
self.transport = transport
# private key, client public and server public keys
- self.P = long(0)
+ self.P = 0
self.Q_C = None
self.Q_S = None
@@ -70,7 +69,7 @@ class KexNistp256:
)
K_S = self.transport.get_server_key().asbytes()
K = self.P.exchange(ec.ECDH(), self.Q_C)
- K = long(hexlify(K), 16)
+ K = int(hexlify(K), 16)
# compute exchange hash
hm = Message()
hm.add(
@@ -88,7 +87,7 @@ class KexNistp256:
serialization.PublicFormat.UncompressedPoint,
)
)
- hm.add_mpint(long(K))
+ hm.add_mpint(int(K))
H = self.hash_algo(hm.asbytes()).digest()
self.transport._set_K_H(K, H)
sig = self.transport.get_server_key().sign_ssh_data(
@@ -116,7 +115,7 @@ class KexNistp256:
)
sig = m.get_binary()
K = self.P.exchange(ec.ECDH(), self.Q_S)
- K = long(hexlify(K), 16)
+ K = int(hexlify(K), 16)
# compute exchange hash and verify signature
hm = Message()
hm.add(