From c5833bfcad56fe44e30455dc037c2874e425b241 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 20 Oct 2013 22:11:04 -0500 Subject: Add HMAC bindings --- cryptography/bindings/openssl/api.py | 1 + cryptography/bindings/openssl/hmac.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 cryptography/bindings/openssl/hmac.py diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index f5e042e7..12082c09 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -35,6 +35,7 @@ class API(object): "engine", "err", "evp", + "hmac", "nid", "opensslv", "pem", diff --git a/cryptography/bindings/openssl/hmac.py b/cryptography/bindings/openssl/hmac.py new file mode 100644 index 00000000..7a9d05b5 --- /dev/null +++ b/cryptography/bindings/openssl/hmac.py @@ -0,0 +1,33 @@ +# 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 +""" + +TYPES = """ +struct hmac_ctx_st { ...; }; +typedef struct hmac_ctx_st HMAC_CTX; +""" + +FUNCTIONS = """ +void HMAC_CTX_init(HMAC_CTX *); +void HMAC_CTX_cleanup(HMAC_CTX *); +int HMAC_Init_ex(HMAC_CTX *, const void *, int, const EVP_MD *, ENGINE *); +int HMAC_Update(HMAC_CTX *, const unsigned char *, size_t); +int HMAC_Final(HMAC_CTX *, unsigned char *, unsigned int *); +int HMAC_CTX_copy(HMAC_CTX *, HMAC_CTX *); +""" + +MACROS = """ +""" -- cgit v1.2.3 From 02cd1fc7c4d5722c78ec1f586044ff21dea98975 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 20 Oct 2013 22:36:32 -0500 Subject: simplify HMAC_CTX typedef --- cryptography/bindings/openssl/hmac.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cryptography/bindings/openssl/hmac.py b/cryptography/bindings/openssl/hmac.py index 7a9d05b5..e97ac35e 100644 --- a/cryptography/bindings/openssl/hmac.py +++ b/cryptography/bindings/openssl/hmac.py @@ -16,8 +16,7 @@ INCLUDES = """ """ TYPES = """ -struct hmac_ctx_st { ...; }; -typedef struct hmac_ctx_st HMAC_CTX; +typedef struct { ...; } HMAC_CTX; """ FUNCTIONS = """ -- cgit v1.2.3