Debian Codegraph @

clang/test/Sema/ptrauth-intrinsics-macro.c

raw
1 // RUN: %clang_cc1 -triple arm64-apple-ios -Wall -fsyntax-only -verify -fptrauth-intrinsics %s
2 // RUN: %clang_cc1 -triple arm64-apple-ios -Wall -fsyntax-only -verify %s
3
4 // expected-no-diagnostics
5
6 #include <ptrauth.h>
7
8 #define VALID_CODE_KEY 0
9 #define VALID_DATA_KEY 2
10
11 extern int dv;
12
13 void test(int *dp, int value) {
14 dp = ptrauth_strip(dp, VALID_DATA_KEY);
15 ptrauth_extra_data_t t0 = ptrauth_blend_discriminator(dp, value);
16 (void)t0;
17 dp = ptrauth_sign_unauthenticated(dp, VALID_DATA_KEY, 0);
18 dp = ptrauth_auth_and_resign(dp, VALID_DATA_KEY, dp, VALID_DATA_KEY, dp);
19 dp = ptrauth_auth_data(dp, VALID_DATA_KEY, 0);
20 int pu0 = 0, pu1 = 0, pu2 = 0, pu3 = 0, pu4 = 0, pu5 = 0, pu6 = 0, pu7 = 0;
21 ptrauth_blend_discriminator(&pu0, value);
22 ptrauth_auth_and_resign(&pu1, VALID_DATA_KEY, dp, VALID_DATA_KEY, dp);
23 ptrauth_auth_and_resign(dp, VALID_DATA_KEY, &pu2, VALID_DATA_KEY, dp);
24 ptrauth_auth_and_resign(dp, VALID_DATA_KEY, dp, VALID_DATA_KEY, &pu3);
25 ptrauth_sign_generic_data(pu4, dp);
26 ptrauth_sign_generic_data(dp, pu5);
27 ptrauth_auth_data(&pu6, VALID_DATA_KEY, value);
28 ptrauth_auth_data(dp, VALID_DATA_KEY, pu7);
29
30
31
32 int t2 = ptrauth_sign_generic_data(dp, 0);
33 (void)t2;
34 }
35
36 void test_string_discriminator(int *dp) {
37 ptrauth_extra_data_t t0 = ptrauth_string_discriminator("string");
38 (void)t0;
39 }
40
41 void test_type_discriminator(int *dp) {
42 ptrauth_extra_data_t t0 = ptrauth_type_discriminator(int (*)(int));
43 (void)t0;
44 }
45
46 void test_sign_constant(int *dp) {
47 dp = ptrauth_sign_constant(&dv, VALID_DATA_KEY, 0);
48 }