Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not acquire a cryptographic context: Unknown error (0x7F) #73

Closed
lab313ru opened this issue Dec 30, 2017 · 7 comments
Closed

Could not acquire a cryptographic context: Unknown error (0x7F) #73

lab313ru opened this issue Dec 30, 2017 · 7 comments

Comments

@lab313ru
Copy link

lab313ru commented Dec 30, 2017

File: https://www.emu-land.net/consoles/psx/emuls/linux?act=dlmfile&id=1047&fid=2
This is Playstation 1 emulator for Linux.
OS: Windows 10 x64.

@s3rvac
Copy link
Member

s3rvac commented Dec 30, 2017

Hi. Could you please provide more context so we can investigate this?

  • Did you use our binary release for Windows, or have you built RetDec by yourself?
  • Do you use MSYS2 as suggested in our installation guide or something else (e.g. Cygwin, WSL)?
  • Does decompilation of other files work correctly, or do you always get this error, no matter what the input file is?
  • What parameters did you use when running decompile.sh?
  • Most importantly, can you provide a full log from the decompilation and a ZIP archive with all files that the decompilation produced (if any)?

@lab313ru
Copy link
Author

  1. I'm using b32 release for Windows;
  2. MSYS2 32;
  3. This error happens only for that file;
  4. No additional params: just "decompile.sh pSX"
  5. I've deleted every file, but now I'm started x64 version of the decompiler, and it stucked up, I guess, at this state: -> running CopyPropagationOptimizer ( 151.32s ).
    So, you should try it to repeat my results.

@s3rvac
Copy link
Member

s3rvac commented Dec 30, 2017

Thank you. Could you please also provide the complete output (log) from the decompilation which failed with Could not acquire a cryptographic context: Unknown error? Or do you at least know in which decompilation tool/phase it failed?

it stucked up, I guess, at this state: -> running CopyPropagationOptimizer ( 151.32s ).

This phase often takes long time to finish, so you will either have to wait until it finishes or try to decompile only a part of the input binary file (as described e.g. here).

@s3rvac
Copy link
Member

s3rvac commented Dec 30, 2017

I was able to reproduce this issue (32b RetDec release, 64b MSYS2):

Warning: out of memory; trying to recover
Running phase: variable renaming [readable] ( 406.23s )
LLVM ERROR: Could not acquire a cryptographic context: The specified procedure could not be found.  (0x7F)

I strongly believe that this error is caused by insufficient memory.

@lab313ru
Copy link
Author

I strongly believe that this error is caused by insufficient memory.

I guess so... Because 64b version never printed this text out.

@s3rvac
Copy link
Member

s3rvac commented Dec 31, 2017

Yes, the 64b version decompiles the file without any memory errors. 32b applications cannot allocate more than 2 or 4 GB of memory, depending on whether they were linked with /LARGEADDRESSAWARE. I suggest using the 64b version of the decompiler as there is not much we can do with the 32b version.

s3rvac added a commit that referenced this issue Dec 31, 2017
… addresses (#73).

By default, they are only allowed to address 2 GB of virtual memory. By using
/LARGEADDRESSAWARE, they may address up to 4 GB of virtual memory.

For more details, see
https://docs.microsoft.com/en-us/cpp/build/reference/largeaddressaware-handle-large-addresses
@s3rvac
Copy link
Member

s3rvac commented Dec 31, 2017

In commit 6003462, I have added the /LARGEADDRESSAWARE link flag to 32b builds of bin2llvmir and llvmir2hll so they can access up to 4 GB of virtual memory. I am closing this issue as there is probably nothing more we can do. When on 64b Windows, I recommend using the 64b build.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants