Skip to content

Commit 7ad5c58

Browse files
Merged PR 4038: [5.1.2] Fix | AE enclave retry logic not working for async queries (#1988)
Ports [#1988](#1988)
1 parent f85aa55 commit 7ad5c58

File tree

14 files changed

+294
-111
lines changed

14 files changed

+294
-111
lines changed

doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionEnclaveProvider.xml

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,29 @@ the enclave attestation protocol as well as the logic for creating and caching e
2020
<param name="enclaveAttestationInfo">The information the provider uses to attest the enclave and generate a symmetric key for the session. The format of this information is specific to the enclave attestation protocol.</param>
2121
<param name="clientDiffieHellmanKey">A Diffie-Hellman algorithm object that encapsulates a client-side key pair.</param>
2222
<param name="enclaveSessionParameters">The set of parameters required for an enclave session.</param>
23-
<param name="customData">The set of extra data needed for attestating the enclave.</param>
24-
<param name="customDataLength">The length of the extra data needed for attestating the enclave.</param>
23+
<param name="customData">The set of extra data needed for attesting the enclave.</param>
24+
<param name="customDataLength">The length of the extra data needed for attesting the enclave.</param>
2525
<param name="sqlEnclaveSession">The requested enclave session or <see langword="null" /> if the provider doesn't implement session caching.</param>
2626
<param name="counter">A counter that the enclave provider is expected to increment each time SqlClient retrieves the session from the cache. The purpose of this field is to prevent replay attacks.</param>
2727
<summary>When overridden in a derived class, performs enclave attestation, generates a symmetric key for the session, creates a an enclave session and stores the session information in the cache.</summary>
2828
<remarks>To be added.</remarks>
2929
</CreateEnclaveSession>
3030
<GetAttestationParameters>
3131
<param name="attestationUrl">The endpoint of an attestation service for attesting the enclave.</param>
32-
<param name="customData">A set of extra data needed for attestating the enclave.</param>
33-
<param name="customDataLength">The length of the extra data needed for attestating the enclave.</param>
32+
<param name="customData">A set of extra data needed for attesting the enclave.</param>
33+
<param name="customDataLength">The length of the extra data needed for attesting the enclave.</param>
3434
<summary>Gets the information that SqlClient subsequently uses to initiate the process of attesting the enclave and to establish a secure session with the enclave.</summary>
3535
<returns>The information SqlClient subsequently uses to initiate the process of attesting the enclave and to establish a secure session with the enclave.</returns>
3636
<remarks>To be added.</remarks>
3737
</GetAttestationParameters>
3838
<GetEnclaveSession>
3939
<param name="enclaveSessionParameters">The set of parameters required for enclave session.</param>
4040
<param name="generateCustomData"><see langword="true" /> to indicate that a set of extra data needs to be generated for attestation; otherwise, <see langword="false" />.</param>
41+
<param name="isRetry">Indicates if this is a retry from a failed call.</param>
4142
<param name="sqlEnclaveSession">When this method returns, the requested enclave session or <see langword="null" /> if the provider doesn't implement session caching. This parameter is treated as uninitialized.</param>
4243
<param name="counter">A counter that the enclave provider is expected to increment each time SqlClient retrieves the session from the cache. The purpose of this field is to prevent replay attacks.</param>
43-
<param name="customData">A set of extra data needed for attestating the enclave.</param>
44-
<param name="customDataLength">The length of the extra data needed for attestating the enclave.</param>
44+
<param name="customData">A set of extra data needed for attesting the enclave.</param>
45+
<param name="customDataLength">The length of the extra data needed for attesting the enclave.</param>
4546
<summary>When overridden in a derived class, looks up an existing enclave session information in the enclave session cache. If the enclave provider doesn't implement enclave session caching, this method is expected to return <see langword="null" /> in the <paramref name="sqlEnclaveSession" /> parameter.
4647
</summary>
4748
<remarks>To be added.</remarks>

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.NetCoreApp.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ internal abstract partial class SqlColumnEncryptionEnclaveProvider
1515
/// <param name="enclaveAttestationInfo">The information the provider uses to attest the enclave and generate a symmetric key for the session. The format of this information is specific to the enclave attestation protocol.</param>
1616
/// <param name="clientDiffieHellmanKey">A Diffie-Hellman algorithm object encapsulating a client-side key pair.</param>
1717
/// <param name="enclaveSessionParameters">The set of parameters required for enclave session.</param>
18-
/// <param name="customData">The set of extra data needed for attestating the enclave.</param>
19-
/// <param name="customDataLength">The length of the extra data needed for attestating the enclave.</param>
18+
/// <param name="customData">The set of extra data needed for attesting the enclave.</param>
19+
/// <param name="customDataLength">The length of the extra data needed for attesting the enclave.</param>
2020
/// <param name="sqlEnclaveSession">The requested enclave session or null if the provider does not implement session caching.</param>
2121
/// <param name="counter">A counter that the enclave provider is expected to increment each time SqlClient retrieves the session from the cache. The purpose of this field is to prevent replay attacks.</param>
2222
internal abstract void CreateEnclaveSession(byte[] enclaveAttestationInfo, ECDiffieHellman clientDiffieHellmanKey, EnclaveSessionParameters enclaveSessionParameters, byte[] customData, int customDataLength,

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.Data.SqlClient
88
internal abstract partial class SqlColumnEncryptionEnclaveProvider
99
{
1010
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionEnclaveProvider.xml' path='docs/members[@name="SqlColumnEncryptionEnclaveProvider"]/GetEnclaveSession/*'/>
11-
internal abstract void GetEnclaveSession(EnclaveSessionParameters enclaveSessionParameters, bool generateCustomData, out SqlEnclaveSession sqlEnclaveSession, out long counter, out byte[] customData, out int customDataLength);
11+
internal abstract void GetEnclaveSession(EnclaveSessionParameters enclaveSessionParameters, bool generateCustomData, bool isRetry, out SqlEnclaveSession sqlEnclaveSession, out long counter, out byte[] customData, out int customDataLength);
1212

1313
/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionEnclaveProvider.xml' path='docs/members[@name="SqlColumnEncryptionEnclaveProvider"]/GetAttestationParameters/*'/>
1414
internal abstract SqlEnclaveAttestationParameters GetAttestationParameters(string attestationUrl, byte[] customData, int customDataLength);

0 commit comments

Comments
 (0)