ObjOpenSSL  Check-in [586a59246a]

Overview
Comment:Adjust to ObjFW changes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 586a59246aca22584647faf639282bcecd9a14e08459daf8646674aa73ed7688
User & Date: js on 2017-07-22 23:09:18
Other Links: manifest | tags
Context
2017-07-22
23:32
X509Certificate: Fix typo check-in: ad16b8498f user: js tags: trunk
23:09
Adjust to ObjFW changes check-in: 586a59246a user: js tags: trunk
2017-07-02
12:22
Adjust to ObjFW changes check-in: 9c2e824983 user: js tags: trunk
Changes

Modified src/SSLSocket.h from [b846ea7d60] to [8b46b339d4].

41
42
43
44
45
46
47
48

49
50
51
52
41
42
43
44
45
46
47

48
49
50
51
52







-
+





@property (nonatomic, getter=isRequestClientCertificatesEnabled)
    bool requestClientCertificatesEnabled;
@property OF_NULLABLE_PROPERTY (readonly, nonatomic)
    X509Certificate *peerCertificate;

- initWithSocket: (OFTCPSocket *)socket;
- (OFDataArray *)channelBindingDataWithType: (OFString *)type;
- (OFData *)channelBindingDataWithType: (OFString *)type;
- (nullable X509Certificate *)peerCertificate;
@end

OF_ASSUME_NONNULL_END

Modified src/SSLSocket.m from [3aefdbc324] to [1e01bcd98b].

39
40
41
42
43
44
45
46

47
48
49
50
51
52
53
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53







-
+








#if defined(__clang__)
# pragma clang diagnostic pop
#endif

#import <ObjFW/OFThread.h>
#import <ObjFW/OFHTTPRequest.h>
#import <ObjFW/OFDataArray.h>
#import <ObjFW/OFData.h>
#import <ObjFW/OFLocalization.h>

#import <ObjFW/OFAcceptFailedException.h>
#import <ObjFW/OFInitializationFailedException.h>
#import <ObjFW/OFInvalidArgumentException.h>
#import <ObjFW/OFNotOpenException.h>
#import <ObjFW/OFOutOfRangeException.h>
419
420
421
422
423
424
425
426

427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448


449
450
451
452
453
454
455
456
457
419
420
421
422
423
424
425

426
427
428
429

430
431
432
433
434
435
436
437
438
439
440
441
442
443
444



445
446


447
448
449
450
451
452
453







-
+



-















-
-
-
+
+
-
-








- (const char *)privateKeyPassphraseForSNIHost: (OFString *)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (OFDataArray *)channelBindingDataWithType: (OFString *)type
- (OFData *)channelBindingDataWithType: (OFString *)type
{
	size_t length;
	char buffer[64];
	OFDataArray *data;

	if (![type isEqual: @"tls-unique"])
		@throw [OFInvalidArgumentException exception];

	if (SSL_session_reused(_SSL) ^ !_listening) {
		/*
		 * We are either client or the session has been resumed
		 * => we have sent the finished message
		 */
		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 addItems: buffer
		 count: length];
	return [OFData dataWithItems: buffer
			       count: length];

	return data;
}

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

	if (certificate == NULL)

Modified src/X509Certificate.m from [ed578c75c6] to [753b8d7922].

33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47







-
+







# pragma clang diagnostic pop
#endif

#import "X509Certificate.h"

#import <ObjFW/OFAutoreleasePool.h>
#import <ObjFW/OFArray.h>
#import <ObjFW/OFDataArray.h>
#import <ObjFW/OFData.h>
#import <ObjFW/OFDictionary.h>
#import <ObjFW/OFFile.h>
#import <ObjFW/OFInitializationFailedException.h>
#import <ObjFW/OFInvalidEncodingException.h>
#import <ObjFW/OFList.h>
#import <ObjFW/OFMutableDictionary.h>
#import <ObjFW/OFString.h>
68
69
70
71
72
73
74
75
76
77


78
79

80
81
82
83
84
85
86
68
69
70
71
72
73
74



75
76
77

78
79
80
81
82
83
84
85







-
-
-
+
+

-
+








- initWithFile: (OFString *)path
{
	self = [super init];

	@try {
		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
		OFDataArray *data = [OFDataArray
		    dataArrayWithContentsOfFile: path];
		const unsigned char *dataCArray = [data items];
		OFData *data = [OFData dataWithContentsOfFile: path];
		const unsigned char *dataC = [data items];

		_certificate = d2i_X509(NULL, &dataCArray, [data count]);
		_certificate = d2i_X509(NULL, &dataC, [data count]);
		if (_certificate == NULL)
			@throw [OFInitializationFailedException
			    exceptionWithClass: [self class]];

		[pool release];
	} @catch (id e) {
		[self release];