Adjust to ObjFW changes

This commit is contained in:
Jonathan Schleifer 2017-07-23 01:09:18 +02:00
parent 10d492a94a
commit ea1fd23be5
No known key found for this signature in database
GPG key ID: 28D65178B37F33E3
3 changed files with 9 additions and 14 deletions

View file

@ -45,7 +45,7 @@ OF_ASSUME_NONNULL_BEGIN
X509Certificate *peerCertificate; X509Certificate *peerCertificate;
- initWithSocket: (OFTCPSocket *)socket; - initWithSocket: (OFTCPSocket *)socket;
- (OFDataArray *)channelBindingDataWithType: (OFString *)type; - (OFData *)channelBindingDataWithType: (OFString *)type;
- (nullable X509Certificate *)peerCertificate; - (nullable X509Certificate *)peerCertificate;
@end @end

View file

@ -43,7 +43,7 @@
#import <ObjFW/OFThread.h> #import <ObjFW/OFThread.h>
#import <ObjFW/OFHTTPRequest.h> #import <ObjFW/OFHTTPRequest.h>
#import <ObjFW/OFDataArray.h> #import <ObjFW/OFData.h>
#import <ObjFW/OFLocalization.h> #import <ObjFW/OFLocalization.h>
#import <ObjFW/OFAcceptFailedException.h> #import <ObjFW/OFAcceptFailedException.h>
@ -423,11 +423,10 @@ locking_callback(int mode, int n, const char *file, int line)
OF_UNRECOGNIZED_SELECTOR OF_UNRECOGNIZED_SELECTOR
} }
- (OFDataArray *)channelBindingDataWithType: (OFString *)type - (OFData *)channelBindingDataWithType: (OFString *)type
{ {
size_t length; size_t length;
char buffer[64]; char buffer[64];
OFDataArray *data;
if (![type isEqual: @"tls-unique"]) if (![type isEqual: @"tls-unique"])
@throw [OFInvalidArgumentException exception]; @throw [OFInvalidArgumentException exception];
@ -443,11 +442,8 @@ locking_callback(int mode, int n, const char *file, int line)
length = SSL_get_peer_finished(_SSL, buffer, 64); length = SSL_get_peer_finished(_SSL, buffer, 64);
} }
data = [OFDataArray dataArray]; return [OFData dataWithItems: buffer
[data addItems: buffer
count: length]; count: length];
return data;
} }
- (X509Certificate *)peerCertificate - (X509Certificate *)peerCertificate

View file

@ -37,7 +37,7 @@
#import <ObjFW/OFAutoreleasePool.h> #import <ObjFW/OFAutoreleasePool.h>
#import <ObjFW/OFArray.h> #import <ObjFW/OFArray.h>
#import <ObjFW/OFDataArray.h> #import <ObjFW/OFData.h>
#import <ObjFW/OFDictionary.h> #import <ObjFW/OFDictionary.h>
#import <ObjFW/OFFile.h> #import <ObjFW/OFFile.h>
#import <ObjFW/OFInitializationFailedException.h> #import <ObjFW/OFInitializationFailedException.h>
@ -72,11 +72,10 @@ OF_ASSUME_NONNULL_END
@try { @try {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFDataArray *data = [OFDataArray OFData *data = [OFData dataWithContentsOfFile: path];
dataArrayWithContentsOfFile: path]; const unsigned char *dataC = [data items];
const unsigned char *dataCArray = [data items];
_certificate = d2i_X509(NULL, &dataCArray, [data count]); _certificate = d2i_X509(NULL, &dataC, [data count]);
if (_certificate == NULL) if (_certificate == NULL)
@throw [OFInitializationFailedException @throw [OFInitializationFailedException
exceptionWithClass: [self class]]; exceptionWithClass: [self class]];