openbsd-ports/security/py-crypto/patches/patch-Util_test_py
wcmaier 4b1391964c Take MAINTAINERSHIP from ish@ (timed out).
Clean up port (MODPY_EGG_VERSION, SUBST_VARS, typo in license
marker) and regen patches while here.

ok merdely@
2008-06-11 02:59:32 +00:00

80 lines
3.4 KiB
Plaintext

$OpenBSD: patch-Util_test_py,v 1.2 2008/06/11 02:59:32 wcmaier Exp $
--- Util/test.py.orig Fri Aug 13 17:24:18 2004
+++ Util/test.py Wed May 28 20:55:21 2008
@@ -223,8 +223,7 @@ def TestStreamModules(args=['arc4', 'XOR'], verbose=1)
die('XOR failed on entry '+`entry`)
-def TestBlockModules(args=['aes', 'arc2', 'des', 'blowfish', 'cast', 'des3',
- 'idea', 'rc5'],
+def TestBlockModules(args=['aes', 'des', 'blowfish', 'cast', 'des3'],
verbose=1):
import string
args=map(string.lower, args)
@@ -267,23 +266,6 @@ def TestBlockModules(args=['aes', 'arc2', 'des', 'blow
if verbose: print
- if 'arc2' in args:
- ciph=exerciseBlockCipher('ARC2', verbose) # Alleged RC2
- if (ciph!=None):
- if verbose: print ' Verifying against test suite...'
- for entry in testdata.arc2:
- key,plain,cipher=entry
- key=binascii.a2b_hex(key)
- plain=binascii.a2b_hex(plain)
- cipher=binascii.a2b_hex(cipher)
- obj=ciph.new(key, ciph.MODE_ECB)
- ciphertext=obj.encrypt(plain)
- if (ciphertext!=cipher):
- die('ARC2 failed on entry '+`entry`)
- for i in ciphertext:
- if verbose: print hex(ord(i)),
- print
-
if 'blowfish' in args:
ciph=exerciseBlockCipher('Blowfish',verbose)# Bruce Schneier's Blowfish cipher
if (ciph!=None):
@@ -413,41 +395,5 @@ def TestBlockModules(args=['aes', 'arc2', 'des', 'blow
ciphertext=obj1.encrypt(plain)
if (ciphertext!=cipher):
die('DES3 CBC mode failed on entry '+`entry`)
-
- if 'idea' in args:
- ciph=exerciseBlockCipher('IDEA', verbose) # IDEA block cipher
- if (ciph!=None):
- if verbose: print ' Verifying against test suite...'
- for entry in testdata.idea:
- key,plain,cipher=entry
- key=binascii.a2b_hex(key)
- plain=binascii.a2b_hex(plain)
- cipher=binascii.a2b_hex(cipher)
- obj=ciph.new(key, ciph.MODE_ECB)
- ciphertext=obj.encrypt(plain)
- if (ciphertext!=cipher):
- die('IDEA failed on entry '+`entry`)
-
- if 'rc5' in args:
- # Ronald Rivest's RC5 algorithm
- ciph=exerciseBlockCipher('RC5', verbose)
- if (ciph!=None):
- if verbose: print ' Verifying against test suite...'
- for entry in testdata.rc5:
- key,plain,cipher=entry
- key=binascii.a2b_hex(key)
- plain=binascii.a2b_hex(plain)
- cipher=binascii.a2b_hex(cipher)
- obj=ciph.new(key[4:], ciph.MODE_ECB,
- version =ord(key[0]),
- word_size=ord(key[1]),
- rounds =ord(key[2]) )
- ciphertext=obj.encrypt(plain)
- if (ciphertext!=cipher):
- die('RC5 failed on entry '+`entry`)
- for i in ciphertext:
- if verbose: print hex(ord(i)),
- if verbose: print
-