ObjOpenSSL  Check-in [aab1410a4b]

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: aab1410a4bcaaa6911db4b41f02395593ccbc0a903e62ec62be82530d7db97b3
User & Date: js on 2016-03-06 17:48:01
Other Links: manifest | tags
Context
2016-07-09
20:12
Update buildsys check-in: 045b806a83 user: js tags: trunk
2016-03-06
17:48
Adjust to ObjFW changes check-in: aab1410a4b user: js tags: trunk
2015-05-24
19:33
Conform to OFTLSSocket check-in: 071d74e840 user: js tags: trunk
Changes

Modified src/SSLInvalidCertificateException.h from [62fcaa9a42] to [a32c7b3001].

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#import <ObjFW/OFException.h>

@interface SSLInvalidCertificateException: OFException
{
	OFString *_reason;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFString *reason;
#endif

+ exceptionWithReason: (OFString*)reason;
- initWithReason: (OFString*)reason;
- (OFString*)reason;
@end







<

<



<

25
26
27
28
29
30
31

32

33
34
35

36
#import <ObjFW/OFException.h>

@interface SSLInvalidCertificateException: OFException
{
	OFString *_reason;
}


@property (readonly, copy) OFString *reason;


+ exceptionWithReason: (OFString*)reason;
- initWithReason: (OFString*)reason;

@end

Modified src/SSLInvalidCertificateException.m from [6fabfe1bec] to [4caf75130c].

24
25
26
27
28
29
30


31
32
33
34
35
36
37
#include <stdlib.h>

#import "SSLInvalidCertificateException.h"

#import <ObjFW/macros.h>

@implementation SSLInvalidCertificateException


+ exceptionWithReason: (OFString*)reason
{
	return [[[self alloc] initWithReason: reason] autorelease];
}

- init
{







>
>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdlib.h>

#import "SSLInvalidCertificateException.h"

#import <ObjFW/macros.h>

@implementation SSLInvalidCertificateException
@synthesize reason = _reason;

+ exceptionWithReason: (OFString*)reason
{
	return [[[self alloc] initWithReason: reason] autorelease];
}

- init
{
67
68
69
70
71
72
73
74
75
76
77
78
79
}

- (OFString*)description
{
	return [OFString stringWithFormat:
	    @"Invalid certificate! Reason: %@", _reason];
}

- (OFString*)reason
{
	OF_GETTER(_reason, true)
}
@end







<
<
<
<
<

69
70
71
72
73
74
75





76
}

- (OFString*)description
{
	return [OFString stringWithFormat:
	    @"Invalid certificate! Reason: %@", _reason];
}





@end

Modified src/SSLSocket.h from [536accb4df] to [ec5826ebd6].

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	SSL *_SSL;
	OFString *_certificateFile, *_privateKeyFile;
	const char *_privateKeyPassphrase;
	bool _certificateVerificationEnabled;
	bool _requestClientCertificatesEnabled;
}

#ifdef OF_HAVE_PROPERTIES
@property (getter=isRequestClientCertificatesEnabled)
    bool requestClientCertificatesEnabled;
#endif

- initWithSocket: (OFTCPSocket*)socket;
- (void)SSL_super_close;
- (void)setRequestClientCertificatesEnabled: (bool)enabled;
- (bool)isRequestClientCertificatesEnabled;
- (OFDataArray*)channelBindingDataWithType: (OFString*)type;
- (X509Certificate*)peerCertificate;
- (void)verifyPeerCertificate;
@end







<


<



<
<




33
34
35
36
37
38
39

40
41

42
43
44


45
46
47
48
	SSL *_SSL;
	OFString *_certificateFile, *_privateKeyFile;
	const char *_privateKeyPassphrase;
	bool _certificateVerificationEnabled;
	bool _requestClientCertificatesEnabled;
}


@property (getter=isRequestClientCertificatesEnabled)
    bool requestClientCertificatesEnabled;


- initWithSocket: (OFTCPSocket*)socket;
- (void)SSL_super_close;


- (OFDataArray*)channelBindingDataWithType: (OFString*)type;
- (X509Certificate*)peerCertificate;
- (void)verifyPeerCertificate;
@end

Modified src/SSLSocket.m from [cd16825332] to [a51bf1f765].

85
86
87
88
89
90
91







92
93
94
95
96
97
98
	if (mode & CRYPTO_LOCK)
		of_mutex_lock(&ssl_mutexes[n]);
	else
		of_mutex_unlock(&ssl_mutexes[n]);
}

@implementation SSLSocket







+ (void)load
{
	of_tls_socket_class = self;
}

+ (void)initialize
{







>
>
>
>
>
>
>







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
	if (mode & CRYPTO_LOCK)
		of_mutex_lock(&ssl_mutexes[n]);
	else
		of_mutex_unlock(&ssl_mutexes[n]);
}

@implementation SSLSocket
@synthesize delegate = _delegate, certificateFile = _certificateFile;
@synthesize privateKeyFile = _privateKeyFile;
@synthesize privateKeyPassphrase = privateKeyPassphrase;
@synthesize certificateVerificationEnabled = _certificateVerificationEnabled;
@synthesize requestClientCertificatesEnabled =
    _requestClientCertificatesEnabled;

+ (void)load
{
	of_tls_socket_class = self;
}

+ (void)initialize
{
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
{
	if (_SSL != NULL && SSL_pending(_SSL) > 0)
		return true;

	return [super hasDataInReadBuffer];
}

- (void)setDelegate: (id <OFTLSSocketDelegate>)delegate
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (id <OFTLSSocketDelegate>)delegate
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (void)setCertificateFile: (OFString*)certificateFile
{
	OF_SETTER(_certificateFile, certificateFile, true, 1)
}

- (void)setCertificateFile: (OFString*)certificateFile
		forSNIHost: (OFString*)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (OFString*)certificateFile
{
	OF_GETTER(_certificateFile, true)
}

- (OFString*)certificateFileForSNIHost: (OFString*)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (void)setPrivateKeyFile: (OFString*)privateKeyFile
{
	OF_SETTER(_privateKeyFile, privateKeyFile, true, 1)
}

- (void)setPrivateKeyFile: (OFString*)privateKeyFile
	       forSNIHost: (OFString*)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (OFString*)privateKeyFile
{
	OF_GETTER(_privateKeyFile, true)
}

- (OFString*)privateKeyFileForSNIHost: (OFString*)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (void)setPrivateKeyPassphrase: (const char*)privateKeyPassphrase
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (void)setPrivateKeyPassphrase: (const char*)privateKeyPassphrase
		     forSNIHost: (OFString*)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (const char*)privateKeyPassphrase
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

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

- (void)setCertificateVerificationEnabled: (bool)enabled
{
	_certificateVerificationEnabled = enabled;
}

- (bool)isCertificateVerificationEnabled
{
	return _certificateVerificationEnabled;
}

- (void)setRequestClientCertificatesEnabled: (bool)enabled
{
	_requestClientCertificatesEnabled = enabled;
}

- (bool)isRequestClientCertificatesEnabled
{
	return _requestClientCertificatesEnabled;
}

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

	if (![type isEqual: @"tls-unique"])







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







<
<
<
<
<






<
<
<
<
<







<
<
<
<
<


<
<
<
<
<
<











<
<
<
<
<
<






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







333
334
335
336
337
338
339

















340
341
342
343
344
345
346





347
348
349
350
351
352





353
354
355
356
357
358
359





360
361






362
363
364
365
366
367
368
369
370
371
372






373
374
375
376
377
378




















379
380
381
382
383
384
385
{
	if (_SSL != NULL && SSL_pending(_SSL) > 0)
		return true;

	return [super hasDataInReadBuffer];
}


















- (void)setCertificateFile: (OFString*)certificateFile
		forSNIHost: (OFString*)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}






- (OFString*)certificateFileForSNIHost: (OFString*)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}






- (void)setPrivateKeyFile: (OFString*)privateKeyFile
	       forSNIHost: (OFString*)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}






- (OFString*)privateKeyFileForSNIHost: (OFString*)SNIHost
{






	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}

- (void)setPrivateKeyPassphrase: (const char*)privateKeyPassphrase
		     forSNIHost: (OFString*)SNIHost
{
	/* TODO */
	OF_UNRECOGNIZED_SELECTOR
}







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





















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

	if (![type isEqual: @"tls-unique"])

Modified src/X509Certificate.h from [0092402ee7] to [ecba294ad5].

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
	X509 *_certificate;
	OFDictionary *_issuer;
	OFDictionary *_subject;
	OFDictionary *_subjectAlternativeName;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly) OFDictionary *issuer, *subject, *subjectAlternativeName;
#endif

- initWithFile: (OFString*)file;
- initWithX509Struct: (X509*)cert;
- (OFDictionary*)issuer;
- (OFDictionary*)subject;
- (OFDictionary*)subjectAlternativeName;
- (bool)hasCommonNameMatchingDomain: (OFString*)domain;
- (bool)hasDNSNameMatchingDomain: (OFString*)domain;







<
<
<
<







53
54
55
56
57
58
59




60
61
62
63
64
65
66
{
	X509 *_certificate;
	OFDictionary *_issuer;
	OFDictionary *_subject;
	OFDictionary *_subjectAlternativeName;
}





- initWithFile: (OFString*)file;
- initWithX509Struct: (X509*)cert;
- (OFDictionary*)issuer;
- (OFDictionary*)subject;
- (OFDictionary*)subjectAlternativeName;
- (bool)hasCommonNameMatchingDomain: (OFString*)domain;
- (bool)hasDNSNameMatchingDomain: (OFString*)domain;