diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2019-03-08 01:06:30 +0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2019-03-07 12:06:30 -0500 |
commit | bc6f74f046ac3a2b41edbfba1529b6b32d893761 (patch) | |
tree | 1b3adc3f3ab63c5e42329afd69c395d1ec2cf48b /src | |
parent | 0d30f5d5ba23c51e63681309b2acd09b9b998bb3 (diff) | |
download | cryptography-bc6f74f046ac3a2b41edbfba1529b6b32d893761.tar.gz cryptography-bc6f74f046ac3a2b41edbfba1529b6b32d893761.tar.bz2 cryptography-bc6f74f046ac3a2b41edbfba1529b6b32d893761.zip |
add poly1305 NID/EVP, and EVP_DigestSign{Update,Final} for incremental (#4799)
Diffstat (limited to 'src')
-rw-r--r-- | src/_cffi_src/openssl/evp.py | 9 | ||||
-rw-r--r-- | src/_cffi_src/openssl/nid.py | 8 | ||||
-rw-r--r-- | src/cryptography/hazmat/bindings/openssl/_conditional.py | 8 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/_cffi_src/openssl/evp.py b/src/_cffi_src/openssl/evp.py index e4d3f057..a0767021 100644 --- a/src/_cffi_src/openssl/evp.py +++ b/src/_cffi_src/openssl/evp.py @@ -25,6 +25,7 @@ static const int EVP_PKEY_X25519; static const int EVP_PKEY_ED25519; static const int EVP_PKEY_X448; static const int EVP_PKEY_ED448; +static const int EVP_PKEY_POLY1305; static const int EVP_MAX_MD_SIZE; static const int EVP_CTRL_AEAD_SET_IVLEN; static const int EVP_CTRL_AEAD_GET_TAG; @@ -83,6 +84,8 @@ int EVP_VerifyFinal(EVP_MD_CTX *, const unsigned char *, unsigned int, int EVP_DigestSignInit(EVP_MD_CTX *, EVP_PKEY_CTX **, const EVP_MD *, ENGINE *, EVP_PKEY *); +int EVP_DigestSignUpdate(EVP_MD_CTX *, const void *, size_t); +int EVP_DigestSignFinal(EVP_MD_CTX *, unsigned char *, size_t *); int EVP_DigestVerifyInit(EVP_MD_CTX *, EVP_PKEY_CTX **, const EVP_MD *, ENGINE *, EVP_PKEY *); @@ -266,4 +269,10 @@ static const long Cryptography_HAS_EVP_DIGESTFINAL_XOF = 1; #ifndef EVP_PKEY_ED448 #define EVP_PKEY_ED448 NID_ED448 #endif + +/* This is tied to poly1305 support so we reuse the Cryptography_HAS_POLY1305 + conditional to remove it. */ +#ifndef EVP_PKEY_POLY1305 +#define EVP_PKEY_POLY1305 NID_poly1305 +#endif """ diff --git a/src/_cffi_src/openssl/nid.py b/src/_cffi_src/openssl/nid.py index 8408d6b3..cdd4c0db 100644 --- a/src/_cffi_src/openssl/nid.py +++ b/src/_cffi_src/openssl/nid.py @@ -13,6 +13,7 @@ static const int Cryptography_HAS_X25519; static const int Cryptography_HAS_X448; static const int Cryptography_HAS_ED448; static const int Cryptography_HAS_ED25519; +static const int Cryptography_HAS_POLY1305; static const int NID_undef; static const int NID_pbe_WithSHA1And3_Key_TripleDES_CBC; @@ -20,6 +21,7 @@ static const int NID_X25519; static const int NID_X448; static const int NID_ED25519; static const int NID_ED448; +static const int NID_poly1305; static const int NID_subject_alt_name; static const int NID_crl_reason; @@ -53,4 +55,10 @@ static const int NID_ED448 = 0; #else static const long Cryptography_HAS_ED448 = 1; #endif +#ifndef NID_poly1305 +static const long Cryptography_HAS_POLY1305 = 0; +static const int NID_poly1305 = 0; +#else +static const long Cryptography_HAS_POLY1305 = 1; +#endif """ diff --git a/src/cryptography/hazmat/bindings/openssl/_conditional.py b/src/cryptography/hazmat/bindings/openssl/_conditional.py index f1694684..a1f78193 100644 --- a/src/cryptography/hazmat/bindings/openssl/_conditional.py +++ b/src/cryptography/hazmat/bindings/openssl/_conditional.py @@ -240,6 +240,13 @@ def cryptography_has_ed25519(): ] +def cryptography_has_poly1305(): + return [ + "NID_poly1305", + "EVP_PKEY_POLY1305", + ] + + def cryptography_has_oneshot_evp_digest_sign_verify(): return [ "EVP_DigestSign", @@ -402,6 +409,7 @@ CONDITIONAL_NAMES = { "Cryptography_HAS_X448": cryptography_has_x448, "Cryptography_HAS_ED448": cryptography_has_ed448, "Cryptography_HAS_ED25519": cryptography_has_ed25519, + "Cryptography_HAS_POLY1305": cryptography_has_poly1305, "Cryptography_HAS_ONESHOT_EVP_DIGEST_SIGN_VERIFY": ( cryptography_has_oneshot_evp_digest_sign_verify ), |