Index: src/SSLConnectionFailedException.h ================================================================== --- src/SSLConnectionFailedException.h +++ src/SSLConnectionFailedException.h @@ -31,24 +31,24 @@ } @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 Index: src/SSLConnectionFailedException.m ================================================================== --- src/SSLConnectionFailedException.m +++ src/SSLConnectionFailedException.m @@ -40,25 +40,25 @@ #endif @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 port: port socket: socket SSLError: SSLError] autorelease]; } -+ (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 { return [[[self alloc] initWithHost: host port: port @@ -65,13 +65,13 @@ socket: socket SSLError: SSLError 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 port: port socket: socket]; @@ -79,13 +79,13 @@ _SSLError = SSLError; 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 { self = [super initWithHost: host port: port @@ -95,11 +95,11 @@ _verifyResult = verifyResult; return self; } -- (OFString*)description +- (OFString *)description { if (_SSLError != SSL_ERROR_NONE) { char error[512]; ERR_error_string_n(_SSLError, error, 512); Index: src/SSLInvalidCertificateException.h ================================================================== --- src/SSLInvalidCertificateException.h +++ src/SSLInvalidCertificateException.h @@ -27,10 +27,10 @@ @interface SSLInvalidCertificateException: OFException { 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 Index: src/SSLInvalidCertificateException.m ================================================================== --- src/SSLInvalidCertificateException.m +++ src/SSLInvalidCertificateException.m @@ -28,11 +28,11 @@ #import @implementation SSLInvalidCertificateException @synthesize reason = _reason; -+ exceptionWithReason: (OFString*)reason ++ exceptionWithReason: (OFString *)reason { return [[[self alloc] initWithReason: reason] autorelease]; } - init @@ -45,11 +45,11 @@ } abort(); } -- initWithReason: (OFString*)reason +- initWithReason: (OFString *)reason { self = [super init]; @try { _reason = [reason copy]; @@ -66,11 +66,11 @@ [_reason release]; [super dealloc]; } -- (OFString*)description +- (OFString *)description { return [OFString stringWithFormat: @"Invalid certificate! Reason: %@", _reason]; } @end Index: src/SSLSocket.h ================================================================== --- src/SSLSocket.h +++ src/SSLSocket.h @@ -38,11 +38,11 @@ } @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 Index: src/SSLSocket.m ================================================================== --- src/SSLSocket.m +++ src/SSLSocket.m @@ -142,11 +142,11 @@ _certificateVerificationEnabled = true; return self; } -- initWithSocket: (OFTCPSocket*)socket +- initWithSocket: (OFTCPSocket *)socket { self = [self init]; @try { if ((_socket = dup(socket->_socket)) < 0) @@ -170,11 +170,11 @@ if (SSL_ != NULL) SSL_free(SSL_); } -- (void)SSL_startTLSWithExpectedHost: (OFString*)host +- (void)SSL_startTLSWithExpectedHost: (OFString *)host port: (uint16_t)port { of_string_encoding_t encoding; if ((_SSL = SSL_new(ctx)) == NULL || SSL_set_fd(_SSL, _socket) != 1) { @@ -252,17 +252,17 @@ socket: self SSLError: error]; } } -- (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 port: port]; @@ -270,11 +270,11 @@ port: port]; } - (instancetype)accept { - SSLSocket *client = (SSLSocket*)[super accept]; + SSLSocket *client = (SSLSocket *)[super accept]; of_string_encoding_t encoding; if ((client->_SSL = SSL_new(ctx)) == NULL || !SSL_set_fd(client->_SSL, client->_socket)) { [client SSL_super_close]; @@ -315,11 +315,11 @@ - (void)SSL_super_close { [super close]; } -- (size_t)lowlevelReadIntoBuffer: (void*)buffer +- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { ssize_t ret; if (length > INT_MAX) @@ -345,11 +345,11 @@ _atEndOfStream = true; return ret; } -- (void)lowlevelWriteBuffer: (const void*)buffer +- (void)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { if (length > INT_MAX) @throw [OFOutOfRangeException exception]; @@ -372,50 +372,50 @@ 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 +- (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; @@ -438,11 +438,11 @@ count: length]; return data; } -- (X509Certificate*)peerCertificate +- (X509Certificate *)peerCertificate { X509 *certificate = SSL_get_peer_certificate(_SSL); if (!certificate) return nil; Index: src/X509Certificate.h ================================================================== --- src/X509Certificate.h +++ src/X509Certificate.h @@ -44,11 +44,11 @@ @interface X509OID: OFObject { OFString *_string; } -- initWithUTF8String: (const char*)string; +- initWithUTF8String: (const char *)string; @end @interface X509Certificate: OFObject { X509 *_certificate; @@ -55,20 +55,20 @@ 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; -- (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 Index: src/X509Certificate.m ================================================================== --- src/X509Certificate.m +++ src/X509Certificate.m @@ -47,11 +47,11 @@ #import #import @implementation X509Certificate -- initWithFile: (OFString*)path +- initWithFile: (OFString *)path { self = [self init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; @@ -71,11 +71,11 @@ } return self; } -- initWithX509Struct: (X509*)certificate +- initWithX509Struct: (X509 *)certificate { self = [self init]; @try { _certificate = X509_dup(certificate); @@ -100,11 +100,11 @@ X509_free(_certificate); [super dealloc]; } -- (OFString*)description +- (OFString *)description { OFMutableString *ret = [OFMutableString string]; [ret appendFormat: @"Issuer: %@\n\n", [self issuer]]; [ret appendFormat: @"Subject: %@\n\n", [self subject]]; @@ -112,11 +112,11 @@ [ret makeImmutable]; return ret; } -- (OFDictionary*)issuer +- (OFDictionary *)issuer { X509_NAME *name; if (_issuer != nil) return [[_issuer copy] autorelease]; @@ -125,11 +125,11 @@ _issuer = [[self X509_dictionaryFromX509Name: name] retain]; return _issuer; } -- (OFDictionary*)subject +- (OFDictionary *)subject { X509_NAME *name; if (_subject != nil) return [[_subject copy] autorelease]; @@ -138,11 +138,11 @@ _subject = [[self X509_dictionaryFromX509Name: name] retain]; return _subject; } -- (OFDictionary*)subjectAlternativeName +- (OFDictionary *)subjectAlternativeName { OFAutoreleasePool *pool; OFMutableDictionary *ret; int i; @@ -261,11 +261,11 @@ _subjectAlternativeName = [ret retain]; return ret; } -- (bool)hasCommonNameMatchingDomain: (OFString*)domain +- (bool)hasCommonNameMatchingDomain: (OFString *)domain { OFString *name; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFList *CNs = [[self subject] objectForKey: OID_commonName]; OFEnumerator *enumerator = [CNs objectEnumerator]; @@ -280,11 +280,11 @@ [pool release]; return false; } -- (bool)hasDNSNameMatchingDomain: (OFString*)domain +- (bool)hasDNSNameMatchingDomain: (OFString *)domain { OFString *name; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFDictionary *SANs = [self subjectAlternativeName]; OFList *assertedNames = [SANs objectForKey: @"dNSName"]; @@ -300,12 +300,12 @@ [pool release]; return false; } -- (bool)hasSRVNameMatchingDomain: (OFString*)domain - service: (OFString*)service +- (bool)hasSRVNameMatchingDomain: (OFString *)domain + service: (OFString *)service { size_t serviceLength; OFString *name; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFDictionary *SANs = [self subjectAlternativeName]; @@ -334,12 +334,12 @@ [pool release]; 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 * left-most label and matches only the left-most label with it. * E.g. *.example.com matches foo.example.com, @@ -368,11 +368,11 @@ return true; return false; } -- (OFDictionary*)X509_dictionaryFromX509Name: (X509_NAME*)name +- (OFDictionary *)X509_dictionaryFromX509Name: (X509_NAME *)name { OFMutableDictionary *dict = [OFMutableDictionary dictionary]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; int i, count = X509_NAME_entry_count(name); @@ -399,11 +399,11 @@ [dict makeImmutable]; return dict; } -- (X509OID*)X509_stringFromASN1Object: (ASN1_OBJECT*)object +- (X509OID *)X509_stringFromASN1Object: (ASN1_OBJECT *)object { X509OID *ret; int length, bufferLength = 256; char *buffer = [self allocMemoryWithSize: bufferLength]; @@ -422,16 +422,16 @@ } 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 { ret = [OFString stringWithUTF8String: buffer]; } @finally { @@ -441,11 +441,11 @@ return ret; } @end @implementation X509OID -- initWithUTF8String: (const char*)string +- initWithUTF8String: (const char *)string { self = [self init]; @try { _string = [[OFString alloc] initWithUTF8String: string]; @@ -461,11 +461,11 @@ { [_string release]; [super dealloc]; } -- (OFString*)description +- (OFString *)description { char tmp[1024]; OBJ_obj2txt(tmp, sizeof(tmp), OBJ_txt2obj([_string UTF8String], 1), 0); return [OFString stringWithUTF8String: tmp]; }