]> git.saurik.com Git - apple/security.git/blame - OSX/libsecurity_ssl/lib/sslDebug.h
Security-58286.41.2.tar.gz
[apple/security.git] / OSX / libsecurity_ssl / lib / sslDebug.h
CommitLineData
b1ab9ed8 1/*
d8f41ccd 2 * Copyright (c) 2000-2001,2005-2007,2010-2012,2014 Apple Inc. All Rights Reserved.
b1ab9ed8
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
d8f41ccd 5 *
b1ab9ed8
A
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.
d8f41ccd 12 *
b1ab9ed8
A
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.
d8f41ccd 20 *
b1ab9ed8
A
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
25 * sslDebug.h - Debugging macros.
26 */
27
28#ifndef _SSL_DEBUG_H_
29#define _SSL_DEBUG_H_
30
427c49bc 31#ifdef KERNEL
fa7225c8
A
32/* TODO: support secinfo in the kernel */
33#define secinfo(x...)
427c49bc
A
34#else /* KERNEL */
35#include <utilities/debugging.h>
36#endif
b1ab9ed8
A
37
38#ifndef NDEBUG
427c49bc 39#include <AssertMacros.h>
b1ab9ed8
A
40#endif
41
b1ab9ed8 42
fa7225c8 43#define ssl_secinfo secinfo
b1ab9ed8
A
44
45#ifndef NDEBUG
46
47/* log changes in handshake state */
fa7225c8 48#define sslHdskStateDebug(args...) ssl_secinfo("sslHdskState", ## args)
b1ab9ed8
A
49
50/* log handshake and alert messages */
fa7225c8 51#define sslHdskMsgDebug(args...) ssl_secinfo("sslHdskMsg", ## args)
b1ab9ed8
A
52
53/* log negotiated handshake parameters */
fa7225c8 54#define sslLogNegotiateDebug(args...) ssl_secinfo("sslLogNegotiate", ## args)
b1ab9ed8
A
55
56/* log received protocol messsages */
fa7225c8 57#define sslLogRxProtocolDebug(msgType) ssl_secinfo("sslLogRxProtocol", \
b1ab9ed8
A
58 "---received protoMsg %s", msgType)
59
60/* log resumable session info */
fa7225c8 61#define sslLogResumSessDebug(args...) ssl_secinfo("sslResumSession", ## args)
b1ab9ed8
A
62
63/* log low-level session info in appleSession.c */
fa7225c8 64#define sslLogSessCacheDebug(args...) ssl_secinfo("sslSessionCache", ## args)
b1ab9ed8
A
65
66/* log record-level I/O (SSLRead, SSLWrite) */
fa7225c8 67#define sslLogRecordIo(args...) ssl_secinfo("sslRecordIo", ## args)
b1ab9ed8
A
68
69/* cert-related info */
fa7225c8 70#define sslCertDebug(args...) ssl_secinfo("sslCert", ## args)
b1ab9ed8
A
71
72/* Diffie-Hellman */
fa7225c8 73#define sslDhDebug(args...) ssl_secinfo("sslDh", ## args)
b1ab9ed8
A
74
75/* EAP-FAST PAC-based session resumption */
fa7225c8 76#define sslEapDebug(args...) ssl_secinfo("sslEap", ## args)
b1ab9ed8
A
77
78/* ECDSA */
fa7225c8 79#define sslEcdsaDebug(args...) ssl_secinfo("sslEcdsa", ## args)
b1ab9ed8
A
80
81#else /* NDEBUG */
82
83/* deployment build */
84#define sslHdskStateDebug(args...)
85#define sslHdskMsgDebug(args...)
86#define sslLogNegotiateDebug(args...)
87#define sslLogRxProtocolDebug(msgType)
88#define sslLogResumSessDebug(args...)
89#define sslLogSessCacheDebug(args...)
90#define sslLogRecordIo(args...)
91#define sslCertDebug(args...)
92#define sslDhDebug(args...)
93#define sslEapDebug(args...)
94#define sslEcdsaDebug(args...)
95
96#endif /*
97NDEBUG */
98
99#ifdef NDEBUG
100
b1ab9ed8
A
101/* all errors logged to stdout for DEBUG config only */
102#define sslErrorLog(args...)
103#define sslDebugLog(args...)
104#define sslDump(d, l)
105
106#else
107
b1ab9ed8
A
108extern void SSLDump(const unsigned char *data, unsigned long len);
109
110/* extra debug logging of non-error conditions, if SSL_DEBUG is defined */
111#if SSL_DEBUG
112//#define sslDebugLog(args...) printf(args)
fa7225c8 113#define sslDebugLog(args...) ssl_secinfo("sslDebug", ## args)
b1ab9ed8
A
114#else
115#define sslDebugLog(args...)
116#endif
117/* all errors logged to stdout for DEBUG config only */
118//#define sslErrorLog(args...) printf(args)
fa7225c8 119#define sslErrorLog(args...) ssl_secinfo("sslError", ## args)
b1ab9ed8
A
120#define sslDump(d, l) SSLDump((d), (l))
121
122#endif /* NDEBUG */
123
124
125#ifdef NDEBUG
126#define ASSERT(s)
127#else
427c49bc 128#define ASSERT(s) check(s)
b1ab9ed8
A
129#endif
130
131#endif /* _SSL_DEBUG_H_ */