]> git.saurik.com Git - apple/security.git/blob - libsecurity_ssl/lib/sslNullCipher.c
Security-55178.0.1.tar.gz
[apple/security.git] / libsecurity_ssl / lib / sslNullCipher.c
1 /*
2 * Copyright (c) 2000-2001,2005-2008,2010-2012 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 #include "sslContext.h"
25
26 #include <string.h>
27
28 static OSStatus NullInit(
29 uint8_t *key,
30 uint8_t *iv,
31 CipherContext *cipherCtx,
32 SSLContext *ctx);
33 static OSStatus NullCrypt(
34 const uint8_t *src,
35 uint8_t *dest,
36 size_t len,
37 CipherContext *cipherCtx,
38 SSLContext *ctx);
39 static OSStatus NullFinish(
40 CipherContext *cipherCtx,
41 SSLContext *ctx);
42
43 extern const SSLSymmetricCipher SSLCipherNull;
44
45 const SSLSymmetricCipher SSLCipherNull = {
46 0, /* Key size in bytes (ignoring parity) */
47 0, /* Secret key size */
48 0, /* IV size */
49 0, /* Block size */
50 -1, /* CC cipher (unused by Null*) */
51 NullInit,
52 NullCrypt,
53 NullCrypt,
54 NullFinish
55 };
56
57 static OSStatus NullInit(
58 uint8_t *key,
59 uint8_t *iv,
60 CipherContext *cipherCtx,
61 SSLContext *ctx)
62 {
63 return noErr;
64 }
65
66 static OSStatus NullCrypt(
67 const uint8_t *src,
68 uint8_t *dest,
69 size_t len,
70 CipherContext *cipherCtx,
71 SSLContext *ctx)
72 {
73 if (src != dest)
74 memcpy(dest, src, len);
75 return noErr;
76 }
77
78 static OSStatus NullFinish(
79 CipherContext *cipherCtx,
80 SSLContext *ctx)
81 {
82 return noErr;
83 }