-
Notifications
You must be signed in to change notification settings - Fork 0
PointerAuthentication
A namespace for the pointer authentication builtins.
public struct PointerAuthentication
This should be considered an extension of the ptrauth module.
Strip the signature from a value without authenticating it.
@inline(__always)
public static func strip(
_ pointer: UnsafeRawPointer,
_ key: ptrauth_key
) -> UnsafeRawPointer
If the value is a function pointer, the result will not be a legal function pointer because of the missing signature, and attempting to call it will result in an authentication failure.
- pointer: The value to strip the signature from.
- key: The
ptrauth_key
used to stip the signature.
The stripped pointer.
Blend a pointer and a small integer to form a new extra-data discriminator. Not all bits of the inputs are guaranteed to contribute to the result.
@inline(__always)
public static func blendDiscriminator(
_ pointer: UnsafeRawPointer,
_ integer: UInt64
) -> UInt
On ARM64, only the low 16 bits of the integer will be considered.
- pointer: The pointer to perform the operation on.
- integer: The integer to blend into the pointer.
The new extra-data-discriminator.
Add a signature to the given pointer value using a specific key, using the given extra data as a salt to the signing process.
@inline(__always)
public static func signConstant(
_ value: UnsafeRawPointer,
_ key: ptrauth_key,
_ data: UInt64
) -> UnsafeRawPointer
- value: The value pointer to sign.
- key: The key to sign the pointer with.
- data: Extra data to be used as a salt.
The constant passed in through value
.
Add a signature to the given pointer value using a specific key, using the given extra data as a salt to the signing process.
@inline(__always)
public static func signUnauthenticated(
_ value: UnsafeRawPointer,
_ key: ptrauth_key,
_ data: UInt64
) -> UnsafeRawPointer
This operation does not authenticate the original value and is therefore potentially insecure if an attacker could possibly control that value.
- value: The value pointer to sign.
- key: The key to sign the pointer with.
- data: Extra data to be used as a salt.
The constant passed in through value
.
Authenticate a pointer using one scheme and resign it using another.
@inline(__always)
public static func authAndResign(
_ value: UnsafeRawPointer,
_ oldKey: ptrauth_key,
_ oldData: UInt64,
_ newKey: ptrauth_key,
_ newData: UInt64
) -> UnsafeRawPointer
If the result is subsequently authenticated using the new scheme, that authentication is gauranteed to fail if and only if the initial authentication failed.
This operation is guarunteed to not leave the intermediate value available for attack before it is re-signed.
- value: The value pointer to sign.
- oldKey: The old
ptrauth_key
the value was signed with. - oldData: The old salt used in signing the value pointer.
- newKey: The new key to resign the value with.
- newData: New salt to be used in signing the value pointer.
The newly signed value.
Authenticate a pointer using one scheme and resign it as a C function pointer.
@inline(__always)
public static func authFunction(
_ value: UnsafeRawPointer,
_ oldKey: ptrauth_key,
_ oldData: UInt64
) -> UnsafeRawPointer
If the result is subsequently authenticated using the new scheme, that authentication is gauranteed to fail if and only if the initial authentication failed.
This operation is guarunteed to not leave the intermediate value available for attack before it is re-signed.
- value: The value to resign as a C function pointer.
- oldKey: The old
ptrauth_key
the value was signed with. - oldData: The old salt used in signing the value pointer.
The authenticated resigned value pointer signed as a C function pointer.
Authenticate a data pointer
@inline(__always)
public static func authData(
_ value: UnsafeRawPointer,
_ oldkey: ptrauth_key,
_ oldData: UInt64
) -> UnsafeRawPointer
If the authentication fails, dereferencing the resulting pointer will likewise fail.
- value: The data pointer to authenticate.
- oldKey: The
ptrauth_key
used to sign the pointer. - oldData: The old salt used in signing the pointer.
Return an extra-discriminator value which can validly be used
as the second argument to blendDiscriminator
.
@inline(__always)
public static func stringDiscriminator(
_ string: String
) -> UInt64
- string: The string to generate the discriminator from.
The custom discriminator generated from the string.
Compute a full pointer-width generic signature for the given value, using the given data as a salt.
@inline(__always)
public static func signGenericData(
_ value: UnsafeRawPointer,
_ data: UInt64
) -> ptrauth_generic_signature_t
This generic signature is process independant, but may not be consistent accross reboots.
This can be used to validate the integrity of arbitrary data by storing the a signature for that data together with it. Because the signature is pointer-sized, if the signature matches the result of re-signing the current data, a match provides very strong evidence that the data has not been corrupted.
- value: The generic data pointer to generate the signature for.
- data: Extra data to use as a salt in the signing of the generic data.
A ptrauth_generic_signature_t
Generated at 2022-06-15T08:34:33-0700 using swift-doc 1.0.0-rc.1.
Types
- ClassDescriptor
- ClassDescriptor.InternalRepresentation
- ClassMetadata
- ClassMetadata.Flags
- ClassMetadata.MetadataStructure
- ContextDescriptor
- ContextDescriptor.Flags
- ContextDescriptor.InternalRepresentation
- ContextDescriptor.Kind
- EnumDescriptor
- EnumDescriptor.InternalRepresentation
- EnumMetadata
- EnumMetadata.MetadataStructure
- ExistentialMetadata
- ExistentialMetadata.Flags
- ExistentialMetadata.InternalRepresentation
- ExistentialMetadata.SpecialProtocol
- ExtensionDescriptor
- ExtensionDescriptor.InternalRepresentation
- FunctionMetadata
- FunctionMetadata.MetadataStructure
- GenericContextDescriptor
- GenericContextDescriptor.GenericParameterDescriptor
- GenericContextDescriptor.GenericPrarameterKind
- GenericContextDescriptor.InternalRepresentation
- GenericRequirementDescriptor
- GenericRequirementDescriptor.Flags
- GenericRequirementDescriptor.GenericRequirementKind
- GenericRequirementDescriptor.GenericRequirementLayoutKind
- GenericRequirementDescriptor.InternalRepresentation
- ModuleDescriptor
- ModuleDescriptor.InternalRepresentation
- PointerAuthentication
- ProtocolDescriptor
- ProtocolDescriptor.Flags
- ProtocolDescriptor.InternalRepresentation
- ProtocolMetadata
- ProtocolMetadata.MetadataStructure
- ProtocolRequirement
- ProtocolRequirement.Flags
- ProtocolRequirement.InternalRepresentation
- ProtocolRequirement.Kind
- RuntimeModifiableBuilder
- SignedPointer
- StructDescriptor
- StructDescriptor.InternalRepresentation
- StructMetadata
- StructMetadata.MetadataStructure
- TupleElementMetadata
- TupleElementMetadata.InternalRepresentation
- TupleMetadata
- TupleMetadata.MetadataStructure
- TupleMetadata.TupleElement
- TypeDescriptor
- TypeDescriptor.Flags
- TypeDescriptor.InternalRepresentation
- TypeDescriptor.TypeReferenceKind
- TypeMetadataKind
- ValueWitnessTable
- ValueWitnessTable.Flags
- ValueWitnessTable.InternalRepresentation
Protocols
Global Typealiases
Global Functions
- _Block_copy(_:)
- _Block_release(_:)
- swift_allocBox(_:)
- swift_allocObject(_:_:_:)
- swift_allocateGenericClassMetadata(_:_:_:)
- swift_allocateGenericValueMetadata(_:_:_:_:)
- swift_arrayAssignWithCopyBackToFront(_:_:_:_:)
- swift_arrayAssignWithCopyFrontToBack(_:_:_:_:)
- swift_arrayAssignWithCopyNoAlias(_:_:_:_:)
- swift_arrayDestroy(_:_:_:)
- swift_arrayInitWithCopy(_:_:_:_:)
- swift_autoDiffAllocateSubContext(_:_:)
- swift_autoDiffCreateLinearMapContext(_:)
- swift_autoDiffProjectTopLevelSubcontext(_:)
- swift_beginAccess(_:_:_:)
- swift_bridgeObjectRelease(_:)
- swift_bridgeObjectRelease_n(_:_:)
- swift_bridgeObjectRetain(_:)
- swift_bridgeObjectRetain_n(_:_:)
- swift_bridgeRelease(_:)
- swift_checkMetadataState(_:_:)
- swift_compareTypeContextDescriptors(_:_:)
- swift_conformsToProtocol(_:_:)
- swift_continuation_await(_:)
- swift_continuation_init(_:_:)
- swift_continuation_resume(_:)
- swift_continuation_throwingResume(_:)
- swift_continuation_throwingResumeWithError(_:_:)
- swift_copyPOD(_:_:_:)
- swift_deallocClassInstance(_:_:_:)
- swift_deallocObject(_:_:_:)
- swift_deallocPartialClassInstance(_:)
- swift_deallocUninitializedObject(_:_:_:)
- swift_defaultActor_deallocate(_:)
- swift_defaultActor_deallocateResilient(_:)
- swift_defaultActor_destroy(_:)
- swift_defaultActor_initialize(_:)
- swift_deletedMethodError()
- swift_distributedActor_remote_initialize(_:)
- swift_dynamicCast(_:_:_:_:_:)
- swift_dynamicCastClass(_:_:)
- swift_dynamicCastClassUnconditional(_:_:_:_:_:)
- swift_dynamicCastMetatype(_:_:)
- swift_dynamicCastMetatypeToObjectConditional(_:)
- swift_dynamicCastMetatypeToObjectUnconditional(_:)
- swift_dynamicCastMetatypeUnconditional(_:_:_:_:_:)
- swift_dynamicCastObjCClass(_:_:)
- swift_dynamicCastObjCClassMetatype(_:_:)
- swift_dynamicCastObjCClassMetatypeUnconditional(_:_:_:_:_:)
- swift_dynamicCastObjCClassUnconditional(_:_:_:_:_:)
- swift_dynamicCastObjCProtocolConditional(_:_:_:)
- swift_dynamicCastObjCProtocolUnconditional(_:_:_:_:_:_:)
- swift_dynamicCastTypeToObjCProtocolConditional(_:_:_:)
- swift_dynamicCastTypeToObjCProtocolUnconditional(_:_:_:_:_:_:)
- swift_dynamicCastUnknownClass(_:_:)
- swift_dynamicCastUnknownClassUnconditional(_:_:_:_:_:)
- swift_endAccess(_:)
- swift_errorInMain(_:)
- swift_errorRelease(_:)
- swift_errorRetain(_:)
- swift_getAssociatedConformanceWitness(_:_:_:_:_:)
- swift_getAssociatedTypeWitness(_:_:_:_:_:)
- swift_getCanonicalPrespecializedGenericMetadata(_:_:_:_:)
- swift_getCanonicalSpecializedMetadata(_:_:_:)
- swift_getDynamicType(_:_:_:)
- swift_getEnumCaseMultiPayload(_:_:)
- swift_getEnumTagSinglePayloadGeneric(_:_:_:_:)
- swift_getExistentialMetatypeMetadata(_:)
- swift_getExistentialTypeMetadata(_:_:_:_:)
- swift_getForeignTypeMetadata(_:)
- swift_getFunctionTypeMetadata(_:_:_:_:)
- swift_initWithTakeBackToFront(_:_:_:_:)
- swift_initWithTakeFrontToBack(_:_:_:_:)
- swift_initWithTakeNoAlias(_:_:_:_:)