Replaced OpenSSL with Common Crypto for SHA1 in Bonjour. adium-1.5.10.3
authorThijs Alkemade <me@thijsalkema.de>
Tue, 21 Mar 2017 21:09:53 +0100
branchadium-1.5.10.3
changeset 5956 297f01718b75
parent 5955 297d0d30e457
child 5957 81732180bddf
Replaced OpenSSL with Common Crypto for SHA1 in Bonjour.

Fixes #17093
Plugins/Bonjour/libezv/Private Classes/AWEzvContactManagerRendezvous.m
--- a/Plugins/Bonjour/libezv/Private Classes/AWEzvContactManagerRendezvous.m	Tue Mar 21 20:53:24 2017 +0100
+++ b/Plugins/Bonjour/libezv/Private Classes/AWEzvContactManagerRendezvous.m	Tue Mar 21 21:09:53 2017 +0100
@@ -40,7 +40,7 @@
 #import "AWEzvSupportRoutines.h"
 
 #import <dns_sd.h>
-#import <openssl/sha.h>
+#include <CommonCrypto/CommonDigest.h>
 
 /* One of the stupidest things I've ever met. Doing DNS lookups using the standard
  * functions does not for mDNS records work unless you're in BIND 8 compatibility
@@ -331,8 +331,7 @@
 - (void)setImageData:(NSData *)JPEGData
 {
 	DNSServiceErrorType error;
-	SHA_CTX ctx;
-	unsigned char digest[20];
+	unsigned char digest[CC_SHA1_DIGEST_LENGTH];
 
 	if (avDNSReference == NULL) {
 		[[client client] reportError:@"Error setting image data" ofLevel:AWEzvWarning];
@@ -382,9 +381,7 @@
 
 	if (error == kDNSServiceErr_NoError) {
 		// Let's create the hash
-		SHA1_Init(&ctx);
-		SHA1_Update(&ctx, [JPEGData bytes], (unsigned long)[JPEGData length]);
-		SHA1_Final(digest, &ctx);
+		CC_SHA1([JPEGData bytes], (CC_LONG)[JPEGData length], digest);
 		imagehash = [[NSData dataWithBytes:digest length:20] retain];
 		AILogWithSignature(@"Will update with hash %@; length is %u", imagehash, [JPEGData length]);
 		[self updatePHSH];