about summary refs log tree commit diff stats
path: root/miasm/os_dep/win_api_x86_32.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2020-05-15 11:37:56 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2020-05-15 11:47:52 +0200
commit515dea1f0c76e9f2884ab9b546e6be527b7ff95f (patch)
treeec0909651386746cb56061fd942794ae6acec6fd /miasm/os_dep/win_api_x86_32.py
parent3b288556c9bedbacccb809641b9caacad5327736 (diff)
downloadfocaccia-miasm-515dea1f0c76e9f2884ab9b546e6be527b7ff95f.tar.gz
focaccia-miasm-515dea1f0c76e9f2884ab9b546e6be527b7ff95f.zip
Win api: Support param xx
Diffstat (limited to 'miasm/os_dep/win_api_x86_32.py')
-rw-r--r--miasm/os_dep/win_api_x86_32.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/miasm/os_dep/win_api_x86_32.py b/miasm/os_dep/win_api_x86_32.py
index 2ecb1179..67178f05 100644
--- a/miasm/os_dep/win_api_x86_32.py
+++ b/miasm/os_dep/win_api_x86_32.py
@@ -505,7 +505,7 @@ def advapi32_CryptHashData(jitter):
 
     data = jitter.vm.get_mem(args.pbdata, args.dwdatalen)
     log.debug('will hash %X', args.dwdatalen)
-    log.debug(repr(data[:10]) + "...")
+    log.debug(repr(data[:0x10]) + "...")
     winobjs.cryptcontext[args.hhash].h.update(data)
     jitter.func_ret_stdcall(ret_ad, 1)
 
@@ -518,12 +518,18 @@ def advapi32_CryptGetHashParam(jitter):
         raise ValueError("unknown crypt context")
 
     if args.param == 2:
+        # HP_HASHVAL
         # XXX todo: save h state?
         h = winobjs.cryptcontext[args.hhash].h.digest()
+        jitter.vm.set_mem(args.pbdata, h)
+        jitter.vm.set_u32(args.dwdatalen, len(h))
+    elif args.param == 4:
+        # HP_HASHSIZE
+        ret = winobjs.cryptcontext[args.hhash].h.digest_size
+        jitter.vm.set_u32(args.pbdata, ret)
+        jitter.vm.set_u32(args.dwdatalen, 4)
     else:
         raise ValueError('not impl', args.param)
-    jitter.vm.set_mem(args.pbdata, h)
-    jitter.vm.set_u32(args.dwdatalen, len(h))
 
     jitter.func_ret_stdcall(ret_ad, 1)