ObjOpenSSL  Check-in [daea63b67c]

Overview
Comment:Have one global ctx.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: daea63b67c25850a16d5373b7d75ed6ccebc8d817f8d82be8de44103cc51ca56
User & Date: js on 2011-03-28 21:38:09
Other Links: manifest | tags
Context
2011-03-28
22:23
Implement setting the private key and certificate. check-in: ce85c1fa59 user: js tags: trunk
21:38
Have one global ctx. check-in: daea63b67c user: js tags: trunk
20:46
Fix a typo that only affects case-sensitive file systems. check-in: f002ad5119 user: js tags: trunk
Changes

Modified src/SSLSocket.h from [247b5540e4] to [2bdb858cf2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <openssl/ssl.h>

#import <ObjFW/OFTCPSocket.h>

@interface SSLSocket: OFTCPSocket
{
	SSL_CTX *ctx;
	SSL *ssl;
	BOOL handsShaken;
}

- initWithSocket: (OFTCPSocket*)socket;

/* Change the return type */
- (SSLSocket*)accept;
@end






<

<







1
2
3
4
5
6

7

8
9
10
11
12
13
14
#include <openssl/ssl.h>

#import <ObjFW/OFTCPSocket.h>

@interface SSLSocket: OFTCPSocket
{

	SSL *ssl;

}

- initWithSocket: (OFTCPSocket*)socket;

/* Change the return type */
- (SSLSocket*)accept;
@end

Modified src/SSLSocket.m from [0f40846643] to [cc5dffdd1c].

13
14
15
16
17
18
19


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#import <ObjFW/OFOutOfRangeException.h>
#import <ObjFW/OFReadFailedException.h>
#import <ObjFW/OFWriteFailedException.h>

#ifndef INVALID_SOCKET
# define INVALID_SOCKET -1
#endif



@implementation SSLSocket
+ (void)load
{
	of_http_request_tls_socket_class = self;
}

+ (void)initialize
{
	if (self == [SSLSocket class])
		SSL_library_init();
}

- init
{
	self = [super init];

	@try {
		if ((ctx = SSL_CTX_new(SSLv23_method())) == NULL)
			@throw [OFInitializationFailedException
			    newWithClass: isa];

		if ((SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) &
		    SSL_OP_NO_SSLv2) == 0)
			@throw [OFInitializationFailedException
			    newWithClass: isa];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithSocket: (OFTCPSocket*)socket
{
	self = [self init];

	@try {







>
>









|
<
<
|
<
|
|

<
|
|
<

|
<
|
<
<
<
<
<
<
<







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31


32

33
34
35

36
37

38
39

40







41
42
43
44
45
46
47
#import <ObjFW/OFOutOfRangeException.h>
#import <ObjFW/OFReadFailedException.h>
#import <ObjFW/OFWriteFailedException.h>

#ifndef INVALID_SOCKET
# define INVALID_SOCKET -1
#endif

static SSL_CTX *ctx;

@implementation SSLSocket
+ (void)load
{
	of_http_request_tls_socket_class = self;
}

+ (void)initialize
{
	if (self != [SSLSocket class])


		return;


	SSL_library_init();


	if ((ctx = SSL_CTX_new(SSLv23_method())) == NULL)
		@throw [OFInitializationFailedException newWithClass: self];


	if ((SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2) == 0)

		@throw [OFInitializationFailedException newWithClass: self];







}

- initWithSocket: (OFTCPSocket*)socket
{
	self = [self init];

	@try {