From c428df9b60bed367a9c8938f30095e63dd365236 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Mon, 8 May 2017 02:31:13 +0200 Subject: [PATCH] Adjust to recent ObjFW changes --- src/SSLConnectionFailedException.h | 16 ++++++------- src/SSLConnectionFailedException.m | 18 +++++++------- src/SSLInvalidCertificateException.h | 6 ++--- src/SSLInvalidCertificateException.m | 6 ++--- src/SSLSocket.h | 6 ++--- src/SSLSocket.m | 36 ++++++++++++++-------------- src/X509Certificate.h | 30 +++++++++++------------ src/X509Certificate.m | 36 ++++++++++++++-------------- 8 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/SSLConnectionFailedException.h b/src/SSLConnectionFailedException.h index f8b3db3..31aef4f 100644 --- a/src/SSLConnectionFailedException.h +++ b/src/SSLConnectionFailedException.h @@ -33,22 +33,22 @@ @property (readonly) unsigned long SSLError; @property (readonly) long verifyResult; -+ (instancetype)exceptionWithHost: (OFString*)host ++ (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port - socket: (SSLSocket*)socket + socket: (SSLSocket *)socket SSLError: (unsigned long)SSLError; -+ (instancetype)exceptionWithHost: (OFString*)host ++ (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port - socket: (SSLSocket*)socket + socket: (SSLSocket *)socket SSLError: (unsigned long)SSLError verifyResult: (long)verifyResult; -- initWithHost: (OFString*)host +- initWithHost: (OFString *)host port: (uint16_t)port - socket: (SSLSocket*)socket + socket: (SSLSocket *)socket SSLError: (unsigned long)SSLError; -- initWithHost: (OFString*)host +- initWithHost: (OFString *)host port: (uint16_t)port - socket: (SSLSocket*)socket + socket: (SSLSocket *)socket SSLError: (unsigned long)SSLError verifyResult: (long)verifyResult; @end diff --git a/src/SSLConnectionFailedException.m b/src/SSLConnectionFailedException.m index 34a1fcf..2b78c57 100644 --- a/src/SSLConnectionFailedException.m +++ b/src/SSLConnectionFailedException.m @@ -42,9 +42,9 @@ @implementation SSLConnectionFailedException @synthesize SSLError = _SSLError, verifyResult = _verifyResult; -+ (instancetype)exceptionWithHost: (OFString*)host ++ (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port - socket: (SSLSocket*)socket + socket: (SSLSocket *)socket SSLError: (unsigned long)SSLError { return [[[self alloc] initWithHost: host @@ -54,9 +54,9 @@ } -+ (instancetype)exceptionWithHost: (OFString*)host ++ (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port - socket: (SSLSocket*)socket + socket: (SSLSocket *)socket SSLError: (unsigned long)SSLError verifyResult: (long)verifyResult { @@ -67,9 +67,9 @@ verifyResult: verifyResult] autorelease]; } -- initWithHost: (OFString*)host +- initWithHost: (OFString *)host port: (uint16_t)port - socket: (SSLSocket*)socket + socket: (SSLSocket *)socket SSLError: (unsigned long)SSLError { self = [super initWithHost: host @@ -81,9 +81,9 @@ return self; } -- initWithHost: (OFString*)host +- initWithHost: (OFString *)host port: (uint16_t)port - socket: (SSLSocket*)socket + socket: (SSLSocket *)socket SSLError: (unsigned long)SSLError verifyResult: (long)verifyResult { @@ -97,7 +97,7 @@ return self; } -- (OFString*)description +- (OFString *)description { if (_SSLError != SSL_ERROR_NONE) { char error[512]; diff --git a/src/SSLInvalidCertificateException.h b/src/SSLInvalidCertificateException.h index 4eb6277..d551593 100644 --- a/src/SSLInvalidCertificateException.h +++ b/src/SSLInvalidCertificateException.h @@ -29,8 +29,8 @@ OFString *_reason; } -@property (readonly, copy) OFString *reason; +@property (readonly, nonatomic) OFString *reason; -+ exceptionWithReason: (OFString*)reason; -- initWithReason: (OFString*)reason; ++ exceptionWithReason: (OFString *)reason; +- initWithReason: (OFString *)reason; @end diff --git a/src/SSLInvalidCertificateException.m b/src/SSLInvalidCertificateException.m index 89daba6..4a60a11 100644 --- a/src/SSLInvalidCertificateException.m +++ b/src/SSLInvalidCertificateException.m @@ -30,7 +30,7 @@ @implementation SSLInvalidCertificateException @synthesize reason = _reason; -+ exceptionWithReason: (OFString*)reason ++ exceptionWithReason: (OFString *)reason { return [[[self alloc] initWithReason: reason] autorelease]; } @@ -47,7 +47,7 @@ abort(); } -- initWithReason: (OFString*)reason +- initWithReason: (OFString *)reason { self = [super init]; @@ -68,7 +68,7 @@ [super dealloc]; } -- (OFString*)description +- (OFString *)description { return [OFString stringWithFormat: @"Invalid certificate! Reason: %@", _reason]; diff --git a/src/SSLSocket.h b/src/SSLSocket.h index f1f1f38..be2939c 100644 --- a/src/SSLSocket.h +++ b/src/SSLSocket.h @@ -40,9 +40,9 @@ @property (getter=isRequestClientCertificatesEnabled) bool requestClientCertificatesEnabled; -- initWithSocket: (OFTCPSocket*)socket; +- initWithSocket: (OFTCPSocket *)socket; - (void)SSL_super_close; -- (OFDataArray*)channelBindingDataWithType: (OFString*)type; -- (X509Certificate*)peerCertificate; +- (OFDataArray *)channelBindingDataWithType: (OFString *)type; +- (X509Certificate *)peerCertificate; - (void)verifyPeerCertificate; @end diff --git a/src/SSLSocket.m b/src/SSLSocket.m index 6ca75ab..49e86a0 100644 --- a/src/SSLSocket.m +++ b/src/SSLSocket.m @@ -144,7 +144,7 @@ locking_callback(int mode, int n, const char *file, int line) return self; } -- initWithSocket: (OFTCPSocket*)socket +- initWithSocket: (OFTCPSocket *)socket { self = [self init]; @@ -172,7 +172,7 @@ locking_callback(int mode, int n, const char *file, int line) SSL_free(SSL_); } -- (void)SSL_startTLSWithExpectedHost: (OFString*)host +- (void)SSL_startTLSWithExpectedHost: (OFString *)host port: (uint16_t)port { 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 port: 0]; } -- (void)connectToHost: (OFString*)host +- (void)connectToHost: (OFString *)host port: (uint16_t)port { [super connectToHost: host @@ -272,7 +272,7 @@ locking_callback(int mode, int n, const char *file, int line) - (instancetype)accept { - SSLSocket *client = (SSLSocket*)[super accept]; + SSLSocket *client = (SSLSocket *)[super accept]; of_string_encoding_t encoding; if ((client->_SSL = SSL_new(ctx)) == NULL || @@ -317,7 +317,7 @@ locking_callback(int mode, int n, const char *file, int line) [super close]; } -- (size_t)lowlevelReadIntoBuffer: (void*)buffer +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { ssize_t ret; @@ -347,7 +347,7 @@ locking_callback(int mode, int n, const char *file, int line) return ret; } -- (void)lowlevelWriteBuffer: (const void*)buffer +- (void)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { if (length > INT_MAX) @@ -374,46 +374,46 @@ locking_callback(int mode, int n, const char *file, int line) return [super hasDataInReadBuffer]; } -- (void)setCertificateFile: (OFString*)certificateFile - forSNIHost: (OFString*)SNIHost +- (void)setCertificateFile: (OFString *)certificateFile + forSNIHost: (OFString *)SNIHost { /* TODO */ OF_UNRECOGNIZED_SELECTOR } -- (OFString*)certificateFileForSNIHost: (OFString*)SNIHost +- (OFString *)certificateFileForSNIHost: (OFString *)SNIHost { /* TODO */ OF_UNRECOGNIZED_SELECTOR } -- (void)setPrivateKeyFile: (OFString*)privateKeyFile - forSNIHost: (OFString*)SNIHost +- (void)setPrivateKeyFile: (OFString *)privateKeyFile + forSNIHost: (OFString *)SNIHost { /* TODO */ OF_UNRECOGNIZED_SELECTOR } -- (OFString*)privateKeyFileForSNIHost: (OFString*)SNIHost +- (OFString *)privateKeyFileForSNIHost: (OFString *)SNIHost { /* TODO */ OF_UNRECOGNIZED_SELECTOR } -- (void)setPrivateKeyPassphrase: (const char*)privateKeyPassphrase - forSNIHost: (OFString*)SNIHost +- (void)setPrivateKeyPassphrase: (const char *)privateKeyPassphrase + forSNIHost: (OFString *)SNIHost { /* TODO */ OF_UNRECOGNIZED_SELECTOR } -- (const char*)privateKeyPassphraseForSNIHost: (OFString*)SNIHost +- (const char *)privateKeyPassphraseForSNIHost: (OFString *)SNIHost { /* TODO */ OF_UNRECOGNIZED_SELECTOR } -- (OFDataArray*)channelBindingDataWithType: (OFString*)type +- (OFDataArray *)channelBindingDataWithType: (OFString *)type { size_t length; char buffer[64]; @@ -440,7 +440,7 @@ locking_callback(int mode, int n, const char *file, int line) return data; } -- (X509Certificate*)peerCertificate +- (X509Certificate *)peerCertificate { X509 *certificate = SSL_get_peer_certificate(_SSL); diff --git a/src/X509Certificate.h b/src/X509Certificate.h index 4c99a4b..8df8ec3 100644 --- a/src/X509Certificate.h +++ b/src/X509Certificate.h @@ -46,7 +46,7 @@ OFString *_string; } -- initWithUTF8String: (const char*)string; +- initWithUTF8String: (const char *)string; @end @interface X509Certificate: OFObject @@ -57,18 +57,18 @@ OFDictionary *_subjectAlternativeName; } -- initWithFile: (OFString*)file; -- initWithX509Struct: (X509*)cert; -- (OFDictionary*)issuer; -- (OFDictionary*)subject; -- (OFDictionary*)subjectAlternativeName; -- (bool)hasCommonNameMatchingDomain: (OFString*)domain; -- (bool)hasDNSNameMatchingDomain: (OFString*)domain; -- (bool)hasSRVNameMatchingDomain: (OFString*)domain - service: (OFString*)service; -- (bool)X509_isAssertedDomain: (OFString*)asserted - equalDomain: (OFString*)domain; -- (OFDictionary*)X509_dictionaryFromX509Name: (X509_NAME*)name; -- (X509OID*)X509_stringFromASN1Object: (ASN1_OBJECT*)obj; -- (OFString*)X509_stringFromASN1String: (ASN1_STRING*)str; +- initWithFile: (OFString *)file; +- initWithX509Struct: (X509 *)cert; +- (OFDictionary *)issuer; +- (OFDictionary *)subject; +- (OFDictionary *)subjectAlternativeName; +- (bool)hasCommonNameMatchingDomain: (OFString *)domain; +- (bool)hasDNSNameMatchingDomain: (OFString *)domain; +- (bool)hasSRVNameMatchingDomain: (OFString *)domain + service: (OFString *)service; +- (bool)X509_isAssertedDomain: (OFString *)asserted + equalDomain: (OFString *)domain; +- (OFDictionary *)X509_dictionaryFromX509Name: (X509_NAME *)name; +- (X509OID *)X509_stringFromASN1Object: (ASN1_OBJECT *)obj; +- (OFString *)X509_stringFromASN1String: (ASN1_STRING *)str; @end diff --git a/src/X509Certificate.m b/src/X509Certificate.m index cce1ef4..bebcaf2 100644 --- a/src/X509Certificate.m +++ b/src/X509Certificate.m @@ -49,7 +49,7 @@ #import @implementation X509Certificate -- initWithFile: (OFString*)path +- initWithFile: (OFString *)path { self = [self init]; @@ -73,7 +73,7 @@ return self; } -- initWithX509Struct: (X509*)certificate +- initWithX509Struct: (X509 *)certificate { self = [self init]; @@ -102,7 +102,7 @@ [super dealloc]; } -- (OFString*)description +- (OFString *)description { OFMutableString *ret = [OFMutableString string]; @@ -114,7 +114,7 @@ return ret; } -- (OFDictionary*)issuer +- (OFDictionary *)issuer { X509_NAME *name; @@ -127,7 +127,7 @@ return _issuer; } -- (OFDictionary*)subject +- (OFDictionary *)subject { X509_NAME *name; @@ -140,7 +140,7 @@ return _subject; } -- (OFDictionary*)subjectAlternativeName +- (OFDictionary *)subjectAlternativeName { OFAutoreleasePool *pool; OFMutableDictionary *ret; @@ -263,7 +263,7 @@ return ret; } -- (bool)hasCommonNameMatchingDomain: (OFString*)domain +- (bool)hasCommonNameMatchingDomain: (OFString *)domain { OFString *name; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; @@ -282,7 +282,7 @@ return false; } -- (bool)hasDNSNameMatchingDomain: (OFString*)domain +- (bool)hasDNSNameMatchingDomain: (OFString *)domain { OFString *name; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; @@ -302,8 +302,8 @@ return false; } -- (bool)hasSRVNameMatchingDomain: (OFString*)domain - service: (OFString*)service +- (bool)hasSRVNameMatchingDomain: (OFString *)domain + service: (OFString *)service { size_t serviceLength; OFString *name; @@ -336,8 +336,8 @@ return false; } -- (bool)X509_isAssertedDomain: (OFString*)asserted - equalDomain: (OFString*)domain +- (bool)X509_isAssertedDomain: (OFString *)asserted + equalDomain: (OFString *)domain { /* * In accordance with RFC 6125 this only allows a wildcard as the @@ -370,7 +370,7 @@ return false; } -- (OFDictionary*)X509_dictionaryFromX509Name: (X509_NAME*)name +- (OFDictionary *)X509_dictionaryFromX509Name: (X509_NAME *)name { OFMutableDictionary *dict = [OFMutableDictionary dictionary]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; @@ -401,7 +401,7 @@ } -- (X509OID*)X509_stringFromASN1Object: (ASN1_OBJECT*)object +- (X509OID *)X509_stringFromASN1Object: (ASN1_OBJECT *)object { X509OID *ret; int length, bufferLength = 256; @@ -424,12 +424,12 @@ return ret; } -- (OFString*)X509_stringFromASN1String: (ASN1_STRING*)str +- (OFString *)X509_stringFromASN1String: (ASN1_STRING *)str { OFString *ret; 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]; @try { @@ -443,7 +443,7 @@ @end @implementation X509OID -- initWithUTF8String: (const char*)string +- initWithUTF8String: (const char *)string { self = [self init]; @@ -463,7 +463,7 @@ [super dealloc]; } -- (OFString*)description +- (OFString *)description { char tmp[1024]; OBJ_obj2txt(tmp, sizeof(tmp), OBJ_txt2obj([_string UTF8String], 1), 0);