1/*
2 * Copyright (c) 1999-2001,2005-2008,2010-2012,2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 * symCipherParams.c - symmetric cipher parameters
26 */
27
28/* THIS FILE CONTAINS KERNEL CODE */
29
30#include "sslBuildFlags.h"
31#include "symCipher.h"
32
33/*
34 * The parameters for the symmetric ciphers currently supported (in addition to the
35 * NULL cipher in nullciph.c).
36 */
37
38#if	ENABLE_DES
39const SSLSymmetricCipherParams SSLCipherDES_CBCParams = {
40    .keyAlg = SSL_CipherAlgorithmDES_CBC,
41    .keySize = 8,
42    .ivSize = 8,
43    .blockSize = 8,
44    .cipherType = blockCipherType,
45};
46#endif	/* ENABLE_DES */
47
48#if	ENABLE_3DES
49const SSLSymmetricCipherParams SSLCipher3DES_CBCParams = {
50    .keyAlg = SSL_CipherAlgorithm3DES_CBC,
51    .keySize = 24,
52    .ivSize = 8,
53    .blockSize = 8,
54    .cipherType = blockCipherType,
55};
56#endif	/* ENABLE_3DES */
57
58#if		ENABLE_RC4
59const SSLSymmetricCipherParams SSLCipherRC4_128Params = {
60    .keyAlg = SSL_CipherAlgorithmRC4_128,
61    .keySize = 16,
62    .cipherType = streamCipherType,
63};
64#endif	/* ENABLE_RC4 */
65
66#if		ENABLE_RC2
67const SSLSymmetricCipherParams SSLCipherRC2_128Params = {
68    .keyAlg = SSL_CipherAlgorithmRC2_128,
69    .keySize = 16,
70    .ivSize = 8,
71    .blockSize = 8,
72    .cipherType = blockCipherType,
73};
74#endif	/* ENABLE_RC2*/
75
76#if		ENABLE_AES
77const SSLSymmetricCipherParams SSLCipherAES_128_CBCParams = {
78    .keyAlg = SSL_CipherAlgorithmAES_128_CBC,
79    .keySize = 16,
80    .ivSize = 16,
81    .blockSize = 16,
82    .cipherType = blockCipherType,
83};
84#endif	/* ENABLE_AES */
85
86#if ENABLE_AES256
87const SSLSymmetricCipherParams SSLCipherAES_256_CBCParams = {
88    .keyAlg = SSL_CipherAlgorithmAES_256_CBC,
89    .keySize = 32,
90    .ivSize = 16,
91    .blockSize = 16,
92    .cipherType = blockCipherType,
93};
94#endif /* ENABLE_AES256 */
95
96#if ENABLE_AES_GCM
97const SSLSymmetricCipherParams SSLCipherAES_128_GCMParams = {
98    .keyAlg = SSL_CipherAlgorithmAES_128_GCM,
99    .keySize = 16,
100    .ivSize = 16,
101    .blockSize = 16,
102    .cipherType = aeadCipherType,
103};
104
105const SSLSymmetricCipherParams SSLCipherAES_256_GCMParams = {
106    .keyAlg = SSL_CipherAlgorithmAES_256_GCM,
107    .keySize = 32,
108    .ivSize = 16,
109    .blockSize = 16,
110    .cipherType = aeadCipherType,
111};
112#endif /* ENABLE_AES_GCM */
113