Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetCachedAlgorithmHandle()

static SafeAlgorithmHandle Internal.Cryptography.BCryptAeadHandleCache.GetCachedAlgorithmHandle ( ref SafeAlgorithmHandle handle,
string algId,
string chainingMode = null )
inlinestaticprivate

Definition at line 24 of file BCryptAeadHandleCache.cs.

25 {
26 SafeAlgorithmHandle safeAlgorithmHandle = Volatile.Read(ref handle);
27 if (safeAlgorithmHandle != null)
28 {
29 return safeAlgorithmHandle;
30 }
32 if (chainingMode != null)
33 {
34 safeAlgorithmHandle2.SetCipherMode(chainingMode);
35 }
36 safeAlgorithmHandle = Interlocked.CompareExchange(ref handle, safeAlgorithmHandle2, null);
37 if (safeAlgorithmHandle != null)
38 {
39 safeAlgorithmHandle2.Dispose();
40 return safeAlgorithmHandle;
41 }
42 return safeAlgorithmHandle2;
43 }
static SafeAlgorithmHandle BCryptOpenAlgorithmProvider(string pszAlgId, string pszImplementation, OpenAlgorithmProviderFlags dwFlags)
Definition Cng.cs:34
static int CompareExchange(ref int location1, int value, int comparand)
static bool Read(ref bool location)
Definition Volatile.cs:67

References Internal.NativeCrypto.Cng.BCryptOpenAlgorithmProvider(), System.Threading.Interlocked.CompareExchange(), System.Runtime.InteropServices.SafeHandle.Dispose(), System.handle, and System.Threading.Volatile.Read().