Merge pull request #637 from Ayrx/totp-impl
TOTP Implementation
diff --git a/AUTHORS.rst b/AUTHORS.rst
index e9c2f85..c06faf1 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -15,3 +15,4 @@
* Konstantinos Koukopoulos <koukopoulos@gmail.com> (D6BD 52B6 8C99 A91C E2C8 934D 3300 566B 3A46 726E)
* Stephen Holsapple <sholsapp@gmail.com>
* Terry Chia <terrycwk1994@gmail.com>
+* Matthew Iversen <matt@notevencode.com> (2F04 3DCC D6E6 D5AC D262 2E0B C046 E8A8 7452 2973)
diff --git a/cryptography/hazmat/bindings/openssl/ssl.py b/cryptography/hazmat/bindings/openssl/ssl.py
index ca3e96c..25e4967 100644
--- a/cryptography/hazmat/bindings/openssl/ssl.py
+++ b/cryptography/hazmat/bindings/openssl/ssl.py
@@ -136,6 +136,7 @@
typedef struct {
SSL3_STATE *s3;
SSL_SESSION *session;
+ int type;
...;
} SSL;
@@ -219,6 +220,9 @@
const char *SSL_CIPHER_get_name(const SSL_CIPHER *);
int SSL_CIPHER_get_bits(const SSL_CIPHER *, int *);
char *SSL_CIPHER_get_version(const SSL_CIPHER *);
+
+size_t SSL_get_finished(const SSL *, void *, size_t);
+size_t SSL_get_peer_finished(const SSL *, void *, size_t);
"""
MACROS = """
@@ -298,6 +302,8 @@
void SSL_CTX_set_tlsext_servername_callback(
SSL_CTX *,
int (*)(const SSL *, int *, void *));
+
+long SSL_session_reused(SSL *);
"""
CUSTOMIZATIONS = """
diff --git a/setup.py b/setup.py
index a2a7550..681b903 100644
--- a/setup.py
+++ b/setup.py
@@ -11,10 +11,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
+import sys
from distutils.command.build import build
from setuptools import setup, find_packages
-
+from setuptools.command.test import test as TestCommand
base_dir = os.path.dirname(__file__)
@@ -31,6 +32,12 @@
SIX_DEPENDENCY
]
+test_requirements = [
+ "pytest",
+ "pretend",
+ "iso8601"
+]
+
class CFFIBuild(build):
"""
@@ -64,6 +71,19 @@
build.finalize_options(self)
+class PyTest(TestCommand):
+ def finalize_options(self):
+ TestCommand.finalize_options(self)
+ self.test_args = []
+ self.test_suite = True
+
+ def run_tests(self):
+ # Import here because in module scope the eggs are not loaded.
+ import pytest
+ errno = pytest.main(self.test_args)
+ sys.exit(errno)
+
+
with open(os.path.join(base_dir, "README.rst")) as f:
long_description = f.read()
@@ -105,11 +125,13 @@
install_requires=requirements,
setup_requires=requirements,
+ tests_require=test_requirements,
# for cffi
zip_safe=False,
ext_package="cryptography",
cmdclass={
"build": CFFIBuild,
+ "test": PyTest,
}
)