auditor

An aarch64 constant-time memory access auditing tool.
git clone git://git.ppad.tech/auditor.git
Log | Files | Refs | README | LICENSE

bad.s (610B)


      1 ; bad.s - Known-bad assembly (secret-derived memory accesses)
      2 ; Should produce violations
      3 
      4 .section __TEXT,__text
      5 .globl _unsafe_function
      6 .p2align 2
      7 
      8 _unsafe_function:
      9     ; Stack frame setup
     10     stp x29, x30, [sp, #-16]!
     11     mov x29, sp
     12 
     13     ; Load a secret value
     14     ldr x0, [x20]
     15 
     16     ; BAD: Use secret as base address
     17     ldr x1, [x0]
     18 
     19     ; BAD: Use secret as index
     20     ldr x2, [x21, x0]
     21 
     22     ; BAD: Secret-derived address via arithmetic
     23     add x3, x0, #256
     24     ldr x4, [x3]
     25 
     26     ; BAD: Secret used in shifted index
     27     ldr x5, [x21, x0, lsl #3]
     28 
     29     ; Frame teardown
     30     ldp x29, x30, [sp], #16
     31     ret