]> git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/sslEAP/ringBufferThreads.h
Security-57336.1.9.tar.gz
[apple/security.git] / SecurityTests / clxutils / sslEAP / ringBufferThreads.h
1 /*
2 * ringBufferThreads.h - SecureTransport client and server thread
3 * routines which use ringBufferIo for I/O (no sockets).
4 */
5
6 #include <Security/SecureTransport.h>
7 #include <Security/SecureTransportPriv.h>
8 #include <clAppUtils/ringBufferIo.h>
9 #include <CoreFoundation/CoreFoundation.h>
10
11 #ifndef _RING_BUFFER_THREADS_H_
12 #define _RING_BUFFER_THREADS_H_
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 #define SHARED_SECRET_SIZE 32
19
20 /*
21 * arguments to client thread and server pseudothread
22 */
23 typedef struct {
24 unsigned xferSize; /* total bytes for client to write and server to
25 * read */
26 void *xferBuf; /* move to/from here */
27 unsigned chunkSize; /* size of xferBuf; client writes this much at
28 * a time */
29 RingBuffer *ringWrite; /* I/O writes to this... */
30 RingBuffer *ringRead; /* ...and reads from this */
31
32 /* client's goFlag is &(server's iAmReady); vice versa */
33 bool iAmReady; /* this thread is ready for handshake */
34 bool *goFlag; /* when both threads see this, they start
35 * their handshakes */
36 bool *abortFlag; /* anyone sets this on error */
37 /* everyone aborts when they see this true */
38 bool pauseOnError; /* call testError() on error */
39
40 char *hostName; /* optional for client */
41
42 /* EAP-specific stuff */
43 unsigned char sharedSecret[SHARED_SECRET_SIZE];
44 unsigned char *sessionTicket; /* for client only */
45 unsigned sessionTicketLen;
46
47 /*
48 * setMasterSecret indicates wheter we call SSLInternalSetMasterSecretFunction().
49 * If false, the server better have a signing identity in idArray.
50 */
51 bool setMasterSecret;
52 CFArrayRef idArray; /* optional, server only */
53 CFArrayRef trustedRoots; /* generally from server's idArray */
54
55 /* returned on success */
56 SSLProtocol negotiatedProt;
57 SSLCipherSuite negotiatedCipher;
58 Boolean sessionWasResumed;
59
60 CFAbsoluteTime startHandshake;
61 CFAbsoluteTime startData;
62 CFAbsoluteTime endData;
63 } RingBufferArgs;
64
65 /*
66 * Client thread - handshake and write sslArgs->xferSize bytes of data.
67 */
68 void *rbClientThread(void *arg);
69
70 /*
71 * Server function - like clientThread except it runs from the main thread.
72 * handshake and read sslArgs->xferSize bytes of data.
73 */
74 OSStatus rbServerThread(RingBufferArgs *sslArgs);
75
76 #ifdef __cplusplus
77 }
78 #endif
79
80 #endif /* _RING_BUFFER_THREADS_H_*/