ObjOpenSSL  Check-in [10e7f26817]

Overview
Comment:Update to recent ObjFW changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 10e7f26817c9950826f7b153493e70fb4124b7f92b2a4b2ad6bc3d27e234f407
User & Date: js on 2011-09-12 20:05:19
Other Links: manifest | tags
Context
2011-09-19
16:37
Adjust to recent ObjFW changes. check-in: 58b7b70ed2 user: js tags: trunk
2011-09-12
20:05
Update to recent ObjFW changes. check-in: 10e7f26817 user: js tags: trunk
2011-09-11
02:07
Correctly check return value of SSL_write. check-in: 60a6491ea5 user: js tags: trunk
Changes

Modified src/SSLSocket.m from [a0165c5a38] to [dcf1fbd21d].

78
79
80
81
82
83
84
85


86
87


88
89
90
91
92
93
94
78
79
80
81
82
83
84

85
86
87

88
89
90
91
92
93
94
95
96







-
+
+

-
+
+







			@throw [OFInitializationFailedException
			    newWithClass: isa];
		}

		SSL_set_connect_state(ssl);

		if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl,
		    [privateKeyFile cString], SSL_FILETYPE_PEM)) ||
		    [privateKeyFile cStringWithEncoding:
		    OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM)) ||
		    (certificateFile != nil && !SSL_use_certificate_file(ssl,
		    [certificateFile cString], SSL_FILETYPE_PEM)) ||
		    [certificateFile cStringWithEncoding:
		    OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM)) ||
		    SSL_connect(ssl) != 1) {
			close(sock);
			sock = INVALID_SOCKET;
			@throw [OFInitializationFailedException
			    newWithClass: isa];
		}
	} @catch (id e) {
125
126
127
128
129
130
131
132
133
134
135





136
137
138
139
140
141
142
127
128
129
130
131
132
133




134
135
136
137
138
139
140
141
142
143
144
145







-
-
-
-
+
+
+
+
+







							    host: host
							    port: port];
	}

	SSL_set_connect_state(ssl);

	if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl,
	    [privateKeyFile cString], SSL_FILETYPE_PEM)) ||
	    (certificateFile != nil && !SSL_use_certificate_file(ssl,
	    [certificateFile cString], SSL_FILETYPE_PEM)) ||
	    SSL_connect(ssl) != 1) {
	    [privateKeyFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    SSL_FILETYPE_PEM)) || (certificateFile != nil &&
	    !SSL_use_certificate_file(ssl, [certificateFile
	    cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    SSL_FILETYPE_PEM)) || SSL_connect(ssl) != 1) {
		[super close];
		@throw [OFConnectionFailedException newWithClass: isa
							  socket: self
							    host: host
							    port: port];
	}
}
154
155
156
157
158
159
160
161


162
163
164


165
166
167
168
169
170
171
157
158
159
160
161
162
163

164
165
166


167
168
169
170
171
172
173
174
175







-
+
+

-
-
+
+








		@throw [OFAcceptFailedException newWithClass: isa
						      socket: self];
	}

	SSL_set_accept_state(newSocket->ssl);

	if (!SSL_use_PrivateKey_file(newSocket->ssl, [privateKeyFile cString],
	if (!SSL_use_PrivateKey_file(newSocket->ssl, [privateKeyFile
	    cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    SSL_FILETYPE_PEM) || !SSL_use_certificate_file(newSocket->ssl,
	    [certificateFile cString], SSL_FILETYPE_PEM) ||
	    SSL_accept(newSocket->ssl) != 1) {
	    [certificateFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    SSL_FILETYPE_PEM) || SSL_accept(newSocket->ssl) != 1) {
		/* We only want to close the OFTCPSocket */
		newSocket->isa = [OFTCPSocket class];
		[newSocket close];
		newSocket->isa = isa;

		@throw [OFAcceptFailedException newWithClass: isa
						      socket: self];