Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 60d5df8

Browse files
committed
[[ LibOpenSSL101e ]] Added support for encrypt/decrypt to iOS.
1 parent 483396e commit 60d5df8

File tree

7 files changed

+52
-24
lines changed

7 files changed

+52
-24
lines changed

engine/engine-mobile.xcodeproj/project.pbxproj

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,13 @@
334334
remoteGlobalIDString = 4DD3E0171040BB5D00CAC7EF;
335335
remoteInfo = pngmobile;
336336
};
337+
4D76D93D1804281D0091FFE7 /* PBXContainerItemProxy */ = {
338+
isa = PBXContainerItemProxy;
339+
containerPortal = 4DBF5B061802E2F8009CAB2E /* libopenssl-mobile.xcodeproj */;
340+
proxyType = 1;
341+
remoteGlobalIDString = 4DBF5ABE1802C0E7009CAB2E;
342+
remoteInfo = revsecurity;
343+
};
337344
4D7B13AC171418F2006782C1 /* PBXContainerItemProxy */ = {
338345
isa = PBXContainerItemProxy;
339346
containerPortal = 4D88B96415F54C13002CFBD6 /* libgif-mobile.xcodeproj */;
@@ -408,21 +415,21 @@
408415
isa = PBXContainerItemProxy;
409416
containerPortal = 4DBF5B061802E2F8009CAB2E /* libopenssl-mobile.xcodeproj */;
410417
proxyType = 2;
411-
remoteGlobalIDString = 4DD3E0181040BB5D00CAC7EF /* libopensslmobile.a */;
418+
remoteGlobalIDString = 4DD3E0181040BB5D00CAC7EF;
412419
remoteInfo = opensslmobile;
413420
};
414421
4DBF5B0D1802E2F8009CAB2E /* PBXContainerItemProxy */ = {
415422
isa = PBXContainerItemProxy;
416423
containerPortal = 4DBF5B061802E2F8009CAB2E /* libopenssl-mobile.xcodeproj */;
417424
proxyType = 2;
418-
remoteGlobalIDString = 4DBF5ABF1802C0E7009CAB2E /* librevsecurity.a */;
425+
remoteGlobalIDString = 4DBF5ABF1802C0E7009CAB2E;
419426
remoteInfo = revsecurity;
420427
};
421428
4DBF5B0F1802E309009CAB2E /* PBXContainerItemProxy */ = {
422429
isa = PBXContainerItemProxy;
423430
containerPortal = 4DBF5B061802E2F8009CAB2E /* libopenssl-mobile.xcodeproj */;
424431
proxyType = 1;
425-
remoteGlobalIDString = 4DD3E0171040BB5D00CAC7EF /* opensslmobile */;
432+
remoteGlobalIDString = 4DD3E0171040BB5D00CAC7EF;
426433
remoteInfo = opensslmobile;
427434
};
428435
4DE7ED5C13B33C9D002634F5 /* PBXContainerItemProxy */ = {
@@ -1762,12 +1769,13 @@
17621769
4DD3DD961040AA9A00CAC7EF /* Sources */,
17631770
4DD3DD971040AA9A00CAC7EF /* Frameworks */,
17641771
F670DB65147D45A5008FEA1E /* CopyFiles */,
1765-
4DBF5B5B1802E7C1009CAB2E /* ShellScript */,
1772+
4DBF5B5B1802E7C1009CAB2E /* Copy revsecurity */,
17661773
);
17671774
buildRules = (
17681775
);
17691776
dependencies = (
17701777
4D08A0D3138EA52B0081F990 /* PBXTargetDependency */,
1778+
4D76D93E1804281D0091FFE7 /* PBXTargetDependency */,
17711779
);
17721780
name = "standalone-mobile-community";
17731781
productName = "standalone-mobile";
@@ -1928,20 +1936,21 @@
19281936
shellScript = "$PLATFORM_DEVELOPER_BIN_DIR/g++ -nodefaultlibs -Wl,-r -Wl,-x -arch ${ARCHS//\\ /\\ -arch\\ } -isysroot $SDKROOT -o \"$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.lcext\" \"$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME\" -Wl,-sectcreate -Wl,__MISC -Wl,__deps -Wl,\"$SRCROOT/standalone.ios\" -Wl,-exported_symbol -Wl,_main -Wl,-exported_symbol -Wl,_load_module -Wl,-exported_symbol -Wl,_resolve_symbol\n";
19291937
showEnvVarsInLog = 0;
19301938
};
1931-
4DBF5B5B1802E7C1009CAB2E /* ShellScript */ = {
1939+
4DBF5B5B1802E7C1009CAB2E /* Copy revsecurity */ = {
19321940
isa = PBXShellScriptBuildPhase;
19331941
buildActionMask = 2147483647;
19341942
files = (
19351943
);
19361944
inputPaths = (
1937-
"$(BUILT_PRODUCTS_DIR)/revsecurity.dylib",
1945+
"$(TARGET_BUILD_DIR)/revsecurity.dylib",
19381946
);
1947+
name = "Copy revsecurity";
19391948
outputPaths = (
1949+
"$(TARGET_BUILD_DIR)/standalone-mobile-community.app/revsecurity.dylib",
19401950
);
19411951
runOnlyForDeploymentPostprocessing = 0;
19421952
shellPath = /bin/sh;
1943-
shellScript = "copy \"$(BUILT_PRODUCTS_DIR)/revsecurity.dylib\" \"$(BUILD_PRODUCTS_DIR)/standalone-mobile-community.app/\"";
1944-
showEnvVarsInLog = 0;
1953+
shellScript = "cp \"$TARGET_BUILD_DIR/revsecurity.dylib\" \"$TARGET_BUILD_DIR/standalone-mobile-community.app/\"";
19451954
};
19461955
/* End PBXShellScriptBuildPhase section */
19471956

@@ -2227,6 +2236,11 @@
22272236
name = pngmobile;
22282237
targetProxy = 4D2220AD171D78FA00E7E557 /* PBXContainerItemProxy */;
22292238
};
2239+
4D76D93E1804281D0091FFE7 /* PBXTargetDependency */ = {
2240+
isa = PBXTargetDependency;
2241+
name = revsecurity;
2242+
targetProxy = 4D76D93D1804281D0091FFE7 /* PBXContainerItemProxy */;
2243+
};
22302244
4D7B149017141A3C006782C1 /* PBXTargetDependency */ = {
22312245
isa = PBXTargetDependency;
22322246
name = jpegmobile;

engine/src/mbliphone.mm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,3 +940,18 @@ bool MCS_random_bytes(size_t p_count, void* p_buffer)
940940
}
941941

942942
//////////////////
943+
944+
extern "C" void *IOS_LoadModule(const char *name);
945+
extern "C" void *IOS_ResolveSymbol(void *module, const char *name);
946+
947+
// MW-2013-10-08: [[ LibOpenSSL101e ]] This functions are used by the stubs to load
948+
// modules / resolve symbols.
949+
void *IOS_LoadModule(const char *name)
950+
{
951+
return MCsystem -> LoadModule(name);
952+
}
953+
954+
void *IOS_ResolveSymbol(void *module, const char *name)
955+
{
956+
return MCsystem -> ResolveModuleSymbol(module, name);
957+
}

engine/src/sysspec.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,10 +1308,6 @@ void MCS_ntoa(MCExecPoint& ep, MCExecPoint& ep2)
13081308
delete t_hostname;
13091309
}
13101310

1311-
void MCS_getDNSservers(MCExecPoint& ep)
1312-
{
1313-
}
1314-
13151311
char *MCS_dnsresolve(const char *p_hostname)
13161312
{
13171313
return NULL;
@@ -1324,6 +1320,10 @@ char *MCS_hostaddress(void)
13241320

13251321
#endif
13261322

1323+
void MCS_getDNSservers(MCExecPoint& ep)
1324+
{
1325+
}
1326+
13271327
////////////////////////////////////////////////////////////////////////////////
13281328

13291329
Boolean MCS_poll(real8 p_delay, int fd)

libcore/libcore-mobile.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
4D76D8F21804270B0091FFE7 /* filesystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D76D8F11804270B0091FFE7 /* filesystem.cpp */; };
1011
4DA2C9FA1136CE4900B9F27B /* core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DA2C9F81136CE4900B9F27B /* core.cpp */; };
1112
/* End PBXBuildFile section */
1213

1314
/* Begin PBXFileReference section */
15+
4D76D8F11804270B0091FFE7 /* filesystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filesystem.cpp; path = src/filesystem.cpp; sourceTree = "<group>"; };
1416
4DA2C9F81136CE4900B9F27B /* core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = core.cpp; path = src/core.cpp; sourceTree = "<group>"; };
1517
4DD3DF451040B04D00CAC7EF /* Global Mobile.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "Global Mobile.xcconfig"; path = "../rules/Global Mobile.xcconfig"; sourceTree = SOURCE_ROOT; };
1618
4DD3DF461040B04D00CAC7EF /* Debug Mobile.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "Debug Mobile.xcconfig"; path = "../rules/Debug Mobile.xcconfig"; sourceTree = SOURCE_ROOT; };
@@ -50,6 +52,7 @@
5052
4DD3DDAC1040ABB000CAC7EF /* Sources */ = {
5153
isa = PBXGroup;
5254
children = (
55+
4D76D8F11804270B0091FFE7 /* filesystem.cpp */,
5356
4DDD7EEC134BA4F2009037A0 /* core.h */,
5457
4DA2C9F81136CE4900B9F27B /* core.cpp */,
5558
);
@@ -130,6 +133,7 @@
130133
buildActionMask = 2147483647;
131134
files = (
132135
4DA2C9FA1136CE4900B9F27B /* core.cpp in Sources */,
136+
4D76D8F21804270B0091FFE7 /* filesystem.cpp in Sources */,
133137
);
134138
runOnlyForDeploymentPostprocessing = 0;
135139
};

libcore/src/filesystem.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ bool MCFileSystemPathExists(const char *p_path, bool p_folder, bool& r_exists)
138138
return t_success;
139139
}
140140

141-
#elif defined(_MACOSX) || defined(_LINUX)
141+
#elif defined(_MACOSX) || defined(_LINUX) || defined(TARGET_SUBPLATFORM_ANDROID) || defined(TARGET_SUBPLATFORM_IPHONE)
142142

143143
#ifndef _LINUX
144144
#include <sys/syslimits.h>
@@ -188,11 +188,6 @@ bool MCFileSystemPathExists(const char *p_path, bool p_folder, bool& r_exists)
188188
return true;
189189
}
190190

191-
#endif
192-
193-
194-
#ifdef _LINUX
195-
196191
#include <sys/types.h>
197192
#include <dirent.h>
198193

tools/build-extension-ios.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [ "$SYMBOLS" != "" ]; then
88
fi
99

1010
if [ -e "$SYMBOLS_FILE" ]; then
11-
SYMBOLS+="-Wl,-exported_symbols_list $SYMBOLS_FILE"
11+
SYMBOLS+="-Wl,-exported_symbols_list $SYMBOLS_FILE"
1212
fi
1313

1414
$PLATFORM_DEVELOPER_BIN_DIR/g++ -dynamiclib $ARCHS -isysroot $SDKROOT -L"$SOLUTION_DIR/prebuilt/lib/ios/$SDK_NAME" -o "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.dylib" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME" -dead_strip -Wl,-x $SYMBOLS $STATIC_DEPS

tools/weak_stub_maker.lc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ on process
4444
output "#define SYMBOL_PREFIX " & quote & "_" & quote
4545
output "#elif defined(TARGET_SUBPLATFORM_IPHONE)"
4646
output "typedef void *module_t;"
47-
output "extern" && quote & "C" & quote && "void *load_module(const char *);"
48-
output "extern" && quote & "C" & quote && "void *resolve_symbol(void *, const char *);"
49-
output "#define SYMBOL_PREFIX " & quote & "_" & quote
47+
output "extern" && quote & "C" & quote && "void *IOS_LoadModule(const char *);"
48+
output "extern" && quote & "C" & quote && "void *IOS_ResolveSymbol(void *, const char *);"
49+
output "#define SYMBOL_PREFIX"
5050
output "#elif defined(_LINUX) || defined(TARGET_SUBPLATFORM_ANDROID)"
5151
output "#include <dlfcn.h>"
5252
output "typedef void *module_t;"
@@ -70,7 +70,7 @@ on process
7070
output "#if defined(_MACOSX)"
7171
output " t_module = NSAddImage(p_source, NSADDIMAGE_OPTION_RETURN_ON_ERROR | NSADDIMAGE_OPTION_WITH_SEARCHING);"
7272
output "#elif defined(TARGET_SUBPLATFORM_IPHONE)"
73-
output " t_module = load_module(p_source);"
73+
output " t_module = IOS_LoadModule(p_source);"
7474
output "#elif defined(_LINUX) || defined(TARGET_SUBPLATFORM_ANDROID)"
7575
output " t_module = dlopen(p_source, RTLD_LAZY);"
7676
output "#elif defined(_WINDOWS)"
@@ -96,7 +96,7 @@ on process
9696
output " if (t_symbol != NULL)"
9797
output " t_handler = (handler_t)NSAddressOfSymbol(t_symbol);"
9898
output "#elif defined(TARGET_SUBPLATFORM_IPHONE)"
99-
output " t_handler = (handler_t)resolve_symbol(p_module, p_name);"
99+
output " t_handler = (handler_t)IOS_ResolveSymbol(p_module, p_name);"
100100
output "#elif defined(_LINUX) || defined(TARGET_SUBPLATFORM_ANDROID)"
101101
output " t_handler = (handler_t)dlsym(p_module, p_name);"
102102
output "#elif defined(_WINDOWS)"

0 commit comments

Comments
 (0)