aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-10-08 17:51:44 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-10-08 17:51:44 -0700
commit7c26ce88ccaff49ece54733e364b40c7d03c3621 (patch)
tree6d9696cb5e7d3310368204c36e4cda31b062d3f1
parente6998099650038b9cf8451617244822db9e30f57 (diff)
parent5b6fd58196ca526f66fcd9e6b22f17d9b02a4ccd (diff)
downloadcryptography-7c26ce88ccaff49ece54733e364b40c7d03c3621.tar.gz
cryptography-7c26ce88ccaff49ece54733e364b40c7d03c3621.tar.bz2
cryptography-7c26ce88ccaff49ece54733e364b40c7d03c3621.zip
Merge pull request #97 from reaperhulk/openssl-err-bindings
Add OpenSSL error bindings
-rw-r--r--cryptography/bindings/openssl/api.py2
-rw-r--r--cryptography/bindings/openssl/err.py56
2 files changed, 58 insertions, 0 deletions
diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py
index 12927782..9f2399be 100644
--- a/cryptography/bindings/openssl/api.py
+++ b/cryptography/bindings/openssl/api.py
@@ -29,6 +29,7 @@ class API(object):
"crypto",
"dh",
"dsa",
+ "err",
"evp",
"rand",
"rsa",
@@ -63,6 +64,7 @@ class API(object):
)
self.lib.OpenSSL_add_all_algorithms()
+ self.lib.SSL_load_error_strings()
def openssl_version_text(self):
"""
diff --git a/cryptography/bindings/openssl/err.py b/cryptography/bindings/openssl/err.py
new file mode 100644
index 00000000..c7d32492
--- /dev/null
+++ b/cryptography/bindings/openssl/err.py
@@ -0,0 +1,56 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+INCLUDES = """
+#include <openssl/err.h>
+"""
+
+TYPES = """
+struct ERR_string_data_st {
+ unsigned long error;
+ const char *string;
+};
+typedef struct ERR_string_data_st ERR_STRING_DATA;
+typedef ... BIO;
+"""
+
+FUNCTIONS = """
+void SSL_load_error_strings();
+void ERR_load_crypto_strings();
+void ERR_free_strings();
+char* ERR_error_string(unsigned long, char *);
+void ERR_error_string_n(unsigned long, char *, size_t);
+const char* ERR_lib_error_string(unsigned long);
+const char* ERR_func_error_string(unsigned long);
+const char* ERR_reason_error_string(unsigned long);
+void ERR_print_errors(BIO *);
+void ERR_print_errors_fp(FILE *);
+unsigned long ERR_get_error();
+unsigned long ERR_peek_error();
+unsigned long ERR_peek_last_error();
+unsigned long ERR_get_error_line(const char **, int *);
+unsigned long ERR_peek_error_line(const char **, int *);
+unsigned long ERR_peek_last_error_line(const char **, int *);
+unsigned long ERR_get_error_line_data(const char **, int *,
+ const char **, int *);
+unsigned long ERR_peek_error_line_data(const char **,
+ int *, const char **, int *);
+unsigned long ERR_peek_last_error_line_data(const char **,
+ int *, const char **, int *);
+void ERR_put_error(int, int, int, const char *, int);
+void ERR_add_error_data(int, ...);
+int ERR_get_next_error_library();
+"""
+
+MACROS = """
+"""