From a73f1a1a137b941d4c86e2f18d81f586be273a7d Mon Sep 17 00:00:00 2001 From: Chirag Jog Date: Mon, 16 Jun 2014 04:32:29 +0000 Subject: Use size_t as the per definition of aes.h . size_t translates correctly to int or long based on arch type. --- cryptography/hazmat/bindings/openssl/aes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptography/hazmat/bindings/openssl/aes.py b/cryptography/hazmat/bindings/openssl/aes.py index b0e00721..4f79cd07 100644 --- a/cryptography/hazmat/bindings/openssl/aes.py +++ b/cryptography/hazmat/bindings/openssl/aes.py @@ -32,7 +32,7 @@ int AES_set_decrypt_key(const unsigned char *, const int, AES_KEY *); /* The ctr128_encrypt function is only useful in 0.9.8. You should use EVP for this in 1.0.0+. */ void AES_ctr128_encrypt(const unsigned char *, unsigned char *, - const unsigned long, const AES_KEY *, + const unsigned size_t, const AES_KEY *, unsigned char[], unsigned char[], unsigned int *); """ -- cgit v1.2.3 From 150154feb22fe7597b61a39438ce9e8c8b031aa0 Mon Sep 17 00:00:00 2001 From: Chirag Jog Date: Mon, 16 Jun 2014 08:02:26 +0000 Subject: Move function definition to MACROS section because the signature changed after 0.9.8 --- cryptography/hazmat/bindings/openssl/aes.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cryptography/hazmat/bindings/openssl/aes.py b/cryptography/hazmat/bindings/openssl/aes.py index 4f79cd07..dca9ffb3 100644 --- a/cryptography/hazmat/bindings/openssl/aes.py +++ b/cryptography/hazmat/bindings/openssl/aes.py @@ -29,12 +29,6 @@ typedef struct aes_key_st AES_KEY; FUNCTIONS = """ int AES_set_encrypt_key(const unsigned char *, const int, AES_KEY *); int AES_set_decrypt_key(const unsigned char *, const int, AES_KEY *); -/* The ctr128_encrypt function is only useful in 0.9.8. You should use EVP for - this in 1.0.0+. */ -void AES_ctr128_encrypt(const unsigned char *, unsigned char *, - const unsigned size_t, const AES_KEY *, - unsigned char[], unsigned char[], unsigned int *); - """ MACROS = """ @@ -44,6 +38,14 @@ int AES_wrap_key(AES_KEY *, const unsigned char *, unsigned char *, const unsigned char *, unsigned int); int AES_unwrap_key(AES_KEY *, const unsigned char *, unsigned char *, const unsigned char *, unsigned int); + +/* The ctr128_encrypt function is only useful in 0.9.8. You should use EVP for + this in 1.0.0+. It is defined in macros because the function signature changed + after 0.9.8 */ +void AES_ctr128_encrypt(const unsigned char *, unsigned char *, + const unsigned size_t, const AES_KEY *, + unsigned char[], unsigned char[], unsigned int *); + """ CUSTOMIZATIONS = """ -- cgit v1.2.3 From 1dfdd28c5fc035d1cc9ed6bf64b959029624af03 Mon Sep 17 00:00:00 2001 From: Chirag Jog Date: Mon, 16 Jun 2014 15:18:01 +0000 Subject: Fix the comment to conform to PEP8 standards. --- cryptography/hazmat/bindings/openssl/aes.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cryptography/hazmat/bindings/openssl/aes.py b/cryptography/hazmat/bindings/openssl/aes.py index 4f79cd07..fa8cbc7e 100644 --- a/cryptography/hazmat/bindings/openssl/aes.py +++ b/cryptography/hazmat/bindings/openssl/aes.py @@ -29,12 +29,6 @@ typedef struct aes_key_st AES_KEY; FUNCTIONS = """ int AES_set_encrypt_key(const unsigned char *, const int, AES_KEY *); int AES_set_decrypt_key(const unsigned char *, const int, AES_KEY *); -/* The ctr128_encrypt function is only useful in 0.9.8. You should use EVP for - this in 1.0.0+. */ -void AES_ctr128_encrypt(const unsigned char *, unsigned char *, - const unsigned size_t, const AES_KEY *, - unsigned char[], unsigned char[], unsigned int *); - """ MACROS = """ @@ -44,6 +38,14 @@ int AES_wrap_key(AES_KEY *, const unsigned char *, unsigned char *, const unsigned char *, unsigned int); int AES_unwrap_key(AES_KEY *, const unsigned char *, unsigned char *, const unsigned char *, unsigned int); + +/* The ctr128_encrypt function is only useful in 0.9.8. You should use EVP for + this in 1.0.0+. It is defined in macros because the function signature + changed after 0.9.8 */ +void AES_ctr128_encrypt(const unsigned char *, unsigned char *, + const unsigned size_t, const AES_KEY *, + unsigned char[], unsigned char[], unsigned int *); + """ CUSTOMIZATIONS = """ -- cgit v1.2.3 From f65cfcd6e1dd133644a7cbceddf878b6e062561d Mon Sep 17 00:00:00 2001 From: Chirag Jog Date: Mon, 16 Jun 2014 15:56:46 +0000 Subject: change from unsigned size_t to size_t since size_t is always defined as unsigned. --- cryptography/hazmat/bindings/openssl/aes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptography/hazmat/bindings/openssl/aes.py b/cryptography/hazmat/bindings/openssl/aes.py index fa8cbc7e..58ef0cf1 100644 --- a/cryptography/hazmat/bindings/openssl/aes.py +++ b/cryptography/hazmat/bindings/openssl/aes.py @@ -43,7 +43,7 @@ int AES_unwrap_key(AES_KEY *, const unsigned char *, unsigned char *, this in 1.0.0+. It is defined in macros because the function signature changed after 0.9.8 */ void AES_ctr128_encrypt(const unsigned char *, unsigned char *, - const unsigned size_t, const AES_KEY *, + const size_t, const AES_KEY *, unsigned char[], unsigned char[], unsigned int *); """ -- cgit v1.2.3