1/*
2 *  aes.h
3 *
4 * Copyright © 2010 by Apple, Inc. All rights reserved.
5 *
6 * @APPLE_LICENSE_HEADER_START@
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 *
25 */
26
27/*
28 *  aes.h
29 *  CommonCrypto shoefly for compatability with older versions
30 *
31 */
32
33#ifdef CC_Building
34#include "CommonCryptor.h"
35#include "CommonCryptorSPI.h"
36#include "CommonCryptorPriv.h"
37#else
38#include <CommonCrypto/CommonCryptor.h>
39#include <CommonCrypto/CommonCryptorSPI.h>
40#endif /* CC_Building */
41
42#if !defined( _CC_AES_H_ )
43#define _CC_AES_H_
44
45#if defined(__cplusplus)
46extern "C" {
47#endif
48
49#define AES_BLOCK_SIZE  16  /* the AES block size in bytes          */
50
51typedef struct
52{
53	CCCryptorRef	cref;
54	uint32_t		ctx[kCCContextSizeAES128/4];
55} aes_encrypt_ctx;
56
57typedef struct
58{
59	CCCryptorRef	cref;
60	uint32_t		ctx[kCCContextSizeAES128/4];
61} aes_decrypt_ctx;
62
63
64
65void aes_encrypt_key128(const unsigned char *in_key, aes_encrypt_ctx cx[1])
66__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0);
67
68void aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1])
69__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0);
70
71void aes_encrypt_key256(const unsigned char *in_key, aes_encrypt_ctx cx[1])
72__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0);
73
74void aes_encrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk,
75                         unsigned char *out_blk, aes_encrypt_ctx cx[1])
76__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0);
77
78void aes_decrypt_key128(const unsigned char *in_key, aes_decrypt_ctx cx[1])
79__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0);
80
81void aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1])
82__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0);
83
84void aes_decrypt_key256(const unsigned char *in_key, aes_decrypt_ctx cx[1])
85__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0);
86
87void aes_decrypt_cbc(const unsigned char *in_blk, const unsigned char *in_iv, unsigned int num_blk,
88                         unsigned char *out_blk, aes_decrypt_ctx cx[1])
89__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_5_0, __IPHONE_5_0);
90
91
92#if defined(__cplusplus)
93}
94#endif
95
96
97#endif	/* _CC_AES_H_ */
98