@@ -1971,7 +1971,7 @@ static void emitCanonicalSpecializationsForGenericTypeMetadataAccessFunction(
1971
1971
} else {
1972
1972
RootProtocolConformance *rootConformance =
1973
1973
concreteConformance->getRootConformance ();
1974
- auto *expectedDescriptor =
1974
+ llvm::Value *expectedDescriptor =
1975
1975
IGF.IGM .getAddrOfProtocolConformanceDescriptor (rootConformance);
1976
1976
auto *witnessTable = valueAtIndex (requirementIndex);
1977
1977
auto *witnessBuffer =
@@ -1982,6 +1982,32 @@ static void emitCanonicalSpecializationsForGenericTypeMetadataAccessFunction(
1982
1982
uncastProvidedDescriptor,
1983
1983
IGM.ProtocolConformanceDescriptorPtrTy );
1984
1984
1985
+ // Auth the stored descriptor.
1986
+ auto storedScheme =
1987
+ IGF.IGM .getOptions ().PointerAuth .ProtocolConformanceDescriptors ;
1988
+ if (storedScheme) {
1989
+ auto authInfo = PointerAuthInfo::emit (
1990
+ IGF, storedScheme, witnessTable,
1991
+ PointerAuthEntity::Special::ProtocolConformanceDescriptor);
1992
+ providedDescriptor =
1993
+ emitPointerAuthAuth (IGF, providedDescriptor, authInfo);
1994
+ }
1995
+
1996
+ // Sign the descriptors.
1997
+ auto argScheme =
1998
+ IGF.IGM .getOptions ()
1999
+ .PointerAuth .ProtocolConformanceDescriptorsAsArguments ;
2000
+ if (argScheme) {
2001
+ auto authInfo = PointerAuthInfo::emit (
2002
+ IGF, argScheme, nullptr ,
2003
+ PointerAuthEntity::Special::
2004
+ ProtocolConformanceDescriptorAsArgument);
2005
+ expectedDescriptor =
2006
+ emitPointerAuthSign (IGF, expectedDescriptor, authInfo);
2007
+ providedDescriptor =
2008
+ emitPointerAuthSign (IGF, providedDescriptor, authInfo);
2009
+ }
2010
+
1985
2011
auto *call = IGF.Builder .CreateCall (
1986
2012
IGF.IGM .getCompareProtocolConformanceDescriptorsFn (),
1987
2013
{providedDescriptor, expectedDescriptor});
0 commit comments