diff options
author | Rob Austein <sra@hactrn.net> | 2017-04-14 15:22:25 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2017-04-14 15:22:25 -0400 |
commit | ce8ba928172071dc89cc1fc0520f840211bbfa0d (patch) | |
tree | ae1279914e28ff889565b1fd36d803bd9ac0d66e | |
parent | 81ae5e07be01c0aacc332eb82db2f0ff452ced3d (diff) |
Python interface API will need to be cryptech.py11 for installation.
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | cryptech/__init__.py | 0 | ||||
-rw-r--r-- | cryptech/py11/__init__.py (renamed from py11/__init__.py) | 2 | ||||
-rw-r--r-- | cryptech/py11/attribute_map.py (renamed from py11/attribute_map.py) | 0 | ||||
-rw-r--r-- | cryptech/py11/attributes.py (renamed from py11/attributes.py) | 0 | ||||
-rw-r--r-- | cryptech/py11/constants.py (renamed from py11/constants.py) | 0 | ||||
-rw-r--r-- | cryptech/py11/exceptions.py (renamed from py11/exceptions.py) | 0 | ||||
-rw-r--r-- | cryptech/py11/mutex.py (renamed from py11/mutex.py) | 9 | ||||
-rw-r--r-- | cryptech/py11/prototypes.py (renamed from py11/prototypes.py) | 0 | ||||
-rw-r--r-- | cryptech/py11/types.py (renamed from py11/types.py) | 0 | ||||
-rw-r--r-- | scripts/py11-test.py | 4 | ||||
-rwxr-xr-x | scripts/time-signature.py | 6 | ||||
-rw-r--r-- | unit_tests.py | 6 |
14 files changed, 23 insertions, 22 deletions
@@ -138,10 +138,10 @@ ifndef OBJCOPY OBJCOPY := objcopy endif -all: ${SONAME} p11util py11/attribute_map.py +all: ${SONAME} p11util cryptech/py11/attribute_map.py clean: - rm -rf *.o ${SONAME}* p11util attributes.h py11/*.pyc + rm -rf *.o ${SONAME}* p11util attributes.h cryptech/*.pyc cryptech/py11/*.pyc ${MAKE} -C libtfm $@ ${MAKE} -C libhal $@ @@ -159,8 +159,8 @@ ${LIBHAL_BLD}/libhal.a: .FORCE ${LIBTFM_BLD}/libtfm.a attributes.h: attributes.yaml scripts/build-attributes Makefile python scripts/build-attributes attributes.yaml attributes.h -py11/attribute_map.py: attributes.yaml scripts/build-py11-attributes Makefile - python scripts/build-py11-attributes attributes.yaml py11/attribute_map.py +cryptech/py11/attribute_map.py: attributes.yaml scripts/build-py11-attributes Makefile + python scripts/build-py11-attributes attributes.yaml $@ pkcs11.o: pkcs11.c attributes.h ${LIBS} ${CC} ${CFLAGS} -c $< @@ -190,7 +190,7 @@ tags: TAGS TAGS: *.[ch] etags $^ -# Basic testing, via the Python unittest library and our py11 interface code +# Basic testing, via the Python unittest library and our cryptech.py11 interface code test: all python unit_tests.py @@ -11,10 +11,10 @@ only himself, but all of his friends, relations, and casual acquaintances. Along with the PKCS #11 library itself, the package includes a -companion Python interface ("py11"), which uses the ctypes module from -the Python standard library to talk to the PKCS #11 implementation. -The Python implementation is intended primarily to simplify testing -the C code. +companion Python interface ("cryptech.py11"), which uses the ctypes +module from the Python standard library to talk to the PKCS #11 +implementation. The Python implementation is intended primarily to +simplify testing the C code, but can be used for other purposes. ## Novel design features ## diff --git a/cryptech/__init__.py b/cryptech/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/cryptech/__init__.py diff --git a/py11/__init__.py b/cryptech/py11/__init__.py index da79e34..46b62d6 100644 --- a/py11/__init__.py +++ b/cryptech/py11/__init__.py @@ -19,7 +19,7 @@ class PKCS11 (object): PKCS #11 API object, encapsulating the PKCS #11 library itself. Sample usage: - from py11 import * + from cryptech.py11 import * p11 = PKCS11() p11.C_Initialize() diff --git a/py11/attribute_map.py b/cryptech/py11/attribute_map.py index b689d6e..b689d6e 100644 --- a/py11/attribute_map.py +++ b/cryptech/py11/attribute_map.py diff --git a/py11/attributes.py b/cryptech/py11/attributes.py index 56473ad..56473ad 100644 --- a/py11/attributes.py +++ b/cryptech/py11/attributes.py diff --git a/py11/constants.py b/cryptech/py11/constants.py index a8392ea..a8392ea 100644 --- a/py11/constants.py +++ b/cryptech/py11/constants.py diff --git a/py11/exceptions.py b/cryptech/py11/exceptions.py index 7f86fe4..7f86fe4 100644 --- a/py11/exceptions.py +++ b/cryptech/py11/exceptions.py diff --git a/py11/mutex.py b/cryptech/py11/mutex.py index f71e006..da2123c 100644 --- a/py11/mutex.py +++ b/cryptech/py11/mutex.py @@ -1,6 +1,6 @@ """ -Optional Python mutex implementation for py11 library, using the -threading.Lock primitive to provide the mutex itself. +Optional Python mutex implementation for cryptech.py11 library, +using the threading.Lock primitive to provide the mutex itself. Most of the code in this module has to do with mapping between the Python and PKCS #11 APIs. @@ -13,12 +13,13 @@ test the API. Sample usage: - from p11 import * - from py11.mutex import MutexDB + from cryptech.py11 import * + from cryptech.py11.mutex import MutexDB p11 = PKCS11() mdb = MutexDB() p11.C_Initialize(0, mdb.create, mdb.destroy, mdb.lock, mdb.unlock) + """ from struct import pack, unpack diff --git a/py11/prototypes.py b/cryptech/py11/prototypes.py index 7951515..7951515 100644 --- a/py11/prototypes.py +++ b/cryptech/py11/prototypes.py diff --git a/py11/types.py b/cryptech/py11/types.py index 4d0b279..4d0b279 100644 --- a/py11/types.py +++ b/cryptech/py11/types.py diff --git a/scripts/py11-test.py b/scripts/py11-test.py index 04372ec..87af29d 100644 --- a/scripts/py11-test.py +++ b/scripts/py11-test.py @@ -1,7 +1,7 @@ # Initial test script using py11. About 2/3 testing PKCS #11, 1/3 # doodles figuring out what else py11 should be automating for us. -from py11 import * +from cryptech.py11 import * from struct import pack, unpack def show_token(i, t, strip = True): @@ -77,7 +77,7 @@ elif False: else: print "Using our own pseudo-MUTEXes" - from py11.mutex import MutexDB + from cryptech.py11.mutex import MutexDB mdb = MutexDB() p11.C_Initialize(0, mdb.create, mdb.destroy, mdb.lock, mdb.unlock) diff --git a/scripts/time-signature.py b/scripts/time-signature.py index eef646d..99ec718 100755 --- a/scripts/time-signature.py +++ b/scripts/time-signature.py @@ -15,12 +15,12 @@ from Crypto.Hash.SHA384 import SHA384Hash as SHA384 from Crypto.Hash.SHA512 import SHA512Hash as SHA512 try: - from py11 import * + from cryptech.py11 import * except ImportError: - # Kludge to let us run script from repo without installing py11 + # Kludge to let us run script from repo without installing cryptech.py11 from os.path import dirname, abspath sys.path.append(dirname(dirname(abspath(sys.argv[0])))) - from py11 import * + from cryptech.py11 import * if platform.system() == "Darwin": diff --git a/unit_tests.py b/unit_tests.py index 2fc9d3f..1a7470d 100644 --- a/unit_tests.py +++ b/unit_tests.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """ -PKCS #11 unit tests, using Py11 and the Python unit_test framework. +PKCS #11 unit tests, using cryptech.py11 and the Python unit_test framework. """ import unittest @@ -9,8 +9,8 @@ import datetime import platform import sys -from py11 import * -from py11.mutex import MutexDB +from cryptech.py11 import * +from cryptech.py11.mutex import MutexDB try: from Crypto.Util.number import inverse |