Hello community, here is the log from the commit of package python-libnacl for openSUSE:Factory checked in at 2014-11-04 17:30:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-libnacl (Old) and /work/SRC/openSUSE:Factory/.python-libnacl.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-libnacl" Changes: -------- --- /work/SRC/openSUSE:Factory/python-libnacl/python-libnacl.changes 2014-10-05 20:32:35.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-libnacl.new/python-libnacl.changes 2014-11-04 17:30:41.000000000 +0100 @@ -1,0 +2,8 @@ +Mon Nov 3 19:35:19 UTC 2014 - aboe76@gmail.com + +- Updated to 1.4.0 + + Initial support has been added for the blake2b hash algorithm + + Fix issue with keyfile saves on windows + + Fix libsodium detection for Ubuntu manual installs and Windows dll detection + +------------------------------------------------------------------- Old: ---- libnacl-1.3.6.tar.gz New: ---- libnacl-1.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-libnacl.spec ++++++ --- /var/tmp/diff_new_pack.UelvP4/_old 2014-11-04 17:30:43.000000000 +0100 +++ /var/tmp/diff_new_pack.UelvP4/_new 2014-11-04 17:30:43.000000000 +0100 @@ -16,7 +16,7 @@ # Name: python-libnacl -Version: 1.3.6 +Version: 1.4.0 Release: 0 License: Apache-2.0 Summary: Python bindings for libsodium/tweetnacl based on ctypes ++++++ libnacl-1.3.6.tar.gz -> libnacl-1.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/MANIFEST.in new/libnacl-1.4.0/MANIFEST.in --- old/libnacl-1.3.6/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/MANIFEST.in 2014-10-03 22:21:33.000000000 +0200 @@ -0,0 +1,6 @@ +include LICENSE +include AUTHORS +include README.rst +recursive-include tests * +recursive-include doc * +recursive-include pkg * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/PKG-INFO new/libnacl-1.4.0/PKG-INFO --- old/libnacl-1.3.6/PKG-INFO 2014-09-30 21:02:04.000000000 +0200 +++ new/libnacl-1.4.0/PKG-INFO 2014-11-03 06:18:49.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: libnacl -Version: 1.3.6 +Version: 1.4.0 Summary: Python bindings for libsodium/tweetnacl based on ctypes Home-page: https://libnacl.readthedocs.org/ Author: Thomas S Hatch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/doc/topics/raw_generichash.rst new/libnacl-1.4.0/doc/topics/raw_generichash.rst --- old/libnacl-1.3.6/doc/topics/raw_generichash.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/doc/topics/raw_generichash.rst 2014-11-03 06:02:40.000000000 +0100 @@ -0,0 +1,31 @@ +==================================== +Raw Generic Hash (Blake2b) Functions +==================================== + +The nacl library comes with blake hashing libraries. + +More information on Blake can be found here: +https://blake2.net + +The blake2b hashing algorithm is a keyed hashing algorithm, which allows +for a key to be associated with a hash. Blake can be executed with or without +a key. + +With a key (they key can should be between 16 and 64 bytes): + +.. code-block:: python + + import libnacl + + msg = 'Is there someone else up there we could talk to?' + key = libnacl.randombytes(32) + h_msg = libnacl.crypto_generichash(msg, key) + +Without a key: + +.. code-block:: python + + import libnacl + + msg = 'Is there someone else up there we could talk to?' + h_msg = libnacl.crypto_genrichash(msg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/doc/topics/raw_hash.rst new/libnacl-1.4.0/doc/topics/raw_hash.rst --- old/libnacl-1.3.6/doc/topics/raw_hash.rst 2014-08-13 04:25:43.000000000 +0200 +++ new/libnacl-1.4.0/doc/topics/raw_hash.rst 2014-11-03 05:57:52.000000000 +0100 @@ -2,8 +2,8 @@ Raw Hash Functions ================== -The nacl library comes with sha256 ad sha512 hashing libraries. The do not -seem to offer any benefit over python's hashlib, bt for completeness they are +The nacl library comes with sha256 and sha512 hashing libraries. They do not +seem to offer any benefit over python's hashlib, but for completeness they are included. Creating a hash of a message is very simple: .. code-block:: python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/doc/topics/releases/1.4.0.rst new/libnacl-1.4.0/doc/topics/releases/1.4.0.rst --- old/libnacl-1.3.6/doc/topics/releases/1.4.0.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/doc/topics/releases/1.4.0.rst 2014-11-03 05:54:49.000000000 +0100 @@ -0,0 +1,14 @@ +=========================== +libnacl 1.4.0 Release Notes +=========================== + +Blake Hash Support +================== + +Initial support has been added for the blake2b hash algorithm + +Misc Fixes +========== + +* Fix issue with keyfile saves on windows +* Fix libsodium detection for Ubuntu manual installs and Windows dll detection diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/libnacl/__init__.py new/libnacl-1.4.0/libnacl/__init__.py --- old/libnacl-1.3.6/libnacl/__init__.py 2014-09-30 20:55:54.000000000 +0200 +++ new/libnacl-1.4.0/libnacl/__init__.py 2014-11-03 05:04:03.000000000 +0100 @@ -51,6 +51,11 @@ return ctypes.cdll.LoadLibrary('libsodium.so') except OSError: pass + try: + return ctypes.cdll.LoadLibrary('/usr/local/lib/libsodium.so') + except OSError: + pass + for soname_ver in __SONAMES: try: return ctypes.cdll.LoadLibrary( @@ -95,6 +100,11 @@ crypto_onetimeauth_BYTES = nacl.crypto_onetimeauth_bytes() crypto_onetimeauth_KEYBYTES = nacl.crypto_onetimeauth_keybytes() crypto_generichash_BYTES = nacl.crypto_generichash_bytes() +crypto_generichash_BYTES_MIN = nacl.crypto_generichash_bytes_min() +crypto_generichash_BYTES_MAX = nacl.crypto_generichash_bytes_max() +crypto_generichash_KEYBYTES = nacl.crypto_generichash_keybytes() +crypto_generichash_KEYBYTES_MIN = nacl.crypto_generichash_keybytes_min() +crypto_generichash_KEYBYTES_MAX = nacl.crypto_generichash_keybytes_max() crypto_scalarmult_curve25519_BYTES = nacl.crypto_scalarmult_curve25519_bytes() crypto_hash_BYTES = nacl.crypto_hash_sha512_bytes() crypto_hash_sha256_BYTES = nacl.crypto_hash_sha256_bytes() @@ -263,7 +273,7 @@ ret = nacl.crypto_sign_seed_keypair(vk, sk, seed) if ret: raise CryptError('Failed to generate keypair from seed') - return vk.raw, sk.raw + return (vk.raw, sk.raw) def crypto_sign_open(sig, vk): @@ -430,9 +440,30 @@ nacl.crypto_hash_sha512(hbuf, msg, ctypes.c_ulonglong(len(msg))) return hbuf.raw +# Generic Hash + + +def crypto_generichash(msg, key=None): + ''' + Compute the blake2 hash of the given message with a given key + ''' + hbuf = ctypes.create_string_buffer(crypto_generichash_BYTES) + if key: + key_len = len(key) + else: + key_len = 0 + nacl.crypto_generichash( + hbuf, + ctypes.c_ulonglong(len(hbuf)), + msg, + ctypes.c_ulonglong(len(msg)), + key, + ctypes.c_ulonglong(key_len)) + return hbuf.raw # scalarmult + def crypto_scalarmult_base(n): ''' Computes and returns the scalar product of a standard group element and an @@ -528,22 +559,24 @@ # Utility functions -def sodium_version_major(): +def sodium_library_version_major(): ''' Return the major version number ''' - return nacl.sodium_version_major() + return nacl.sodium_library_version_major() -def sodium_version_minor(): +def sodium_library_version_minor(): ''' Return the minor version number ''' - return nacl.sodium_version_minor() + return nacl.sodium_library_version_minor() def sodium_version_string(): ''' Return the version string ''' - return nacl.sodium_version_string() + func = nacl.sodium_version_string + func.restype = ctypes.c_char_p + return func() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/libnacl/base.py new/libnacl-1.4.0/libnacl/base.py --- old/libnacl-1.3.6/libnacl/base.py 2014-08-15 06:35:36.000000000 +0200 +++ new/libnacl-1.4.0/libnacl/base.py 2014-11-03 05:47:24.000000000 +0100 @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- ''' -Impliment the base key object for other keys to inherit convenience functions +Implement the base key object for other keys to inherit convenience functions ''' # Import libnacl libs import libnacl.encode # Import python libs import os - +import stat class BaseKey(object): ''' @@ -41,20 +41,24 @@ vk = self.hex_vk() seed = self.hex_seed() if sk and pk: - pre['priv'] = sk.decode(encoding='UTF-8') + pre['priv'] = sk.decode('utf-8') if pk: - pre['pub'] = pk.decode(encoding='UTF-8') + pre['pub'] = pk.decode('utf-8') if vk: - pre['verify'] = vk.decode(encoding='UTF-8') + pre['verify'] = vk.decode('utf-8') if seed: - pre['sign'] = seed.decode(encoding='UTF-8') + pre['sign'] = seed.decode('utf-8') if serial == 'msgpack': import msgpack packaged = msgpack.dumps(pre) elif serial == 'json': import json packaged = json.dumps(pre) - cumask = os.umask(191) + + perm_other = stat.S_IWOTH | stat.S_IXOTH | stat.S_IWOTH + perm_group = stat.S_IXGRP | stat.S_IWGRP | stat.S_IRWXG + + cumask = os.umask(perm_other | perm_group) with open(path, 'w+') as fp_: fp_.write(packaged) os.umask(cumask) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/libnacl/blake.py new/libnacl-1.4.0/libnacl/blake.py --- old/libnacl-1.3.6/libnacl/blake.py 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/libnacl/blake.py 2014-11-03 05:43:20.000000000 +0100 @@ -0,0 +1,44 @@ +''' +Mimic very closely the python hashlib classes for blake2b + +NOTE: + This class does not yet implement streaming the msg into the + hash function via the update method +''' + +# Import python libs +import binascii + +# Import libnacl libs +import libnacl + + +class Blake2b(object): + ''' + Manage a Blake2b hash + ''' + def __init__(self, msg, key=None): + self.msg = msg + self.key = key + self.raw_digest = libnacl.crypto_generichash(msg, key) + self.digest_size = len(self.raw_digest) + + def digest(self): + ''' + Return the digest of the string + ''' + return self.raw_digest + + def hexdigest(self): + ''' + Return the hex digest of the string + ''' + return binascii.hexlify(self.raw_digest) + + +def blake2b(msg, key=None): + ''' + Create and return a Blake2b object to mimic the behavior of the python + hashlib functions + ''' + return Blake2b(msg, key) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/libnacl/version.py new/libnacl-1.4.0/libnacl/version.py --- old/libnacl-1.3.6/libnacl/version.py 2014-09-30 21:00:31.000000000 +0200 +++ new/libnacl-1.4.0/libnacl/version.py 2014-11-03 05:40:28.000000000 +0100 @@ -1 +1 @@ -__version__ = '1.3.6' +__version__ = '1.4.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/libnacl.egg-info/PKG-INFO new/libnacl-1.4.0/libnacl.egg-info/PKG-INFO --- old/libnacl-1.3.6/libnacl.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/libnacl.egg-info/PKG-INFO 2014-11-03 06:18:49.000000000 +0100 @@ -0,0 +1,19 @@ +Metadata-Version: 1.1 +Name: libnacl +Version: 1.4.0 +Summary: Python bindings for libsodium/tweetnacl based on ctypes +Home-page: https://libnacl.readthedocs.org/ +Author: Thomas S Hatch +Author-email: thatch@saltstack.com +License: UNKNOWN +Description: UNKNOWN +Platform: UNKNOWN +Classifier: Operating System :: OS Independent +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Topic :: Security :: Cryptography diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/libnacl.egg-info/SOURCES.txt new/libnacl-1.4.0/libnacl.egg-info/SOURCES.txt --- old/libnacl-1.3.6/libnacl.egg-info/SOURCES.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/libnacl.egg-info/SOURCES.txt 2014-11-03 06:18:49.000000000 +0100 @@ -0,0 +1,60 @@ +AUTHORS +LICENSE +MANIFEST.in +README.rst +setup.py +doc/Makefile +doc/conf.py +doc/index.rst +doc/topics/dual.rst +doc/topics/public.rst +doc/topics/raw_generichash.rst +doc/topics/raw_hash.rst +doc/topics/raw_public.rst +doc/topics/raw_secret.rst +doc/topics/raw_sign.rst +doc/topics/secret.rst +doc/topics/sign.rst +doc/topics/utils.rst +doc/topics/releases/1.0.0.rst +doc/topics/releases/1.1.0.rst +doc/topics/releases/1.2.0.rst +doc/topics/releases/1.3.0.rst +doc/topics/releases/1.3.1.rst +doc/topics/releases/1.3.2.rst +doc/topics/releases/1.3.3.rst +doc/topics/releases/1.3.4.rst +doc/topics/releases/1.4.0.rst +doc/topics/releases/index.rst +libnacl/__init__.py +libnacl/base.py +libnacl/blake.py +libnacl/dual.py +libnacl/encode.py +libnacl/public.py +libnacl/secret.py +libnacl/sign.py +libnacl/utils.py +libnacl/version.py +libnacl.egg-info/PKG-INFO +libnacl.egg-info/SOURCES.txt +libnacl.egg-info/dependency_links.txt +libnacl.egg-info/top_level.txt +pkg/rpm/python-libnacl.spec +pkg/suse/python-libnacl.changes +pkg/suse/python-libnacl.spec +tests/runtests.py +tests/unit/__init__.py +tests/unit/test_blake.py +tests/unit/test_dual.py +tests/unit/test_public.py +tests/unit/test_raw_auth_sym.py +tests/unit/test_raw_generichash.py +tests/unit/test_raw_hash.py +tests/unit/test_raw_public.py +tests/unit/test_raw_random.py +tests/unit/test_raw_sign.py +tests/unit/test_save.py +tests/unit/test_secret.py +tests/unit/test_sign.py +tests/unit/test_version.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/libnacl.egg-info/dependency_links.txt new/libnacl-1.4.0/libnacl.egg-info/dependency_links.txt --- old/libnacl-1.3.6/libnacl.egg-info/dependency_links.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/libnacl.egg-info/dependency_links.txt 2014-11-03 06:18:49.000000000 +0100 @@ -0,0 +1 @@ + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/libnacl.egg-info/top_level.txt new/libnacl-1.4.0/libnacl.egg-info/top_level.txt --- old/libnacl-1.3.6/libnacl.egg-info/top_level.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/libnacl.egg-info/top_level.txt 2014-11-03 06:18:49.000000000 +0100 @@ -0,0 +1 @@ +libnacl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/setup.cfg new/libnacl-1.4.0/setup.cfg --- old/libnacl-1.3.6/setup.cfg 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/setup.cfg 2014-11-03 06:18:49.000000000 +0100 @@ -0,0 +1,5 @@ +[egg_info] +tag_date = 0 +tag_svn_revision = 0 +tag_build = + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/setup.py new/libnacl-1.4.0/setup.py --- old/libnacl-1.3.6/setup.py 2014-08-13 04:25:43.000000000 +0200 +++ new/libnacl-1.4.0/setup.py 2014-11-03 03:57:24.000000000 +0100 @@ -3,18 +3,18 @@ # Import python libs import os import sys -# Import libnacl libs -from libnacl.version import __version__ -if 'USE_SETUPTOOLS' in os.environ or 'setuptools' in sys.modules: - from setuptools import setup -else: - from distutils.core import setup +from setuptools import setup NAME = 'libnacl' DESC = ('Python bindings for libsodium/tweetnacl based on ctypes') -VERSION = __version__ +# Version info -- read without importing +_locals = {} +with open('libnacl/version.py') as fp: + exec(fp.read(), None, _locals) +VERSION = _locals['__version__'] + setup(name=NAME, version=VERSION, description=DESC, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/tests/unit/test_blake.py new/libnacl-1.4.0/tests/unit/test_blake.py --- old/libnacl-1.3.6/tests/unit/test_blake.py 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/tests/unit/test_blake.py 2014-11-03 05:45:07.000000000 +0100 @@ -0,0 +1,39 @@ +# Import nacl libs +import libnacl.blake + +# Import python libs +import unittest + + +class TestBlake(unittest.TestCase): + ''' + Test sign functions + ''' + def test_keyless_blake(self): + msg1 = b'Are you suggesting coconuts migrate?' + msg2 = b'Not at all, they could be carried.' + chash1 = libnacl.crypto_generichash(msg1) + chash2 = libnacl.crypto_generichash(msg2) + self.assertNotEqual(msg1, chash1) + self.assertNotEqual(msg2, chash2) + self.assertNotEqual(chash2, chash1) + + def test_key_blake(self): + msg1 = b'Are you suggesting coconuts migrate?' + msg2 = b'Not at all, they could be carried.' + key1 = libnacl.utils.rand_nonce() + key2 = libnacl.utils.rand_nonce() + khash1_1 = libnacl.blake.Blake2b(msg1, key1).digest() + khash1_1_2 = libnacl.blake.Blake2b(msg1, key1).digest() + khash1_2 = libnacl.blake.Blake2b(msg1, key2).digest() + khash2_1 = libnacl.blake.blake2b(msg2, key1).digest() + khash2_2 = libnacl.blake.blake2b(msg2, key2).digest() + self.assertNotEqual(msg1, khash1_1) + self.assertNotEqual(msg1, khash1_2) + self.assertNotEqual(msg2, khash2_1) + self.assertNotEqual(msg2, khash2_2) + self.assertNotEqual(khash1_1, khash1_2) + self.assertNotEqual(khash2_1, khash2_2) + self.assertNotEqual(khash1_1, khash2_1) + self.assertNotEqual(khash1_2, khash2_2) + self.assertEqual(khash1_1, khash1_1_2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/tests/unit/test_raw_generichash.py new/libnacl-1.4.0/tests/unit/test_raw_generichash.py --- old/libnacl-1.3.6/tests/unit/test_raw_generichash.py 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/tests/unit/test_raw_generichash.py 2014-11-03 05:22:20.000000000 +0100 @@ -0,0 +1,39 @@ +# Import nacl libs +import libnacl + +# Import python libs +import unittest + + +class TestGenericHash(unittest.TestCase): + ''' + Test sign functions + ''' + def test_keyless_generichash(self): + msg1 = b'Are you suggesting coconuts migrate?' + msg2 = b'Not at all, they could be carried.' + chash1 = libnacl.crypto_generichash(msg1) + chash2 = libnacl.crypto_generichash(msg2) + self.assertNotEqual(msg1, chash1) + self.assertNotEqual(msg2, chash2) + self.assertNotEqual(chash2, chash1) + + def test_key_generichash(self): + msg1 = b'Are you suggesting coconuts migrate?' + msg2 = b'Not at all, they could be carried.' + key1 = libnacl.utils.rand_nonce() + key2 = libnacl.utils.rand_nonce() + khash1_1 = libnacl.crypto_generichash(msg1, key1) + khash1_1_2 = libnacl.crypto_generichash(msg1, key1) + khash1_2 = libnacl.crypto_generichash(msg1, key2) + khash2_1 = libnacl.crypto_generichash(msg2, key1) + khash2_2 = libnacl.crypto_generichash(msg2, key2) + self.assertNotEqual(msg1, khash1_1) + self.assertNotEqual(msg1, khash1_2) + self.assertNotEqual(msg2, khash2_1) + self.assertNotEqual(msg2, khash2_2) + self.assertNotEqual(khash1_1, khash1_2) + self.assertNotEqual(khash2_1, khash2_2) + self.assertNotEqual(khash1_1, khash2_1) + self.assertNotEqual(khash1_2, khash2_2) + self.assertEqual(khash1_1, khash1_1_2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/tests/unit/test_raw_hash.py new/libnacl-1.4.0/tests/unit/test_raw_hash.py --- old/libnacl-1.3.6/tests/unit/test_raw_hash.py 2014-08-13 04:25:43.000000000 +0200 +++ new/libnacl-1.4.0/tests/unit/test_raw_hash.py 2014-11-03 05:13:14.000000000 +0100 @@ -5,7 +5,7 @@ import unittest -class TestSecretBox(unittest.TestCase): +class TestHash(unittest.TestCase): ''' Test sign functions ''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/tests/unit/test_save.py new/libnacl-1.4.0/tests/unit/test_save.py --- old/libnacl-1.3.6/tests/unit/test_save.py 2014-08-15 07:07:28.000000000 +0200 +++ new/libnacl-1.4.0/tests/unit/test_save.py 2014-11-03 05:12:17.000000000 +0100 @@ -9,7 +9,7 @@ import stat import unittest import tempfile - +import sys class TestSave(unittest.TestCase): ''' @@ -19,7 +19,9 @@ bob = libnacl.dual.DualSecret() alice = libnacl.dual.DualSecret() fh_, bob_path = tempfile.mkstemp() + os.close(fh_) fh_, alice_path = tempfile.mkstemp() + os.close(fh_) bob.save(bob_path) alice.save(alice_path) bob_box = libnacl.public.Box(bob, alice.pk) @@ -49,16 +51,20 @@ msg = b'then leap out of the rabbit, taking the French by surprise' signer = libnacl.sign.Signer() fh_, sign_path = tempfile.mkstemp() + os.close(fh_) signer.save(sign_path) signer_load = libnacl.utils.load_key(sign_path) signed1 = signer.sign(msg) signed2 = signer_load.sign(msg) self.assertEqual(signed1, signed2) + os.remove(sign_path) def test_save_perms(self): bob = libnacl.dual.DualSecret() fh_, bob_path = tempfile.mkstemp() + os.close(fh_) bob.save(bob_path) stats = os.stat(bob_path) - self.assertEqual(stats[stat.ST_MODE], 33152) + expected_perms = 0o100600 if sys.platform != 'win32' else 0o100666 + self.assertEqual(stats[stat.ST_MODE], expected_perms) os.remove(bob_path) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/tests/unit/test_sign.py new/libnacl-1.4.0/tests/unit/test_sign.py --- old/libnacl-1.3.6/tests/unit/test_sign.py 2014-08-15 06:47:45.000000000 +0200 +++ new/libnacl-1.4.0/tests/unit/test_sign.py 2014-11-03 03:55:50.000000000 +0100 @@ -20,3 +20,4 @@ verified2 = veri.verify(signature + msg) self.assertEqual(verified, msg) self.assertEqual(verified2, msg) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnacl-1.3.6/tests/unit/test_version.py new/libnacl-1.4.0/tests/unit/test_version.py --- old/libnacl-1.3.6/tests/unit/test_version.py 1970-01-01 01:00:00.000000000 +0100 +++ new/libnacl-1.4.0/tests/unit/test_version.py 2014-11-03 03:55:50.000000000 +0100 @@ -0,0 +1,22 @@ +""" +Basic tests for version functions +""" + +import libnacl +import unittest + + +# These are copied from libsodium test suite +class TestSodiumVersion(unittest.TestCase): + def test_version_string(self): + self.assertIsNotNone(libnacl.sodium_version_string()) + + def test_library_version_major(self): + # Using assertTrue to keep tests "uniform" and keep compatibility with + # Python 2.6 + self.assertTrue(libnacl.sodium_library_version_major() > 0) + + def test_library_version_minor(self): + # Using assertTrue to keep tests "uniform" and keep compatibility with + # Python 2.6 (assertGreaterEqual appeared in Python 2.7 only) + self.assertTrue(libnacl.sodium_library_version_minor() >= 0) -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org