aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utils.py
diff options
context:
space:
mode:
authorTorin Carey <torin@tcarey.uk>2020-04-04 22:30:59 +0100
committerGitHub <noreply@github.com>2020-04-04 17:30:59 -0400
commite94a9f493b208b83982ff2378272879e74829f4f (patch)
treeca9f445fa9ec957be384a381dc3874087d4ae035 /tests/utils.py
parentaece5b3d47282beed31f7119e273b65816a0cf93 (diff)
downloadcryptography-e94a9f493b208b83982ff2378272879e74829f4f.tar.gz
cryptography-e94a9f493b208b83982ff2378272879e74829f4f.tar.bz2
cryptography-e94a9f493b208b83982ff2378272879e74829f4f.zip
Replace floating point arithmetic with integer arithmetic (#5181)
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/utils.py b/tests/utils.py
index ca3245b0..7e79830b 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -7,7 +7,6 @@ from __future__ import absolute_import, division, print_function
import binascii
import collections
import json
-import math
import os
import re
from contextlib import contextmanager
@@ -744,15 +743,15 @@ def load_x963_vectors(vector_data):
vector["key_data_length"] = key_data_len
elif line.startswith("Z"):
vector["Z"] = line.split("=")[1].strip()
- assert math.ceil(shared_secret_len / 8) * 2 == len(vector["Z"])
+ assert ((shared_secret_len + 7) // 8) * 2 == len(vector["Z"])
elif line.startswith("SharedInfo"):
if shared_info_len != 0:
vector["sharedinfo"] = line.split("=")[1].strip()
silen = len(vector["sharedinfo"])
- assert math.ceil(shared_info_len / 8) * 2 == silen
+ assert ((shared_info_len + 7) // 8) * 2 == silen
elif line.startswith("key_data"):
vector["key_data"] = line.split("=")[1].strip()
- assert math.ceil(key_data_len / 8) * 2 == len(vector["key_data"])
+ assert ((key_data_len + 7) // 8) * 2 == len(vector["key_data"])
vectors.append(vector)
vector = {}