Loading iOS/Makefile +76 Changes for iOS/Makefile: 76 added lines, 0 removed lines. Original line number Diff line number Diff line # # OpenSSL/iOS/Makefile # DIR= iOS TOP= .. CC= cc INCLUDES= -I$(TOP) -I$(TOP)/include CFLAG= -g -static MAKEFILE= Makefile PERL= perl RM= rm -f EXE=incore_macho CFLAGS= $(INCLUDES) $(CFLAG) top: @$(MAKE) -f $(TOP)/Makefile reflect THIS=exe exe: fips_algvs.app/fips_algvs incore_macho: incore_macho.c $(TOP)/crypto/sha/sha1dgst.c $(HOSTCC) $(HOSTCFLAGS) -I$(TOP)/include -I$(TOP)/crypto -o $@ incore_macho.c $(TOP)/crypto/sha/sha1dgst.c fips_algvs.app/fips_algvs: $(TOP)/test/fips_algvs.c $(TOP)/fips/fipscanister.o fopen.m incore_macho FIPS_SIG=./incore_macho \ $(TOP)/fips/fipsld $(CFLAGS) -I$(TOP)/fips -o $@ \ $(TOP)/test/fips_algvs.c $(TOP)/fips/fipscanister.o \ fopen.m -framework Foundation || rm $@ codesign -f -s "iPhone Developer" --entitlements fips_algvs.app/Entitlements.plist fips_algvs.app || rm $@ install: @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... @set -e; for i in $(EXE); \ do \ (echo installing $$i; \ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \ done; @set -e; for i in $(SCRIPTS); \ do \ (echo installing $$i; \ cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \ chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \ mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \ done tags: ctags $(SRC) tests: links: lint: lint -DLINT $(INCLUDES) $(SRC)>fluff depend: @if [ -z "$(THIS)" ]; then \ $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; \ else \ $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC); \ fi dclean: $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new mv -f Makefile.new $(MAKEFILE) clean: rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE) rm -f fips_algvs.app/fips_algvs # DO NOT DELETE THIS LINE -- make depend depends on it. iOS/fips_algvs.app/Entitlements.plist +8 Changes for iOS/fips_algvs.app/Entitlements.plist: 8 added lines, 0 removed lines. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>get-task-allow</key> <true/> </dict> </plist> No newline at end of file iOS/fips_algvs.app/Info.plist +24 Changes for iOS/fips_algvs.app/Info.plist: 24 added lines, 0 removed lines. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleName</key> <string>fips_algvs</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>CFBundleExecutable</key> <string>fips_algvs</string> <key>CFBundleIdentifier</key> <string>fips_algvs</string> <key>CFBundleResourceSpecification</key> <string>ResourceRules.plist</string> <key>LSRequiresIPhoneOS</key> <true/> <key>CFBundleDisplayName</key> <string>fips_algvs</string> <key>CFBundleVersion</key> <string>1.0</string> </dict> </plist> iOS/fips_algvs.app/ResourceRules.plist +25 Changes for iOS/fips_algvs.app/ResourceRules.plist: 25 added lines, 0 removed lines. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>rules</key> <dict> <key>.*</key> <true/> <key>Info.plist</key> <dict> <key>omit</key> <true/> <key>weight</key> <real>10</real> </dict> <key>ResourceRules.plist</key> <dict> <key>omit</key> <true/> <key>weight</key> <real>100</real> </dict> </dict> </dict> </plist> iOS/fopen.m +93 Changes for iOS/fopen.m: 93 added lines, 0 removed lines. Original line number Diff line number Diff line #include <stdio.h> #include <dlfcn.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <Foundation/Foundation.h> static FILE *(*libc_fopen)(const char *, const char *) = NULL; __attribute__((constructor)) static void pre_main(void) { /* * Pull reference to fopen(3) from libc. */ void *handle = dlopen("libSystem.B.dylib",RTLD_LAZY); if (handle) { libc_fopen = dlsym(handle,"fopen"); dlclose(handle); } /* * Change to Documents directory. */ NSString *docs = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; NSFileManager *filemgr = [NSFileManager defaultManager]; [filemgr changeCurrentDirectoryPath: docs]; [filemgr release]; } char *mkdirhier(char *path) { char *slash; struct stat buf; if (path[0]=='.' && path[1]=='/') path+=2; if ((slash = strrchr(path,'/'))) { *slash = '\0'; if (stat(path,&buf)==0) { *slash = '/'; return NULL; } (void)mkdirhier(path); mkdir (path,0777); *slash = '/'; } return slash; } /* * Replacement fopen(3) */ FILE *fopen(const char *filename, const char *mode) { FILE *ret; if ((ret = (*libc_fopen)(filename,mode)) == NULL) { /* * If file is not present in Documents directory, try from Bundle. */ NSString *nsspath = [NSString stringWithFormat:@"%@/%s", [[NSBundle mainBundle] bundlePath], filename]; if ((ret = (*libc_fopen)([nsspath cStringUsingEncoding:NSUTF8StringEncoding],mode)) == NULL && mode[0]=='w' && ((filename[0]!='.' && filename[0]!='/') || (filename[0]=='.' && filename[1]=='/')) ) { /* * If not present in Bundle, create directory in Documents */ char *path = strdup(filename), *slash; static int once = 1; if ((slash = mkdirhier(path)) && once) { /* * For some reason iOS truncates first created file * upon program exit, so we create one preemptively... */ once = 0; strcpy(slash,"/.0"); creat(path,0444); } free(path); ret = (*libc_fopen)(filename,mode); } } return ret; } Loading
iOS/Makefile +76 Changes for iOS/Makefile: 76 added lines, 0 removed lines. Original line number Diff line number Diff line # # OpenSSL/iOS/Makefile # DIR= iOS TOP= .. CC= cc INCLUDES= -I$(TOP) -I$(TOP)/include CFLAG= -g -static MAKEFILE= Makefile PERL= perl RM= rm -f EXE=incore_macho CFLAGS= $(INCLUDES) $(CFLAG) top: @$(MAKE) -f $(TOP)/Makefile reflect THIS=exe exe: fips_algvs.app/fips_algvs incore_macho: incore_macho.c $(TOP)/crypto/sha/sha1dgst.c $(HOSTCC) $(HOSTCFLAGS) -I$(TOP)/include -I$(TOP)/crypto -o $@ incore_macho.c $(TOP)/crypto/sha/sha1dgst.c fips_algvs.app/fips_algvs: $(TOP)/test/fips_algvs.c $(TOP)/fips/fipscanister.o fopen.m incore_macho FIPS_SIG=./incore_macho \ $(TOP)/fips/fipsld $(CFLAGS) -I$(TOP)/fips -o $@ \ $(TOP)/test/fips_algvs.c $(TOP)/fips/fipscanister.o \ fopen.m -framework Foundation || rm $@ codesign -f -s "iPhone Developer" --entitlements fips_algvs.app/Entitlements.plist fips_algvs.app || rm $@ install: @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... @set -e; for i in $(EXE); \ do \ (echo installing $$i; \ cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \ done; @set -e; for i in $(SCRIPTS); \ do \ (echo installing $$i; \ cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \ chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \ mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \ done tags: ctags $(SRC) tests: links: lint: lint -DLINT $(INCLUDES) $(SRC)>fluff depend: @if [ -z "$(THIS)" ]; then \ $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; \ else \ $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(SRC); \ fi dclean: $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new mv -f Makefile.new $(MAKEFILE) clean: rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE) rm -f fips_algvs.app/fips_algvs # DO NOT DELETE THIS LINE -- make depend depends on it.
iOS/fips_algvs.app/Entitlements.plist +8 Changes for iOS/fips_algvs.app/Entitlements.plist: 8 added lines, 0 removed lines. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>get-task-allow</key> <true/> </dict> </plist> No newline at end of file
iOS/fips_algvs.app/Info.plist +24 Changes for iOS/fips_algvs.app/Info.plist: 24 added lines, 0 removed lines. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleName</key> <string>fips_algvs</string> <key>CFBundleSupportedPlatforms</key> <array> <string>iPhoneOS</string> </array> <key>CFBundleExecutable</key> <string>fips_algvs</string> <key>CFBundleIdentifier</key> <string>fips_algvs</string> <key>CFBundleResourceSpecification</key> <string>ResourceRules.plist</string> <key>LSRequiresIPhoneOS</key> <true/> <key>CFBundleDisplayName</key> <string>fips_algvs</string> <key>CFBundleVersion</key> <string>1.0</string> </dict> </plist>
iOS/fips_algvs.app/ResourceRules.plist +25 Changes for iOS/fips_algvs.app/ResourceRules.plist: 25 added lines, 0 removed lines. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>rules</key> <dict> <key>.*</key> <true/> <key>Info.plist</key> <dict> <key>omit</key> <true/> <key>weight</key> <real>10</real> </dict> <key>ResourceRules.plist</key> <dict> <key>omit</key> <true/> <key>weight</key> <real>100</real> </dict> </dict> </dict> </plist>
iOS/fopen.m +93 Changes for iOS/fopen.m: 93 added lines, 0 removed lines. Original line number Diff line number Diff line #include <stdio.h> #include <dlfcn.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <Foundation/Foundation.h> static FILE *(*libc_fopen)(const char *, const char *) = NULL; __attribute__((constructor)) static void pre_main(void) { /* * Pull reference to fopen(3) from libc. */ void *handle = dlopen("libSystem.B.dylib",RTLD_LAZY); if (handle) { libc_fopen = dlsym(handle,"fopen"); dlclose(handle); } /* * Change to Documents directory. */ NSString *docs = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; NSFileManager *filemgr = [NSFileManager defaultManager]; [filemgr changeCurrentDirectoryPath: docs]; [filemgr release]; } char *mkdirhier(char *path) { char *slash; struct stat buf; if (path[0]=='.' && path[1]=='/') path+=2; if ((slash = strrchr(path,'/'))) { *slash = '\0'; if (stat(path,&buf)==0) { *slash = '/'; return NULL; } (void)mkdirhier(path); mkdir (path,0777); *slash = '/'; } return slash; } /* * Replacement fopen(3) */ FILE *fopen(const char *filename, const char *mode) { FILE *ret; if ((ret = (*libc_fopen)(filename,mode)) == NULL) { /* * If file is not present in Documents directory, try from Bundle. */ NSString *nsspath = [NSString stringWithFormat:@"%@/%s", [[NSBundle mainBundle] bundlePath], filename]; if ((ret = (*libc_fopen)([nsspath cStringUsingEncoding:NSUTF8StringEncoding],mode)) == NULL && mode[0]=='w' && ((filename[0]!='.' && filename[0]!='/') || (filename[0]=='.' && filename[1]=='/')) ) { /* * If not present in Bundle, create directory in Documents */ char *path = strdup(filename), *slash; static int once = 1; if ((slash = mkdirhier(path)) && once) { /* * For some reason iOS truncates first created file * upon program exit, so we create one preemptively... */ once = 0; strcpy(slash,"/.0"); creat(path,0444); } free(path); ret = (*libc_fopen)(filename,mode); } } return ret; }