ObjOpenSSL  Check-in [b857e18139]

Overview
Comment:Adjust to latest ObjFW API changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b857e18139334374fefa215c80e3c94abc08126e41e5a84bb7bfb4523544c134
User & Date: js on 2012-06-10 13:34:06
Other Links: manifest | tags
Context
2012-07-12
03:09
Don't access isa directly. check-in: 8ef0132a06 user: js tags: trunk
2012-06-10
13:34
Adjust to latest ObjFW API changes. check-in: b857e18139 user: js tags: trunk
2012-03-20
21:53
Fix copyright. check-in: 4564eb6a94 user: js tags: trunk
Changes

Modified src/SSLSocket.m from [4e292c6da4] to [1bb48d4634].

237
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
{
	if (ssl != NULL)
		SSL_shutdown(ssl);

	[super close];
}

- (size_t)_readNBytes: (size_t)length
	   intoBuffer: (void*)buffer

{
	ssize_t ret;

	if (length > INT_MAX)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	if (sock == INVALID_SOCKET)







<
|
>







237
238
239
240
241
242
243

244
245
246
247
248
249
250
251
252
{
	if (ssl != NULL)
		SSL_shutdown(ssl);

	[super close];
}


- (size_t)_readIntoBuffer: (void*)buffer
		   length: (size_t)length
{
	ssize_t ret;

	if (length > INT_MAX)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	if (sock == INVALID_SOCKET)
275
276
277
278
279
280
281
282
283

284
285
286
287
288
289
290

	if (ret == 0)
		atEndOfStream = YES;

	return ret;
}

- (void)_writeNBytes: (size_t)length
	  fromBuffer: (const void*)buffer

{
	if (length > INT_MAX)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException exceptionWithClass: isa
							    socket: self];







<
|
>







275
276
277
278
279
280
281

282
283
284
285
286
287
288
289
290

	if (ret == 0)
		atEndOfStream = YES;

	return ret;
}


- (void)_writeBuffer: (const void*)buffer
	      length: (size_t)length
{
	if (length > INT_MAX)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException exceptionWithClass: isa
							    socket: self];
357
358
359
360
361
362
363
364
365

366
367
368
369
370
371
372
		length = SSL_get_finished(ssl, buffer, 64);
	} else {
		/* peer sent the finished message */
		length = SSL_get_peer_finished(ssl, buffer, 64);
	}

	data = [OFDataArray dataArray];
	[data addNItems: length
	     fromCArray: buffer];


	return data;
}

- (X509Certificate*)peerCertificate
{
	X509 *certificate = SSL_get_peer_certificate(ssl);







<
|
>







357
358
359
360
361
362
363

364
365
366
367
368
369
370
371
372
		length = SSL_get_finished(ssl, buffer, 64);
	} else {
		/* peer sent the finished message */
		length = SSL_get_peer_finished(ssl, buffer, 64);
	}

	data = [OFDataArray dataArray];

	[data addItemsFromCArray: buffer
			   count: length];

	return data;
}

- (X509Certificate*)peerCertificate
{
	X509 *certificate = SSL_get_peer_certificate(ssl);

Modified src/X509Certificate.m from [f86cecc6d4] to [a82687bce0].

396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
	char *buffer = [self allocMemoryWithSize: bufferLength];

	@try {
		while ((length = OBJ_obj2txt(buffer, bufferLength, object,
		    1)) > bufferLength) {
			bufferLength = length;
			buffer = [self resizeMemory: buffer
					     toSize: bufferLength];
		}

		ret = [[[X509OID alloc]
		    initWithUTF8String: buffer] autorelease];
	} @finally {
		[self freeMemory: buffer];
	}







|







396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
	char *buffer = [self allocMemoryWithSize: bufferLength];

	@try {
		while ((length = OBJ_obj2txt(buffer, bufferLength, object,
		    1)) > bufferLength) {
			bufferLength = length;
			buffer = [self resizeMemory: buffer
					       size: bufferLength];
		}

		ret = [[[X509OID alloc]
		    initWithUTF8String: buffer] autorelease];
	} @finally {
		[self freeMemory: buffer];
	}