Hans Leidekker : secur32: Implement lsa_QueryContextAttributesA(SECPKG_ATTR_KEY_INFO).

Alexandre Julliard julliard at winehq.org
Tue Jul 12 16:51:39 CDT 2022


Module: wine
Branch: master
Commit: 0167c0bc88b2317054678f54edb18e7107dbc0a6
URL:    https://gitlab.winehq.org/wine/wine/-/commit/0167c0bc88b2317054678f54edb18e7107dbc0a6

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Fri Jul  8 12:08:20 2022 +0200

secur32: Implement lsa_QueryContextAttributesA(SECPKG_ATTR_KEY_INFO).

---

 dlls/secur32/lsa.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/dlls/secur32/lsa.c b/dlls/secur32/lsa.c
index adb8545c4c8..f69a2a74511 100644
--- a/dlls/secur32/lsa.c
+++ b/dlls/secur32/lsa.c
@@ -620,6 +620,31 @@ static SECURITY_STATUS nego_info_WtoA( const SecPkgContext_NegotiationInfoW *inf
     return SEC_E_OK;
 }
 
+static SECURITY_STATUS key_info_WtoA( const SecPkgContext_KeyInfoW *infoW, SecPkgContext_KeyInfoA *infoA )
+{
+    int size;
+
+    size = WideCharToMultiByte( CP_ACP, 0, infoW->sSignatureAlgorithmName, -1, NULL, 0, NULL, NULL );
+    if (!(infoA->sSignatureAlgorithmName = RtlAllocateHeap( GetProcessHeap(), 0, size )))
+        return SEC_E_INSUFFICIENT_MEMORY;
+    WideCharToMultiByte( CP_ACP, 0, infoW->sSignatureAlgorithmName, -1, infoA->sSignatureAlgorithmName,
+                         size, NULL, NULL );
+
+    size = WideCharToMultiByte( CP_ACP, 0, infoW->sEncryptAlgorithmName, -1, NULL, 0, NULL, NULL );
+    if (!(infoA->sEncryptAlgorithmName = RtlAllocateHeap( GetProcessHeap(), 0, size )))
+    {
+        RtlFreeHeap( GetProcessHeap(), 0, infoA->sSignatureAlgorithmName );
+        return SEC_E_INSUFFICIENT_MEMORY;
+    }
+    WideCharToMultiByte( CP_ACP, 0, infoW->sEncryptAlgorithmName, -1, infoA->sEncryptAlgorithmName,
+                         size, NULL, NULL );
+
+    infoA->KeySize = infoW->KeySize;
+    infoA->SignatureAlgorithm = infoW->SignatureAlgorithm;
+    infoA->EncryptAlgorithm = infoW->EncryptAlgorithm;
+    return SEC_E_OK;
+}
+
 static SECURITY_STATUS WINAPI lsa_QueryContextAttributesA(CtxtHandle *context, ULONG attribute, void *buffer)
 {
     TRACE("%p %ld %p\n", context, attribute, buffer);
@@ -642,12 +667,24 @@ static SECURITY_STATUS WINAPI lsa_QueryContextAttributesA(CtxtHandle *context, U
         FreeContextBuffer( infoW.PackageInfo );
         return status;
     }
+    case SECPKG_ATTR_KEY_INFO:
+    {
+        SecPkgContext_KeyInfoW infoW;
+        SecPkgContext_KeyInfoA *infoA = (SecPkgContext_KeyInfoA *)buffer;
+
+        SECURITY_STATUS status = lsa_QueryContextAttributesW( context, SECPKG_ATTR_KEY_INFO, &infoW );
+
+        if (status != SEC_E_OK) return status;
+        status = key_info_WtoA( &infoW, infoA );
+        FreeContextBuffer( infoW.sSignatureAlgorithmName );
+        FreeContextBuffer( infoW.sEncryptAlgorithmName );
+        return status;
+    }
 
 #define X(x) case (x) : FIXME(#x" stub\n"); break
     X(SECPKG_ATTR_ACCESS_TOKEN);
     X(SECPKG_ATTR_AUTHORITY);
     X(SECPKG_ATTR_DCE_INFO);
-    X(SECPKG_ATTR_KEY_INFO);
     X(SECPKG_ATTR_LIFESPAN);
     X(SECPKG_ATTR_NAMES);
     X(SECPKG_ATTR_NATIVE_NAMES);




More information about the wine-cvs mailing list