]> git.saurik.com Git - apple/security.git/blob - SecureTransport/sslNullCipher.cpp
Security-163.tar.gz
[apple/security.git] / SecureTransport / sslNullCipher.cpp
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 #include "sslContext.h"
20
21 #include <string.h>
22
23 static OSStatus NullInit(
24 uint8 *key,
25 uint8* iv,
26 CipherContext *cipherCtx,
27 SSLContext *ctx);
28 static OSStatus NullCrypt(
29 SSLBuffer src,
30 SSLBuffer dest,
31 CipherContext *cipherCtx,
32 SSLContext *ctx);
33 static OSStatus NullFinish(
34 CipherContext *cipherCtx,
35 SSLContext *ctx);
36
37 extern "C" {
38 extern const SSLSymmetricCipher SSLCipherNull;
39 }
40 const SSLSymmetricCipher SSLCipherNull = {
41 0, /* Key size in bytes (ignoring parity) */
42 0, /* Secret key size */
43 0, /* IV size */
44 0, /* Block size */
45 CSSM_ALGID_NONE,
46 CSSM_ALGID_NONE,
47 CSSM_ALGMODE_NONE,
48 CSSM_PADDING_NONE,
49 NullInit,
50 NullCrypt,
51 NullCrypt,
52 NullFinish
53 };
54
55 static OSStatus NullInit(
56 uint8 *key,
57 uint8* iv,
58 CipherContext *cipherCtx,
59 SSLContext *ctx)
60 {
61 return noErr;
62 }
63
64 static OSStatus NullCrypt(
65 SSLBuffer src,
66 SSLBuffer dest,
67 CipherContext *cipherCtx,
68 SSLContext *ctx)
69 {
70 if (src.data != dest.data)
71 memcpy(dest.data, src.data, src.length);
72 return noErr;
73 }
74
75 static OSStatus NullFinish(
76 CipherContext *cipherCtx,
77 SSLContext *ctx)
78 {
79 return noErr;
80 }