Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

PEP8 violation corrections.

'lint' make target now also checks OpenSSL ctypes API, ignoring a
couple of violations.
  • Loading branch information...
commit 342c26c73ea62d1cb48fb4fce1765cfbe0e8eae5 1 parent 6bf5954
Aaron Iles authored
View
1  Makefile
@@ -6,6 +6,7 @@ deps:
-r requirements/production.txt
lint:
+ flake8 --exit-zero tls/api/*py | grep -v -E '(E501|W802)'
flake8 --exit-zero tls/*py
dist:
View
2  tests/api/test_bio_sink.py
@@ -256,7 +256,7 @@ class TestBioNullWrite(BioWrite, unittest.TestCase):
class TestBioNullRead(BioRead, unittest.TestCase):
data = b""
-
+
method = bio.BIO_s_null()
test_gets = unittest.expectedFailure(BioRead.test_gets)
View
1  tls/api/bio.py
@@ -98,6 +98,7 @@
# BIO base64
prototype_func('BIO_f_base64', c_method_p, None)
+
# BIO macros
def _bio_ctrl_macro(symbol, errcheck=lambda r, f, a: r, words=1):
"""Create function definition for BIO_ctrl calling macro."""
View
11 tls/api/digest.py
@@ -29,6 +29,7 @@
# Digest C types
prototype_type('c_engine')
+
class c_evp_md(Structure):
_fields_ = (
('type', c_int),
@@ -49,6 +50,7 @@ class c_evp_md(Structure):
c_evp_md_p = POINTER(c_evp_md)
+
class c_evp_md_ctx(Structure):
_fields_ = (
('digest', c_evp_md_p),
@@ -96,32 +98,41 @@ class c_evp_md_ctx(Structure):
prototype_func('EVP_dsa_sha', c_evp_md_p, None)
prototype_func('EVP_dsa_sha1', c_evp_md_p, None)
+
# message digest macros
def EVP_MD_type(md):
return md.contents.type
+
def EVP_MD_pkey_type(md):
return md.contents.pkey_type
+
def EVP_MD_size(md):
return md.contents.md_size
+
def EVP_MD_block_size(md):
return md.contents.block_size
+
# digest context macros
def EVP_MD_CTX_md(ctx):
return ctx.contents.digest
+
def EVP_MD_CTX_size(ctx):
return EVP_MD_size(EVP_MD_CTX_md(ctx))
+
def EVP_MD_CTX_block_size(ctx):
return EVP_MD_block_size(EVP_MD_CTX_md(ctx))
+
def EVP_MD_CTX_type(ctx):
return EVP_MD_type(EVP_MD_CTX_md(ctx))
+
# get macros
def EVP_get_digestbynid(nid):
return EVP_get_digestbyname(OBJ_nid2sn(nid))
View
2  tls/api/exceptions.py
@@ -21,7 +21,7 @@ class ASNError(ValueError, CryptError):
class RANDError(EnvironmentError, CryptError):
"An error with random numbers occured"
-
+
class TLSError(socket.error, CryptError):
"A network error occured with TLS"
View
2  tls/api/nid.py
@@ -2,7 +2,7 @@
# NID_*
undef = 0
-DSS = 66
+DSS = 66
DSS1 = 116
ECDSA = 416
MD2 = 3
View
4 tls/api/objects.py
@@ -9,7 +9,6 @@
from ctypes import c_void_p
from tls.api import build_error_func
-from tls.api import prototype_type
from tls.api import prototype_func
from tls.api.nid import undef
from tls.api.exceptions import ASNError
@@ -20,7 +19,8 @@
error_null = build_object_error(template='Unknown ASN.1 id')
-error_undef = build_object_error(passes= lambda r, a: r != undef, template='Unknown ASN.1 name')
+error_undef = build_object_error(passes=lambda r, a: r != undef, template='Unknown ASN.1 name')
+
# asn.1 object types
class c_obj_name(Structure):
Please sign in to comment.
Something went wrong with that request. Please try again.