5 #include <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacErrors.h>
7 const char *sslGetCipherSuiteString(SSLCipherSuite cs
)
9 static char noSuite
[40];
12 case SSL_NULL_WITH_NULL_NULL
:
13 return "SSL_NULL_WITH_NULL_NULL";
14 case SSL_RSA_WITH_NULL_MD5
:
15 return "SSL_RSA_WITH_NULL_MD5";
16 case SSL_RSA_WITH_NULL_SHA
:
17 return "SSL_RSA_WITH_NULL_SHA";
18 case SSL_RSA_EXPORT_WITH_RC4_40_MD5
:
19 return "SSL_RSA_EXPORT_WITH_RC4_40_MD5";
20 case SSL_RSA_WITH_RC4_128_MD5
:
21 return "SSL_RSA_WITH_RC4_128_MD5";
22 case SSL_RSA_WITH_RC4_128_SHA
:
23 return "SSL_RSA_WITH_RC4_128_SHA";
24 case SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5
:
25 return "SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5";
26 case SSL_RSA_WITH_IDEA_CBC_SHA
:
27 return "SSL_RSA_WITH_IDEA_CBC_SHA";
28 case SSL_RSA_EXPORT_WITH_DES40_CBC_SHA
:
29 return "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA";
30 case SSL_RSA_WITH_DES_CBC_SHA
:
31 return "SSL_RSA_WITH_DES_CBC_SHA";
32 case SSL_RSA_WITH_3DES_EDE_CBC_SHA
:
33 return "SSL_RSA_WITH_3DES_EDE_CBC_SHA";
34 case SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
:
35 return "SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA";
36 case SSL_DH_DSS_WITH_DES_CBC_SHA
:
37 return "SSL_DH_DSS_WITH_DES_CBC_SHA";
38 case SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA
:
39 return "SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA";
40 case SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
:
41 return "SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA";
42 case SSL_DH_RSA_WITH_DES_CBC_SHA
:
43 return "SSL_DH_RSA_WITH_DES_CBC_SHA";
44 case SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA
:
45 return "SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA";
46 case SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
:
47 return "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA";
48 case SSL_DHE_DSS_WITH_DES_CBC_SHA
:
49 return "SSL_DHE_DSS_WITH_DES_CBC_SHA";
50 case SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
:
51 return "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA";
52 case SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
:
53 return "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA";
54 case SSL_DHE_RSA_WITH_DES_CBC_SHA
:
55 return "SSL_DHE_RSA_WITH_DES_CBC_SHA";
56 case SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA
:
57 return "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA";
58 case SSL_DH_anon_EXPORT_WITH_RC4_40_MD5
:
59 return "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5";
60 case SSL_DH_anon_WITH_RC4_128_MD5
:
61 return "SSL_DH_anon_WITH_RC4_128_MD5";
62 case SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA
:
63 return "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA";
64 case SSL_DH_anon_WITH_DES_CBC_SHA
:
65 return "SSL_DH_anon_WITH_DES_CBC_SHA";
66 case SSL_DH_anon_WITH_3DES_EDE_CBC_SHA
:
67 return "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA";
68 case SSL_FORTEZZA_DMS_WITH_NULL_SHA
:
69 return "SSL_FORTEZZA_DMS_WITH_NULL_SHA";
70 case SSL_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA
:
71 return "SSL_FORTEZZA_DMS_WITH_FORTEZZA_CBC_SHA";
72 case SSL_RSA_WITH_RC2_CBC_MD5
:
73 return "SSL_RSA_WITH_RC2_CBC_MD5";
74 case SSL_RSA_WITH_IDEA_CBC_MD5
:
75 return "SSL_RSA_WITH_IDEA_CBC_MD5";
76 case SSL_RSA_WITH_DES_CBC_MD5
:
77 return "SSL_RSA_WITH_DES_CBC_MD5";
78 case SSL_RSA_WITH_3DES_EDE_CBC_MD5
:
79 return "SSL_RSA_WITH_3DES_EDE_CBC_MD5";
80 case SSL_NO_SUCH_CIPHERSUITE
:
81 return "SSL_NO_SUCH_CIPHERSUITE";
83 sprintf(noSuite
, "Unknown (%d)", (unsigned)cs
);
89 * Given a SSLProtocolVersion - typically from SSLGetProtocolVersion -
90 * return a string representation.
92 const char *sslGetProtocolVersionString(SSLProtocol prot
)
94 static char noProt
[20];
97 case kSSLProtocolUnknown
:
98 return "kSSLProtocolUnknown";
100 return "kSSLProtocol2";
102 return "kSSLProtocol3";
103 case kSSLProtocol3Only
:
104 return "kSSLProtocol3Only";
106 sprintf(noProt
, "Unknown (%d)", (unsigned)prot
);
112 * Return string representation of SecureTransport-related OSStatus.
114 const char *sslGetSSLErrString(OSStatus err
)
116 static char noErrStr
[20];
126 return "errSSLProtocol";
127 case errSSLNegotiation
:
128 return "errSSLNegotiation";
129 case errSSLFatalAlert
:
130 return "errSSLFatalAlert";
131 case errSSLWouldBlock
:
132 return "errSSLWouldBlock";
135 case errSSLSessionNotFound
:
136 return "errSSLSessionNotFound";
137 case errSSLClosedGraceful
:
138 return "errSSLClosedGraceful";
139 case errSSLClosedAbort
:
140 return "errSSLClosedAbort";
141 case errSSLXCertChainInvalid
:
142 return "errSSLXCertChainInvalid";
144 return "errSSLBadCert";
146 return "errSSLCrypto";
148 return "errSSLInternal";
149 case errSSLModuleAttach
:
150 return "errSSLModuleAttach";
151 case errSSLUnknownRootCert
:
152 return "errSSLUnknownRootCert";
153 case errSSLNoRootCert
:
154 return "errSSLNoRootCert";
155 case errSSLCertExpired
:
156 return "errSSLCertExpired";
157 case errSSLCertNotYetValid
:
158 return "errSSLCertNotYetValid";
161 case errSSLClosedNoNotify
:
162 return "errSSLClosedNoNotify";
164 sprintf(noErrStr
, "Unknown (%d)", (unsigned)err
);
173 printf("*** %s: %s\n", op
, sslGetSSLErrString(err
));