diff options
| author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-09-24 16:50:21 -0500 |
|---|---|---|
| committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-09-24 16:50:21 -0500 |
| commit | 6b99a1b6d2e55e41bda5a42357e1b92f2e38d2ab (patch) | |
| tree | 3fe1b0d70c3a196b56fcac04eaf2637ea374897e /tests/utils.py | |
| parent | 057b5001adf7bfe0b4fe1c228cf7d1c17c3d00f5 (diff) | |
| download | cryptography-6b99a1b6d2e55e41bda5a42357e1b92f2e38d2ab.tar.gz | |
remove distinction between encrypt/decrypt in the openssl loader
* This was done because all the OpenSSL test vectors we're currently
using are identical between encrypt/decrypt.
* Removed a bunch of unneeded unit tests that checked the
encrypt/decrypt vectors
Diffstat (limited to 'tests/utils.py')
| -rw-r--r-- | tests/utils.py | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/tests/utils.py b/tests/utils.py index 62dfda27d..48a32ebe5 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -105,16 +105,16 @@ def load_cryptrec_vectors(vector_data): return cryptrec_list -def load_openssl_vectors_from_file(filename, op): +def load_openssl_vectors_from_file(filename): base = os.path.join( os.path.dirname(__file__), "primitives", "vectors", "OpenSSL", ) with open(os.path.join(base, filename), "r") as vector_file: - return load_openssl_vectors(vector_file, op) + return load_openssl_vectors(vector_file) -def load_openssl_vectors(vector_data, op): - encrypt, decrypt = [], [] +def load_openssl_vectors(vector_data): + vectors = [] for line in vector_data: line = line.strip() @@ -130,18 +130,5 @@ def load_openssl_vectors(vector_data, op): vector[4].encode("ascii")) # plaintext # some OpenSSL vectors have a final field # 0 for decrypt, 1 for encrypt - if len(vector) == 6: - if int(vector[5]) == 0: - decrypt.append(params) - else: - encrypt.append(params) - else: - # if they don't have 1 or 0 they are meant for both enc & dec - # and should be added to both the encrypt and decrypt list - encrypt.append(params) - decrypt.append(params) - - if op == "ENCRYPT": - return encrypt - else: - return decrypt + vectors.append(params) + return vectors |
