diff --git a/BCB/Cheang et al/Figure 3d/Figure_3d.cod b/BCB/Cheang et al/Figure 3d/Figure_3d.cod new file mode 100644 index 0000000000000000000000000000000000000000..b312462390131c1696276e228b2835f24f1348cf --- /dev/null +++ b/BCB/Cheang et al/Figure 3d/Figure_3d.cod @@ -0,0 +1,64 @@ +; Listing generated by Microsoft (R) Optimizing Compiler Version 19.32.31332.0 + +include listing.inc + +INCLUDELIB MSVCRT +INCLUDELIB OLDNAMES + +PUBLIC foo +EXTRN array1:BYTE +EXTRN array2:BYTE +EXTRN N:BYTE +EXTRN S:BYTE +EXTRN __ImageBase:BYTE +; Function compile flags: /Ogtpy +; File C:\Users\piano\Documents\PhD\hyperproperties\IsabelleScripts\Relative_Security_Spectre\Kevin Cheang\3d\Figure_3d.c +; COMDAT foo +_TEXT SEGMENT +i$ = 8 +foo PROC ; COMDAT + +; 5 : if (i < N) { + + 00000 0f b6 05 00 00 + 00 00 movzx eax, BYTE PTR N + 00007 3b c8 cmp ecx, eax + 00009 73 2a jae SHORT $LN2@foo + +; 6 : uint8_t v = array1[i]; + + 0000b 0f ae e8 lfence + 0000e 8b c1 mov eax, ecx + 00010 48 8d 15 00 00 + 00 00 lea rdx, OFFSET FLAT:__ImageBase + 00017 0f b6 84 10 00 + 00 00 00 movzx eax, BYTE PTR array1[rax+rdx] + +; 7 : _mm_lfence(); + + 0001f 0f ae e8 lfence + +; 8 : return array2[v*S]; + + 00022 0f b6 0d 00 00 + 00 00 movzx ecx, BYTE PTR S + 00029 0f af c8 imul ecx, eax + 0002c 0f b6 84 11 00 + 00 00 00 movzx eax, BYTE PTR array2[rcx+rdx] + +; 11 : } + + 00034 c3 ret 0 +$LN2@foo: + +; 9 : } +; 10 : return 0; + + 00035 32 c0 xor al, al + +; 11 : } + + 00037 c3 ret 0 +foo ENDP +_TEXT ENDS +END diff --git a/BCB/Cheang et al/Figure 3d/Figure_3d.dll b/BCB/Cheang et al/Figure 3d/Figure_3d.dll new file mode 100644 index 0000000000000000000000000000000000000000..d5660eef78561f771e4ebafa3d8e748bf350273a Binary files /dev/null and b/BCB/Cheang et al/Figure 3d/Figure_3d.dll differ diff --git a/BCB/Cheang et al/ex_main.c b/BCB/Cheang et al/ex_main.c index 538746e55877e042ff9f98c71892df6d05b62ded..43e61af041079f9790bf44eae7cb1bec80972c65 100644 --- a/BCB/Cheang et al/ex_main.c +++ b/BCB/Cheang et al/ex_main.c @@ -5,4 +5,5 @@ size_t array2_size = 5; size_t array_size_mask = 0x1234; uint8_t array1[5]; uint8_t array2[5]; -uint8_t temp; \ No newline at end of file +uint8_t N; +uint8_t S; \ No newline at end of file diff --git a/BCB/Cheang et al/ex_main.h b/BCB/Cheang et al/ex_main.h index 4457a30477c17266cc254efc982da3b07a82b756..b073471c036956ca8f751eb70a7c8e26ac5d054f 100644 --- a/BCB/Cheang et al/ex_main.h +++ b/BCB/Cheang et al/ex_main.h @@ -2,4 +2,4 @@ #include <stdint.h> extern size_t array1_size, array2_size, array_size_mask; -extern uint8_t array1[], array2[], N , S; \ No newline at end of file +extern uint8_t array1[], array2[], N, S; \ No newline at end of file