From 4f6ea624e7b8ee66a02a72e55d4d8399b411fd1a Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 14 Mar 2015 23:05:34 -0500 Subject: add AES key wrap bindings to commoncrypto --- .../hazmat/bindings/commoncrypto/binding.py | 1 + .../commoncrypto/common_symmetric_key_wrap.py | 37 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/cryptography/hazmat/bindings/commoncrypto/common_symmetric_key_wrap.py diff --git a/src/cryptography/hazmat/bindings/commoncrypto/binding.py b/src/cryptography/hazmat/bindings/commoncrypto/binding.py index 79a16368..f48b59cb 100644 --- a/src/cryptography/hazmat/bindings/commoncrypto/binding.py +++ b/src/cryptography/hazmat/bindings/commoncrypto/binding.py @@ -20,6 +20,7 @@ class Binding(object): "common_hmac", "common_key_derivation", "common_cryptor", + "common_symmetric_key_wrap", "secimport", "secitem", "seckey", diff --git a/src/cryptography/hazmat/bindings/commoncrypto/common_symmetric_key_wrap.py b/src/cryptography/hazmat/bindings/commoncrypto/common_symmetric_key_wrap.py new file mode 100644 index 00000000..ea9e459d --- /dev/null +++ b/src/cryptography/hazmat/bindings/commoncrypto/common_symmetric_key_wrap.py @@ -0,0 +1,37 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. + +from __future__ import absolute_import, division, print_function + +INCLUDES = """ +#include +""" + +TYPES = """ +enum { + kCCWRAPAES = 1, +}; + +typedef uint32_t CCWrappingAlgorithm; +""" + +FUNCTIONS = """ +int CCSymmetricKeyWrap(CCWrappingAlgorithm, const uint8_t *, const size_t, + const uint8_t *, size_t, const uint8_t *, size_t, + uint8_t *, size_t *); +int CCSymmetricKeyUnwrap(CCWrappingAlgorithm algorithm, const uint8_t *, + const size_t, const uint8_t *, size_t, + const uint8_t *, size_t, uint8_t *, size_t *); +size_t CCSymmetricWrappedSize(CCWrappingAlgorithm, size_t); +size_t CCSymmetricUnwrappedSize(CCWrappingAlgorithm, size_t); + +""" + +MACROS = """ +""" + +CUSTOMIZATIONS = """ +""" + +CONDITIONAL_NAMES = {} -- cgit v1.2.3