commit 5006a29d0933e395202dddc590b4fed3a5f786a7 parent 9080f73b910b1a4670811b70a1d70192d78900eb Author: Cedric <cedric.zwahlen@students.bfh.ch> Date: Mon, 15 Jan 2024 16:37:34 +0100 Refactoring Diffstat:
15 files changed, 14 insertions(+), 29 deletions(-)
diff --git a/.DS_Store b/.DS_Store Binary files differ. diff --git a/lib-gpu-generate/.DS_Store b/lib-gpu-generate/.DS_Store Binary files differ. diff --git a/source/.DS_Store b/source/.DS_Store Binary files differ. diff --git a/source/gpuv-montg.cl b/source/gpuv-montg.cl @@ -1 +0,0 @@ -../xcode/gpuv-montg.cl -\ No newline at end of file diff --git a/xcode/gpuv-montg.cl b/source/gpuv-montg.cl diff --git a/source/gpuv.cl b/source/gpuv.cl @@ -1 +0,0 @@ -../xcode/gpuv.cl -\ No newline at end of file diff --git a/xcode/gpuv.cl b/source/gpuv.cl diff --git a/source/gpuvt-test.c b/source/gpuvt-test.c @@ -181,14 +181,14 @@ static volatile bool finished = 0; void gpuvt_finally(void *cls, int valid, struct timespec time, unsigned long len, uint32_t *res) { if (valid) { - printf("VERIFICATION RESULT: OK\n\n"); + fprintf(stderr,"Verdict: OK\n"); } else { - printf("VERIFICATION RESULT: NOT OK!\n"); + fprintf(stderr,"Verdict: NOT OK\n"); } - printf("Verification took %ld.%06ld s\n",time.tv_sec, time.tv_nsec); + fprintf(stderr,"\nVerification took %ld.%06ld s\n",time.tv_sec, time.tv_nsec); - *((int*)cls) = valid; + *((int*)cls) = !valid; finished = 1; } @@ -217,9 +217,7 @@ int gpuvt_test(enum GPUV_VARIANT variant) { unsigned long *pks = malloc(arr_sz); memset(pks, 0, arr_sz); - printf("READING KEYS...\n"); - - //enum GPUV_VARIANT variant = GPUV_CPU; +// printf("Reading Test Keys...\n"); gpuvt_read_files(variant, n_buf, @@ -228,7 +226,7 @@ int gpuvt_test(enum GPUV_VARIANT variant) { s_buf, pks, &pairs); - printf("VERIFYING %lu SIGNATURES...\n", pairs); + fprintf(stderr, "Verifying %lu signatures...\n", pairs); unsigned long pubks = 0; @@ -317,11 +315,11 @@ int gpuvt_test(enum GPUV_VARIANT variant) { int valid = 0; + fprintf(stderr, "Kernel is running...\n"); + // A kernel always runs to completion – it can't be cancelled. But it is non-blocking, so the program can be terminated at any time. gpuv_start(state, &gpuvt_finally, &valid, batch); - fprintf(stderr, "KERNEL RUNNING...\n"); - // wait for the job to finish while (!finished) { sleep(1); } @@ -352,12 +350,15 @@ main (int argc, char**argv) gpuv_prepare_gcry (); + printf("--- MONTGOMERY (GPU) ---\n"); valid |= gpuvt_test (GPUV_GPU_MONTGOMERY); - valid |= gpuvt_test (GPUV_CPU); - + printf("\n--- NON-MONTGOMERY KERNEL (GPU) ---\n"); valid |= gpuvt_test (GPUV_GPU_REGULAR); + printf("\n--- CPU ---\n"); + valid |= gpuvt_test (GPUV_CPU); + return valid; } diff --git a/source/lib-gpu-generate/.DS_Store b/source/lib-gpu-generate/.DS_Store Binary files differ. diff --git a/source/lib-gpu-generate/msgsig.txt b/source/lib-gpu-generate/msgsig.txt @@ -1 +0,0 @@ -../../xcode/lib-gpu-generate/msgsig.txt -\ No newline at end of file diff --git a/source/lib-gpu-generate/publickey.txt b/source/lib-gpu-generate/publickey.txt @@ -1 +0,0 @@ -../../xcode/lib-gpu-generate/publickey.txt -\ No newline at end of file diff --git a/xcode/.DS_Store b/xcode/.DS_Store Binary files differ. diff --git a/xcode/lib-gpu-verify.xcodeproj/project.pbxproj b/xcode/lib-gpu-verify.xcodeproj/project.pbxproj @@ -7,10 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 6A8A795F2A89672700116D7D /* gpuv.cl in Sources */ = {isa = PBXBuildFile; fileRef = 6A8A795E2A89672700116D7D /* gpuv.cl */; }; 6A9DF2232B4B418400E368BE /* universal.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A9DF2222B4B418400E368BE /* universal.c */; }; 6ABC2E842B231DFF00033B90 /* util.c in Sources */ = {isa = PBXBuildFile; fileRef = 6ABC2E832B231DFF00033B90 /* util.c */; }; - 6AC553252B2E174900046AB7 /* gpuv-montg.cl in Sources */ = {isa = PBXBuildFile; fileRef = 6AC553242B2E174900046AB7 /* gpuv-montg.cl */; }; 6AC553292B2E17C800046AB7 /* gpuvt-test.c in Sources */ = {isa = PBXBuildFile; fileRef = 6AC553282B2E17C800046AB7 /* gpuvt-test.c */; }; C3770EFD0E6F1138009A5A77 /* OpenCL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3770EFC0E6F1138009A5A77 /* OpenCL.framework */; }; /* End PBXBuildFile section */ @@ -29,12 +27,10 @@ /* Begin PBXFileReference section */ 466E0F5F0C932E1A00ED01DB /* lib-gpu-verify */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "lib-gpu-verify"; sourceTree = BUILT_PRODUCTS_DIR; }; - 6A8A795E2A89672700116D7D /* gpuv.cl */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.opencl; path = gpuv.cl; sourceTree = "<group>"; }; 6A9DF2212B4B20F300E368BE /* universal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = universal.h; path = ../source/universal.h; sourceTree = "<group>"; }; 6A9DF2222B4B418400E368BE /* universal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = universal.c; path = ../source/universal.c; sourceTree = "<group>"; }; 6ABC2E832B231DFF00033B90 /* util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = util.c; path = ../source/util.c; sourceTree = "<group>"; }; 6ABC2E852B231E0400033B90 /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = util.h; path = ../source/util.h; sourceTree = "<group>"; }; - 6AC553242B2E174900046AB7 /* gpuv-montg.cl */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.opencl; path = "gpuv-montg.cl"; sourceTree = "<group>"; }; 6AC553272B2E17C800046AB7 /* gpuvt-test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "gpuvt-test.h"; path = "../source/gpuvt-test.h"; sourceTree = "<group>"; }; 6AC553282B2E17C800046AB7 /* gpuvt-test.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = "gpuvt-test.c"; path = "../source/gpuvt-test.c"; sourceTree = "<group>"; }; 6AD715F92B5177AC0044FCB7 /* README */ = {isa = PBXFileReference; lastKnownFileType = text; name = README; path = ../README; sourceTree = "<group>"; }; @@ -84,8 +80,6 @@ isa = PBXGroup; children = ( 6A984F162AC5B18A00F530FD /* Headers */, - 6A8A795E2A89672700116D7D /* gpuv.cl */, - 6AC553242B2E174900046AB7 /* gpuv-montg.cl */, 6A9DF2222B4B418400E368BE /* universal.c */, 6ABC2E832B231DFF00033B90 /* util.c */, 6AC553282B2E17C800046AB7 /* gpuvt-test.c */, @@ -156,9 +150,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 6AC553252B2E174900046AB7 /* gpuv-montg.cl in Sources */, 6AC553292B2E17C800046AB7 /* gpuvt-test.c in Sources */, - 6A8A795F2A89672700116D7D /* gpuv.cl in Sources */, 6A9DF2232B4B418400E368BE /* universal.c in Sources */, 6ABC2E842B231DFF00033B90 /* util.c in Sources */, ); diff --git a/xcode/lib-gpu-verify.xcodeproj/project.xcworkspace/xcuserdata/cedriczwahlen.xcuserdatad/UserInterfaceState.xcuserstate b/xcode/lib-gpu-verify.xcodeproj/project.xcworkspace/xcuserdata/cedriczwahlen.xcuserdatad/UserInterfaceState.xcuserstate Binary files differ. diff --git a/xcode/lib-gpu-verify.xcodeproj/xcshareddata/xcschemes/lib-gpu-verify.xcscheme b/xcode/lib-gpu-verify.xcodeproj/xcshareddata/xcschemes/lib-gpu-verify.xcscheme @@ -35,7 +35,7 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0" useCustomWorkingDirectory = "YES" - customWorkingDirectory = "/Users/cedriczwahlen/libgpuverify/xcode" + customWorkingDirectory = "/Users/cedriczwahlen/libgpuverify/source" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal"