Adjust to recent ObjFW changes

This commit is contained in:
Jonathan Schleifer 2017-05-08 02:31:13 +02:00
parent d11fe7ad01
commit c428df9b60
No known key found for this signature in database
GPG key ID: 28D65178B37F33E3
8 changed files with 77 additions and 77 deletions

View file

@ -33,22 +33,22 @@
@property (readonly) unsigned long SSLError; @property (readonly) unsigned long SSLError;
@property (readonly) long verifyResult; @property (readonly) long verifyResult;
+ (instancetype)exceptionWithHost: (OFString*)host + (instancetype)exceptionWithHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
socket: (SSLSocket*)socket socket: (SSLSocket *)socket
SSLError: (unsigned long)SSLError; SSLError: (unsigned long)SSLError;
+ (instancetype)exceptionWithHost: (OFString*)host + (instancetype)exceptionWithHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
socket: (SSLSocket*)socket socket: (SSLSocket *)socket
SSLError: (unsigned long)SSLError SSLError: (unsigned long)SSLError
verifyResult: (long)verifyResult; verifyResult: (long)verifyResult;
- initWithHost: (OFString*)host - initWithHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
socket: (SSLSocket*)socket socket: (SSLSocket *)socket
SSLError: (unsigned long)SSLError; SSLError: (unsigned long)SSLError;
- initWithHost: (OFString*)host - initWithHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
socket: (SSLSocket*)socket socket: (SSLSocket *)socket
SSLError: (unsigned long)SSLError SSLError: (unsigned long)SSLError
verifyResult: (long)verifyResult; verifyResult: (long)verifyResult;
@end @end

View file

@ -42,9 +42,9 @@
@implementation SSLConnectionFailedException @implementation SSLConnectionFailedException
@synthesize SSLError = _SSLError, verifyResult = _verifyResult; @synthesize SSLError = _SSLError, verifyResult = _verifyResult;
+ (instancetype)exceptionWithHost: (OFString*)host + (instancetype)exceptionWithHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
socket: (SSLSocket*)socket socket: (SSLSocket *)socket
SSLError: (unsigned long)SSLError SSLError: (unsigned long)SSLError
{ {
return [[[self alloc] initWithHost: host return [[[self alloc] initWithHost: host
@ -54,9 +54,9 @@
} }
+ (instancetype)exceptionWithHost: (OFString*)host + (instancetype)exceptionWithHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
socket: (SSLSocket*)socket socket: (SSLSocket *)socket
SSLError: (unsigned long)SSLError SSLError: (unsigned long)SSLError
verifyResult: (long)verifyResult verifyResult: (long)verifyResult
{ {
@ -67,9 +67,9 @@
verifyResult: verifyResult] autorelease]; verifyResult: verifyResult] autorelease];
} }
- initWithHost: (OFString*)host - initWithHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
socket: (SSLSocket*)socket socket: (SSLSocket *)socket
SSLError: (unsigned long)SSLError SSLError: (unsigned long)SSLError
{ {
self = [super initWithHost: host self = [super initWithHost: host
@ -81,9 +81,9 @@
return self; return self;
} }
- initWithHost: (OFString*)host - initWithHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
socket: (SSLSocket*)socket socket: (SSLSocket *)socket
SSLError: (unsigned long)SSLError SSLError: (unsigned long)SSLError
verifyResult: (long)verifyResult verifyResult: (long)verifyResult
{ {
@ -97,7 +97,7 @@
return self; return self;
} }
- (OFString*)description - (OFString *)description
{ {
if (_SSLError != SSL_ERROR_NONE) { if (_SSLError != SSL_ERROR_NONE) {
char error[512]; char error[512];

View file

@ -29,8 +29,8 @@
OFString *_reason; OFString *_reason;
} }
@property (readonly, copy) OFString *reason; @property (readonly, nonatomic) OFString *reason;
+ exceptionWithReason: (OFString*)reason; + exceptionWithReason: (OFString *)reason;
- initWithReason: (OFString*)reason; - initWithReason: (OFString *)reason;
@end @end

View file

@ -30,7 +30,7 @@
@implementation SSLInvalidCertificateException @implementation SSLInvalidCertificateException
@synthesize reason = _reason; @synthesize reason = _reason;
+ exceptionWithReason: (OFString*)reason + exceptionWithReason: (OFString *)reason
{ {
return [[[self alloc] initWithReason: reason] autorelease]; return [[[self alloc] initWithReason: reason] autorelease];
} }
@ -47,7 +47,7 @@
abort(); abort();
} }
- initWithReason: (OFString*)reason - initWithReason: (OFString *)reason
{ {
self = [super init]; self = [super init];
@ -68,7 +68,7 @@
[super dealloc]; [super dealloc];
} }
- (OFString*)description - (OFString *)description
{ {
return [OFString stringWithFormat: return [OFString stringWithFormat:
@"Invalid certificate! Reason: %@", _reason]; @"Invalid certificate! Reason: %@", _reason];

View file

@ -40,9 +40,9 @@
@property (getter=isRequestClientCertificatesEnabled) @property (getter=isRequestClientCertificatesEnabled)
bool requestClientCertificatesEnabled; bool requestClientCertificatesEnabled;
- initWithSocket: (OFTCPSocket*)socket; - initWithSocket: (OFTCPSocket *)socket;
- (void)SSL_super_close; - (void)SSL_super_close;
- (OFDataArray*)channelBindingDataWithType: (OFString*)type; - (OFDataArray *)channelBindingDataWithType: (OFString *)type;
- (X509Certificate*)peerCertificate; - (X509Certificate *)peerCertificate;
- (void)verifyPeerCertificate; - (void)verifyPeerCertificate;
@end @end

View file

@ -144,7 +144,7 @@ locking_callback(int mode, int n, const char *file, int line)
return self; return self;
} }
- initWithSocket: (OFTCPSocket*)socket - initWithSocket: (OFTCPSocket *)socket
{ {
self = [self init]; self = [self init];
@ -172,7 +172,7 @@ locking_callback(int mode, int n, const char *file, int line)
SSL_free(SSL_); SSL_free(SSL_);
} }
- (void)SSL_startTLSWithExpectedHost: (OFString*)host - (void)SSL_startTLSWithExpectedHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
{ {
of_string_encoding_t encoding; of_string_encoding_t encoding;
@ -254,13 +254,13 @@ locking_callback(int mode, int n, const char *file, int line)
} }
} }
- (void)startTLSWithExpectedHost: (OFString*)host - (void)startTLSWithExpectedHost: (OFString *)host
{ {
[self SSL_startTLSWithExpectedHost: host [self SSL_startTLSWithExpectedHost: host
port: 0]; port: 0];
} }
- (void)connectToHost: (OFString*)host - (void)connectToHost: (OFString *)host
port: (uint16_t)port port: (uint16_t)port
{ {
[super connectToHost: host [super connectToHost: host
@ -272,7 +272,7 @@ locking_callback(int mode, int n, const char *file, int line)
- (instancetype)accept - (instancetype)accept
{ {
SSLSocket *client = (SSLSocket*)[super accept]; SSLSocket *client = (SSLSocket *)[super accept];
of_string_encoding_t encoding; of_string_encoding_t encoding;
if ((client->_SSL = SSL_new(ctx)) == NULL || if ((client->_SSL = SSL_new(ctx)) == NULL ||
@ -317,7 +317,7 @@ locking_callback(int mode, int n, const char *file, int line)
[super close]; [super close];
} }
- (size_t)lowlevelReadIntoBuffer: (void*)buffer - (size_t)lowlevelReadIntoBuffer: (void *)buffer
length: (size_t)length length: (size_t)length
{ {
ssize_t ret; ssize_t ret;
@ -347,7 +347,7 @@ locking_callback(int mode, int n, const char *file, int line)
return ret; return ret;
} }
- (void)lowlevelWriteBuffer: (const void*)buffer - (void)lowlevelWriteBuffer: (const void *)buffer
length: (size_t)length length: (size_t)length
{ {
if (length > INT_MAX) if (length > INT_MAX)
@ -374,46 +374,46 @@ locking_callback(int mode, int n, const char *file, int line)
return [super hasDataInReadBuffer]; return [super hasDataInReadBuffer];
} }
- (void)setCertificateFile: (OFString*)certificateFile - (void)setCertificateFile: (OFString *)certificateFile
forSNIHost: (OFString*)SNIHost forSNIHost: (OFString *)SNIHost
{ {
/* TODO */ /* TODO */
OF_UNRECOGNIZED_SELECTOR OF_UNRECOGNIZED_SELECTOR
} }
- (OFString*)certificateFileForSNIHost: (OFString*)SNIHost - (OFString *)certificateFileForSNIHost: (OFString *)SNIHost
{ {
/* TODO */ /* TODO */
OF_UNRECOGNIZED_SELECTOR OF_UNRECOGNIZED_SELECTOR
} }
- (void)setPrivateKeyFile: (OFString*)privateKeyFile - (void)setPrivateKeyFile: (OFString *)privateKeyFile
forSNIHost: (OFString*)SNIHost forSNIHost: (OFString *)SNIHost
{ {
/* TODO */ /* TODO */
OF_UNRECOGNIZED_SELECTOR OF_UNRECOGNIZED_SELECTOR
} }
- (OFString*)privateKeyFileForSNIHost: (OFString*)SNIHost - (OFString *)privateKeyFileForSNIHost: (OFString *)SNIHost
{ {
/* TODO */ /* TODO */
OF_UNRECOGNIZED_SELECTOR OF_UNRECOGNIZED_SELECTOR
} }
- (void)setPrivateKeyPassphrase: (const char*)privateKeyPassphrase - (void)setPrivateKeyPassphrase: (const char *)privateKeyPassphrase
forSNIHost: (OFString*)SNIHost forSNIHost: (OFString *)SNIHost
{ {
/* TODO */ /* TODO */
OF_UNRECOGNIZED_SELECTOR OF_UNRECOGNIZED_SELECTOR
} }
- (const char*)privateKeyPassphraseForSNIHost: (OFString*)SNIHost - (const char *)privateKeyPassphraseForSNIHost: (OFString *)SNIHost
{ {
/* TODO */ /* TODO */
OF_UNRECOGNIZED_SELECTOR OF_UNRECOGNIZED_SELECTOR
} }
- (OFDataArray*)channelBindingDataWithType: (OFString*)type - (OFDataArray *)channelBindingDataWithType: (OFString *)type
{ {
size_t length; size_t length;
char buffer[64]; char buffer[64];
@ -440,7 +440,7 @@ locking_callback(int mode, int n, const char *file, int line)
return data; return data;
} }
- (X509Certificate*)peerCertificate - (X509Certificate *)peerCertificate
{ {
X509 *certificate = SSL_get_peer_certificate(_SSL); X509 *certificate = SSL_get_peer_certificate(_SSL);

View file

@ -46,7 +46,7 @@
OFString *_string; OFString *_string;
} }
- initWithUTF8String: (const char*)string; - initWithUTF8String: (const char *)string;
@end @end
@interface X509Certificate: OFObject @interface X509Certificate: OFObject
@ -57,18 +57,18 @@
OFDictionary *_subjectAlternativeName; OFDictionary *_subjectAlternativeName;
} }
- initWithFile: (OFString*)file; - initWithFile: (OFString *)file;
- initWithX509Struct: (X509*)cert; - initWithX509Struct: (X509 *)cert;
- (OFDictionary*)issuer; - (OFDictionary *)issuer;
- (OFDictionary*)subject; - (OFDictionary *)subject;
- (OFDictionary*)subjectAlternativeName; - (OFDictionary *)subjectAlternativeName;
- (bool)hasCommonNameMatchingDomain: (OFString*)domain; - (bool)hasCommonNameMatchingDomain: (OFString *)domain;
- (bool)hasDNSNameMatchingDomain: (OFString*)domain; - (bool)hasDNSNameMatchingDomain: (OFString *)domain;
- (bool)hasSRVNameMatchingDomain: (OFString*)domain - (bool)hasSRVNameMatchingDomain: (OFString *)domain
service: (OFString*)service; service: (OFString *)service;
- (bool)X509_isAssertedDomain: (OFString*)asserted - (bool)X509_isAssertedDomain: (OFString *)asserted
equalDomain: (OFString*)domain; equalDomain: (OFString *)domain;
- (OFDictionary*)X509_dictionaryFromX509Name: (X509_NAME*)name; - (OFDictionary *)X509_dictionaryFromX509Name: (X509_NAME *)name;
- (X509OID*)X509_stringFromASN1Object: (ASN1_OBJECT*)obj; - (X509OID *)X509_stringFromASN1Object: (ASN1_OBJECT *)obj;
- (OFString*)X509_stringFromASN1String: (ASN1_STRING*)str; - (OFString *)X509_stringFromASN1String: (ASN1_STRING *)str;
@end @end

View file

@ -49,7 +49,7 @@
#import <ObjFW/macros.h> #import <ObjFW/macros.h>
@implementation X509Certificate @implementation X509Certificate
- initWithFile: (OFString*)path - initWithFile: (OFString *)path
{ {
self = [self init]; self = [self init];
@ -73,7 +73,7 @@
return self; return self;
} }
- initWithX509Struct: (X509*)certificate - initWithX509Struct: (X509 *)certificate
{ {
self = [self init]; self = [self init];
@ -102,7 +102,7 @@
[super dealloc]; [super dealloc];
} }
- (OFString*)description - (OFString *)description
{ {
OFMutableString *ret = [OFMutableString string]; OFMutableString *ret = [OFMutableString string];
@ -114,7 +114,7 @@
return ret; return ret;
} }
- (OFDictionary*)issuer - (OFDictionary *)issuer
{ {
X509_NAME *name; X509_NAME *name;
@ -127,7 +127,7 @@
return _issuer; return _issuer;
} }
- (OFDictionary*)subject - (OFDictionary *)subject
{ {
X509_NAME *name; X509_NAME *name;
@ -140,7 +140,7 @@
return _subject; return _subject;
} }
- (OFDictionary*)subjectAlternativeName - (OFDictionary *)subjectAlternativeName
{ {
OFAutoreleasePool *pool; OFAutoreleasePool *pool;
OFMutableDictionary *ret; OFMutableDictionary *ret;
@ -263,7 +263,7 @@
return ret; return ret;
} }
- (bool)hasCommonNameMatchingDomain: (OFString*)domain - (bool)hasCommonNameMatchingDomain: (OFString *)domain
{ {
OFString *name; OFString *name;
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
@ -282,7 +282,7 @@
return false; return false;
} }
- (bool)hasDNSNameMatchingDomain: (OFString*)domain - (bool)hasDNSNameMatchingDomain: (OFString *)domain
{ {
OFString *name; OFString *name;
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
@ -302,8 +302,8 @@
return false; return false;
} }
- (bool)hasSRVNameMatchingDomain: (OFString*)domain - (bool)hasSRVNameMatchingDomain: (OFString *)domain
service: (OFString*)service service: (OFString *)service
{ {
size_t serviceLength; size_t serviceLength;
OFString *name; OFString *name;
@ -336,8 +336,8 @@
return false; return false;
} }
- (bool)X509_isAssertedDomain: (OFString*)asserted - (bool)X509_isAssertedDomain: (OFString *)asserted
equalDomain: (OFString*)domain equalDomain: (OFString *)domain
{ {
/* /*
* In accordance with RFC 6125 this only allows a wildcard as the * In accordance with RFC 6125 this only allows a wildcard as the
@ -370,7 +370,7 @@
return false; return false;
} }
- (OFDictionary*)X509_dictionaryFromX509Name: (X509_NAME*)name - (OFDictionary *)X509_dictionaryFromX509Name: (X509_NAME *)name
{ {
OFMutableDictionary *dict = [OFMutableDictionary dictionary]; OFMutableDictionary *dict = [OFMutableDictionary dictionary];
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
@ -401,7 +401,7 @@
} }
- (X509OID*)X509_stringFromASN1Object: (ASN1_OBJECT*)object - (X509OID *)X509_stringFromASN1Object: (ASN1_OBJECT *)object
{ {
X509OID *ret; X509OID *ret;
int length, bufferLength = 256; int length, bufferLength = 256;
@ -424,12 +424,12 @@
return ret; return ret;
} }
- (OFString*)X509_stringFromASN1String: (ASN1_STRING*)str - (OFString *)X509_stringFromASN1String: (ASN1_STRING *)str
{ {
OFString *ret; OFString *ret;
char *buffer; char *buffer;
if (ASN1_STRING_to_UTF8((unsigned char**)&buffer, str) < 0) if (ASN1_STRING_to_UTF8((unsigned char **)&buffer, str) < 0)
@throw [OFInvalidEncodingException exception]; @throw [OFInvalidEncodingException exception];
@try { @try {
@ -443,7 +443,7 @@
@end @end
@implementation X509OID @implementation X509OID
- initWithUTF8String: (const char*)string - initWithUTF8String: (const char *)string
{ {
self = [self init]; self = [self init];
@ -463,7 +463,7 @@
[super dealloc]; [super dealloc];
} }
- (OFString*)description - (OFString *)description
{ {
char tmp[1024]; char tmp[1024];
OBJ_obj2txt(tmp, sizeof(tmp), OBJ_txt2obj([_string UTF8String], 1), 0); OBJ_obj2txt(tmp, sizeof(tmp), OBJ_txt2obj([_string UTF8String], 1), 0);