File: ptrauth-intrinsics-macro.c

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (48 lines) | stat: -rw-r--r-- 1,543 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// RUN: %clang_cc1 -triple arm64-apple-ios -Wall -fsyntax-only -verify -fptrauth-intrinsics %s
// RUN: %clang_cc1 -triple arm64-apple-ios -Wall -fsyntax-only -verify %s

// expected-no-diagnostics

#include <ptrauth.h>

#define VALID_CODE_KEY 0
#define VALID_DATA_KEY 2

extern int dv;

void test(int *dp, int value) {
  dp = ptrauth_strip(dp, VALID_DATA_KEY);
  ptrauth_extra_data_t t0 = ptrauth_blend_discriminator(dp, value);
  (void)t0;
  dp = ptrauth_sign_unauthenticated(dp, VALID_DATA_KEY, 0);
  dp = ptrauth_auth_and_resign(dp, VALID_DATA_KEY, dp, VALID_DATA_KEY, dp);
  dp = ptrauth_auth_data(dp, VALID_DATA_KEY, 0);
  int pu0 = 0, pu1 = 0, pu2 = 0, pu3 = 0, pu4 = 0, pu5 = 0, pu6 = 0, pu7 = 0;
  ptrauth_blend_discriminator(&pu0, value);
  ptrauth_auth_and_resign(&pu1, VALID_DATA_KEY, dp, VALID_DATA_KEY, dp);
  ptrauth_auth_and_resign(dp, VALID_DATA_KEY, &pu2, VALID_DATA_KEY, dp);
  ptrauth_auth_and_resign(dp, VALID_DATA_KEY, dp, VALID_DATA_KEY, &pu3);
  ptrauth_sign_generic_data(pu4, dp);
  ptrauth_sign_generic_data(dp, pu5);
  ptrauth_auth_data(&pu6, VALID_DATA_KEY, value);
  ptrauth_auth_data(dp, VALID_DATA_KEY, pu7);



  int t2 = ptrauth_sign_generic_data(dp, 0);
  (void)t2;
}

void test_string_discriminator(int *dp) {
  ptrauth_extra_data_t t0 = ptrauth_string_discriminator("string");
  (void)t0;
}

void test_type_discriminator(int *dp) {
  ptrauth_extra_data_t t0 = ptrauth_type_discriminator(int (*)(int));
  (void)t0;
}

void test_sign_constant(int *dp) {
  dp = ptrauth_sign_constant(&dv, VALID_DATA_KEY, 0);
}