aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/bindings/openssl/evp.py12
-rw-r--r--docs/contributing.rst46
2 files changed, 56 insertions, 2 deletions
diff --git a/cryptography/bindings/openssl/evp.py b/cryptography/bindings/openssl/evp.py
index 63364374..ed43c994 100644
--- a/cryptography/bindings/openssl/evp.py
+++ b/cryptography/bindings/openssl/evp.py
@@ -20,6 +20,8 @@ typedef struct {
...;
} EVP_CIPHER_CTX;
typedef ... EVP_CIPHER;
+typedef ... EVP_MD;
+typedef struct env_md_ctx_st EVP_MD_CTX;
"""
FUNCTIONS = """
@@ -35,6 +37,16 @@ int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *);
const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *);
int EVP_CIPHER_block_size(const EVP_CIPHER *);
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *);
+
+EVP_MD_CTX *EVP_MD_CTX_create();
+int EVP_MD_CTX_copy_ex(EVP_MD_CTX *, const EVP_MD_CTX *);
+int EVP_DigestInit_ex(EVP_MD_CTX *, const EVP_MD *, ENGINE *);
+int EVP_DigestUpdate(EVP_MD_CTX *, const void *, size_t);
+int EVP_DigestFinal_ex(EVP_MD_CTX *, unsigned char *, unsigned int *);
+void EVP_MD_CTX_destroy(EVP_MD_CTX *);
+const EVP_MD *EVP_get_digestbyname(const char *);
+const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *);
+int EVP_MD_size(const EVP_MD *);
"""
MACROS = """
diff --git a/docs/contributing.rst b/docs/contributing.rst
index 2d8fceeb..b125d1af 100644
--- a/docs/contributing.rst
+++ b/docs/contributing.rst
@@ -20,8 +20,8 @@ devastating, ``cryptography`` has a strict code review policy:
* Patches must *never* be pushed directly to ``master``, all changes (even the
most trivial typo fixes!) must be submitted as a pull request.
* A committer may *never* merge their own pull request, a second party must
- merge their changes. If multiple people work on a pull request, the merger
- may not be any of them.
+ merge their changes. If multiple people work on a pull request, it must be
+ merged by someone who did not work on it.
* A patch which breaks tests, or introduces regressions by changing or removing
existing tests should not be merged. Tests must always be passing on
``master``.
@@ -50,6 +50,48 @@ Additionally, every Python code file must contain
from __future__ import absolute_import, division, print_function
+C bindings
+----------
+
+When binding C code with ``cffi`` we have our own style guide, it's pretty
+simple.
+
+Don't name parameters:
+
+.. code-block:: c
+
+ // Good
+ long f(long);
+ // Bad
+ long f(long x);
+
+Don't include stray ``void`` parameters:
+
+.. code-block:: c
+
+ // Good
+ long f();
+ // Bad
+ long f(void);
+
+Wrap lines at 80 characters like so:
+
+.. code-block:: c
+
+ // Pretend this went to 80 characters
+ long f(long, long,
+ int *)
+
+Include a space after commas between parameters:
+
+.. code-block:: c
+
+ // Good
+ long f(int, char *)
+ // Bad
+ long f(int,char *)
+
+
Documentation
-------------