Skip to content

Drop <stdint.h> dependency from <ptrauth.h> #7967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions clang/lib/Headers/ptrauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#ifndef __PTRAUTH_H
#define __PTRAUTH_H

#include <stdint.h>

typedef enum {
ptrauth_key_asia = 0,
ptrauth_key_asib = 1,
Expand Down Expand Up @@ -90,10 +88,10 @@ typedef enum {
} ptrauth_key;

/* An integer type of the appropriate size for a discriminator argument. */
typedef uintptr_t ptrauth_extra_data_t;
typedef __UINTPTR_TYPE__ ptrauth_extra_data_t;

/* An integer type of the appropriate size for a generic signature. */
typedef uintptr_t ptrauth_generic_signature_t;
typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;

/* A signed pointer value embeds the original pointer together with
a signature that attests to the validity of that pointer. Because
Expand Down Expand Up @@ -149,7 +147,7 @@ typedef uintptr_t ptrauth_generic_signature_t;

The first argument must be an expression of pointer type.
The second argument must be an expression of integer type.
The result will have type uintptr_t. */
The result will have type __UINTPTR_TYPE__. */
#define ptrauth_blend_discriminator(__pointer, __integer) \
__builtin_ptrauth_blend_discriminator(__pointer, __integer)

Expand Down Expand Up @@ -280,7 +278,7 @@ typedef uintptr_t ptrauth_generic_signature_t;
if the arguments were a pointer and a discriminator.

The arguments must be either pointers or integers; if integers, they
will be coerce to uintptr_t. */
will be coerce to __UINTPTR_TYPE__. */
#define ptrauth_sign_generic_data(__value, __data) \
__builtin_ptrauth_sign_generic_data(__value, __data)

Expand Down Expand Up @@ -324,14 +322,14 @@ typedef uintptr_t ptrauth_generic_signature_t;
#else

#define ptrauth_strip(__value, __key) __value
#define ptrauth_blend_discriminator(__pointer, __integer) ((uintptr_t)0)
#define ptrauth_blend_discriminator(__pointer, __integer) ((__UINTPTR_TYPE__)0)
#define ptrauth_sign_constant(__value, __key, __data) __value
#define ptrauth_sign_unauthenticated(__value, __key, __data) __value
#define ptrauth_auth_and_resign(__value, __old_key, __old_data, __new_key, __new_data) __value
#define ptrauth_auth_function(__value, __old_key, __old_data) __value
#define ptrauth_auth_data(__value, __old_key, __old_data) __value
#define ptrauth_string_discriminator(__string) ((uintptr_t)0)
#define ptrauth_type_discriminator(__type) ((uintptr_t)0)
#define ptrauth_string_discriminator(__string) ((__UINTPTR_TYPE__)0)
#define ptrauth_type_discriminator(__type) ((__UINTPTR_TYPE__)0)
#define ptrauth_sign_generic_data(__value, __data) ((ptrauth_generic_signature_t)0)

#define __ptrauth_function_pointer
Expand Down