use CommonCrypto instead of OpenSSL

This commit is contained in:
clowwindy
2012-12-27 18:14:29 +08:00
parent 163f2334eb
commit e0b06e6a46
78 changed files with 8 additions and 8 deletions

View File

@@ -20,7 +20,6 @@
62F3C307168C35C9006D77BC /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 62F3C305168C35C9006D77BC /* ViewController.xib */; };
62F3C461168C411F006D77BC /* encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 62F3C45C168C411F006D77BC /* encrypt.c */; };
62F3C462168C411F006D77BC /* local.c in Sources */ = {isa = PBXBuildFile; fileRef = 62F3C45E168C411F006D77BC /* local.c */; };
62F3C474168C471E006D77BC /* openssl in Resources */ = {isa = PBXBuildFile; fileRef = 62F3C473168C471E006D77BC /* openssl */; };
62F3C48C168C488B006D77BC /* ev.c in Sources */ = {isa = PBXBuildFile; fileRef = 62F3C48A168C488B006D77BC /* ev.c */; };
/* End PBXBuildFile section */
@@ -46,7 +45,6 @@
62F3C45E168C411F006D77BC /* local.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = local.c; sourceTree = "<group>"; };
62F3C45F168C411F006D77BC /* local.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = local.h; sourceTree = "<group>"; };
62F3C460168C411F006D77BC /* socks5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = socks5.h; sourceTree = "<group>"; };
62F3C473168C471E006D77BC /* openssl */ = {isa = PBXFileReference; lastKnownFileType = folder; name = openssl; path = "shadowsocks-iOS/openssl"; sourceTree = "<group>"; };
62F3C48A168C488B006D77BC /* ev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ev.c; path = "shadowsocks-iOS/libev/ev.c"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -68,7 +66,6 @@
isa = PBXGroup;
children = (
62F3C475168C47AD006D77BC /* libev */,
62F3C473168C471E006D77BC /* openssl */,
62F3C2F0168C35C9006D77BC /* shadowsocks-iOS */,
62F3C2E9168C35C9006D77BC /* Frameworks */,
62F3C2E7168C35C9006D77BC /* Products */,
@@ -189,7 +186,6 @@
62F3C2FF168C35C9006D77BC /* Default@2x.png in Resources */,
62F3C301168C35C9006D77BC /* Default-568h@2x.png in Resources */,
62F3C307168C35C9006D77BC /* ViewController.xib in Resources */,
62F3C474168C471E006D77BC /* openssl in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -289,6 +285,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/libev-4.11/.libs\"",
"\"$(SDKROOT)/usr/lib/system\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
@@ -305,6 +302,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/libev-4.11/.libs\"",
"\"$(SDKROOT)/usr/lib/system\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
@@ -330,6 +328,7 @@
62F3C30C168C35C9006D77BC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

View File

@@ -1,6 +1,6 @@
#include "encrypt.h"
#include "openssl/md5.h"
#import <CommonCrypto/CommonDigest.h>
void encrypt(char *buf, int len) {
char *end = buf + len;
@@ -43,8 +43,9 @@ static int random_compare(const void *_x, const void *_y) {
void get_table(const char* key) {
unsigned char *table = encrypt_table;
unsigned char *tmp_hash;
tmp_hash = MD5((const unsigned char*)key, strlen(key), NULL);
unsigned char tmp_hash[16];
// tmp_hash = MD5((const unsigned char*)key, strlen(key), NULL);
CC_MD5(key, strlen(key), tmp_hash);
_a = *(unsigned long long *)tmp_hash;
unsigned int i;

View File

@@ -78,7 +78,7 @@ int create_and_bind(const char *port) {
}
if (rp == NULL) {
LOGE("Could not bind");
// LOGE("Could not bind");
return -1;
}