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

Initialization of distribution layer fails on Windows due to use of dev/random #144

Open
sjmackenzie opened this issue Apr 29, 2011 · 0 comments

Comments

@sjmackenzie
Copy link
Member

As I previously reported on the mozart-hackers list, the distribution layer of 1.4.0 does not work on Windows. This
is due to the use of dev/random in the initialization of the DSS library. dev/random does not exist on Windows System.

A patch I previously suggested used Microsoft's Cryptographic API. However, this API is quite complicated and has many
possible error conditions. As it turns out, the patch did not work when using ssh as the fork command. (Error code
NTE_BAD_KEY_STATE when calling CryptAcquireContext in a ssh session.)

With this bug entry, I propose a different fix which does not depend on the CryptoAPI and works from within a ssh
session.

Implementation details:

  1. On XP and Vista, the fix uses the system function RtlGenRandom.
    While MSDN discourages the use of this function in favour of the CryptoAPI, it is in fact used in the rand_s function
    of the Visual C++ CRT, so it will be around for a long time.
    (see http://msdn.microsoft.com/en-us/library/sxtz2fa8.aspx )

  2. On older Windows versions, the fix uses the current process id (GetCurrentProcessId) and the tick count (GetTickCount)
    as the seed. This does not provide cryptographically secure random numbers, but should suffice for the requirements
    of the current Mozart version (which does not use the cryptography features of the DSS at the moment, as far as I can
    tell).

See attached patch (for file platform/dss/src/msl_crypto.cc only):

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

No branches or pull requests

1 participant