File: reenable-redefined-tests.patch

package info (click to toggle)
python-crypto 2.6-4%2Bdeb7u3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,752 kB
  • sloc: ansic: 12,455; python: 10,474; makefile: 42; sh: 5
file content (89 lines) | stat: -rw-r--r-- 4,115 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Description: Re-enable redefined tests.
 The test suite contains tests that are disabled because they have the same name
 as other tests. Renaming them enables them again.
 .
 PKCS1_OAEP_Tests.testEncryptDecrypt1 is updated to work with the new interface
 of PKCS1_OAEP.
Author: Sebastian Ramacher <s.ramacher@gmx.at>
Last-Update: 2012-05-28
Forwarded: https://github.com/dlitz/pycrypto/pull/16

diff --git a/lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py b/lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py
index accca61..7ca5c15 100644
--- a/lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py
+++ b/lib/Crypto/SelfTest/Cipher/test_pkcs1_oaep.py
@@ -314,11 +314,12 @@ class PKCS1_OAEP_Tests(unittest.TestCase):
                 # Encrypt/Decrypt messages of length [0..128-2*20-2]
                 for pt_len in xrange(0,128-2*20-2):
                     pt = self.rng(pt_len)
-                    ct = PKCS.encrypt(pt, self.key1024)
-                    pt2 = PKCS.decrypt(ct, self.key1024)
+                    cipher = PKCS.new(self.key1024)
+                    ct = cipher.encrypt(pt)
+                    pt2 = cipher.decrypt(ct)
                     self.assertEqual(pt,pt2)
 
-        def testEncryptDecrypt1(self):
+        def testEncryptDecrypt2(self):
                 # Helper function to monitor what's requested from RNG
                 global asked
                 def localRng(N):
@@ -337,7 +338,7 @@ class PKCS1_OAEP_Tests(unittest.TestCase):
                     self.assertEqual(cipher.decrypt(ct), pt)
                     self.failUnless(asked > hashmod.digest_size)
 
-        def testEncryptDecrypt2(self):
+        def testEncryptDecrypt3(self):
                 # Verify that OAEP supports labels
                 pt = self.rng(35)
                 xlabel = self.rng(22)
@@ -345,7 +346,7 @@ class PKCS1_OAEP_Tests(unittest.TestCase):
                 ct = cipher.encrypt(pt)
                 self.assertEqual(cipher.decrypt(ct), pt)
 
-        def testEncryptDecrypt3(self):
+        def testEncryptDecrypt4(self):
                 # Verify that encrypt() uses the custom MGF
                 global mgfcalls
                 # Helper function to monitor what's requested from MGF
diff --git a/lib/Crypto/SelfTest/PublicKey/test_importKey.py b/lib/Crypto/SelfTest/PublicKey/test_importKey.py
index 28a7eee..f7c1edc 100644
--- a/lib/Crypto/SelfTest/PublicKey/test_importKey.py
+++ b/lib/Crypto/SelfTest/PublicKey/test_importKey.py
@@ -298,7 +298,7 @@ Lr7UkvEtFrRhDDKMtuIIq19FrL4pUIMymPMSLBn3hJLe30Dw48GQM4UCAwEAAQ==
         self.assertEqual(openssh_1[0], openssh_2[0])
         self.assertEqual(openssh_1[1], openssh_2[1])
 
-    def testExportKey4(self):
+    def testExportKey6(self):
         key = self.rsa.construct([self.n, self.e, self.d, self.p, self.q, self.pInv])
         # Tuple with index #1 is encrypted with 3DES
         t = map(b,self.rsaKeyEncryptedPEM[1])
@@ -307,12 +307,12 @@ Lr7UkvEtFrRhDDKMtuIIq19FrL4pUIMymPMSLBn3hJLe30Dw48GQM4UCAwEAAQ==
         pemKey = key.exportKey("PEM", t[0])
         self.assertEqual(pemKey, t[1])
 
-    def testExportKey5(self):
+    def testExportKey7(self):
         key = self.rsa.construct([self.n, self.e, self.d, self.p, self.q, self.pInv])
         derKey = key.exportKey("DER", pkcs=8)
         self.assertEqual(derKey, self.rsaKeyDER8)
 
-    def testExportKey6(self):
+    def testExportKey8(self):
         key = self.rsa.construct([self.n, self.e, self.d, self.p, self.q, self.pInv])
         pemKey = key.exportKey("PEM", pkcs=8)
         self.assertEqual(pemKey, b(self.rsaKeyPEM8))
diff --git a/lib/Crypto/SelfTest/Util/test_asn1.py b/lib/Crypto/SelfTest/Util/test_asn1.py
index 578dabe..bbd0a39 100644
--- a/lib/Crypto/SelfTest/Util/test_asn1.py
+++ b/lib/Crypto/SelfTest/Util/test_asn1.py
@@ -156,7 +156,7 @@ class DerSequenceTests(unittest.TestCase):
 		self.assertEqual(der[1:-1],[9])
 		self.assertEquals(der.encode(), b('0\x0A\x02\x02\x01\x80\x02\x01\x09\x02\x01\x08'))
 
-	def testEncode6(self):
+	def testEncode7(self):
 		# One integer and another type (no matter what it is)
 		der = DerSequence()
 		der.append(0x180L)