@@ -717,21 +717,21 @@ private bool AcquireServerCredentials(ref byte[] thumbPrint, ReadOnlySpan<byte>
717
717
}
718
718
719
719
//
720
- internal ProtocolToken NextMessage ( byte [ ] incoming , int offset , int count )
720
+ internal ProtocolToken NextMessage ( ReadOnlySpan < byte > incomingBuffer )
721
721
{
722
722
if ( NetEventSource . IsEnabled )
723
723
NetEventSource . Enter ( this ) ;
724
724
725
725
byte [ ] nextmsg = null ;
726
- SecurityStatusPal status = GenerateToken ( incoming , offset , count , ref nextmsg ) ;
726
+ SecurityStatusPal status = GenerateToken ( incomingBuffer , ref nextmsg ) ;
727
727
728
728
if ( ! _sslAuthenticationOptions . IsServer && status . ErrorCode == SecurityStatusPalErrorCode . CredentialsNeeded )
729
729
{
730
730
if ( NetEventSource . IsEnabled )
731
731
NetEventSource . Info ( this , "NextMessage() returned SecurityStatusPal.CredentialsNeeded" ) ;
732
732
733
733
SetRefreshCredentialNeeded ( ) ;
734
- status = GenerateToken ( incoming , offset , count , ref nextmsg ) ;
734
+ status = GenerateToken ( incomingBuffer , ref nextmsg ) ;
735
735
}
736
736
737
737
ProtocolToken token = new ProtocolToken ( nextmsg , status ) ;
@@ -763,27 +763,14 @@ server in response
763
763
Return:
764
764
status - error information
765
765
--*/
766
- private SecurityStatusPal GenerateToken ( byte [ ] input , int offset , int count , ref byte [ ] output )
766
+ private SecurityStatusPal GenerateToken ( ReadOnlySpan < byte > inputBuffer , ref byte [ ] output )
767
767
{
768
768
if ( NetEventSource . IsEnabled ) NetEventSource . Enter ( this , $ "_refreshCredentialNeeded = { _refreshCredentialNeeded } ") ;
769
769
770
- if ( offset < 0 || offset > ( input == null ? 0 : input . Length ) )
771
- {
772
- NetEventSource . Fail ( this , "Argument 'offset' out of range." ) ;
773
- throw new ArgumentOutOfRangeException ( nameof ( offset ) ) ;
774
- }
775
-
776
- if ( count < 0 || count > ( input == null ? 0 : input . Length - offset ) )
777
- {
778
- NetEventSource . Fail ( this , "Argument 'count' out of range." ) ;
779
- throw new ArgumentOutOfRangeException ( nameof ( count ) ) ;
780
- }
781
-
782
770
byte [ ] result = Array . Empty < byte > ( ) ;
783
771
SecurityStatusPal status = default ;
784
772
bool cachedCreds = false ;
785
773
byte [ ] thumbPrint = null ;
786
- ReadOnlySpan < byte > inputBuffer = new ReadOnlySpan < byte > ( input , offset , count ) ;
787
774
788
775
//
789
776
// Looping through ASC or ISC with potentially cached credential that could have been
@@ -1155,7 +1142,7 @@ private ProtocolToken GenerateAlertToken()
1155
1142
byte [ ] nextmsg = null ;
1156
1143
1157
1144
SecurityStatusPal status ;
1158
- status = GenerateToken ( null , 0 , 0 , ref nextmsg ) ;
1145
+ status = GenerateToken ( default , ref nextmsg ) ;
1159
1146
1160
1147
ProtocolToken token = new ProtocolToken ( nextmsg , status ) ;
1161
1148
0 commit comments