Commit 7c06862c authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

fusion: Handle DWORD-sized blob indices when loading the public key.

parent 0b82e284
...@@ -825,23 +825,22 @@ PEKIND assembly_get_architecture(ASSEMBLY *assembly) ...@@ -825,23 +825,22 @@ PEKIND assembly_get_architecture(ASSEMBLY *assembly)
return peI386; /* x86 assembly */ return peI386; /* x86 assembly */
} }
static BYTE *assembly_get_blob(ASSEMBLY *assembly, WORD index, ULONG *size) static BYTE *assembly_get_blob(ASSEMBLY *assembly, DWORD index, ULONG *size)
{ {
return GetData(&assembly->blobs[index], size); return GetData(&assembly->blobs[index], size);
} }
HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token) HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token)
{ {
ASSEMBLYTABLE *asmtbl;
ULONG i, size; ULONG i, size;
LONG offset; LONG offset;
BYTE *hashdata; BYTE *hashdata, *pubkey, *ptr;
HCRYPTPROV crypt; HCRYPTPROV crypt;
HCRYPTHASH hash; HCRYPTHASH hash;
BYTE *pubkey;
BYTE tokbytes[BYTES_PER_TOKEN]; BYTE tokbytes[BYTES_PER_TOKEN];
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
LPWSTR tok; LPWSTR tok;
DWORD idx;
*token = NULL; *token = NULL;
...@@ -849,11 +848,17 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token) ...@@ -849,11 +848,17 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token)
if (offset == -1) if (offset == -1)
return E_FAIL; return E_FAIL;
asmtbl = assembly_data_offset(assembly, offset); ptr = assembly_data_offset(assembly, offset);
if (!asmtbl) if (!ptr)
return E_FAIL; return E_FAIL;
pubkey = assembly_get_blob(assembly, asmtbl->PublicKey, &size); ptr += FIELD_OFFSET(ASSEMBLYTABLE, PublicKey);
if (assembly->blobsz == sizeof(DWORD))
idx = *(DWORD *)ptr;
else
idx = *(WORD *)ptr;
pubkey = assembly_get_blob(assembly, idx, &size);
if (!CryptAcquireContextA(&crypt, NULL, NULL, PROV_RSA_FULL, if (!CryptAcquireContextA(&crypt, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT)) CRYPT_VERIFYCONTEXT))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment