Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: A better rand() for Win32

by ysth (Canon)
on Jul 30, 2007 at 21:08 UTC ( [id://629668]=note: print w/replies, xml ) Need Help??


in reply to Re: A better rand() for Win32
in thread A better rand() for Win32

That smacks of a rhetorical question. (If it wasn't, please ignore the following.) Why do you think someone might want a short cut-and-paste solution over a CPAN module? (Look, another rhetorical question!) If you can come up with any answers, perhaps you might present them along with counter-arguments?

Replies are listed 'Best First'.
Re^3: A better rand() for Win32
by BrowserUk (Patriarch) on Jul 31, 2007 at 00:38 UTC

    Actually no. It wasn't rhetorical. I did a search for capicom, found a download page, attempted to follow the Capicom Reference link to find out what it was about. But, being MS, I got a "Sorry, there was a vowel in the month so we decided to change the location of everything on our website again, but oh dear, we seem to have missed updating a link", page. So, as I don't know if there is some advantage, and the docs do not appear to be available, I thought I would ask.

    And, in the event that the author was not familiar with Math::Random::MT, asking would bring that module to his attention also.

    Why do you think someone might want a short cut-and-paste solution over a CPAN module?

    If it were a simple C&P job, I might understand the motivation, but as you have to also download and install Capicom SDK, it doesn't seem any easier than installing the Math-Random PPD. Especially when it requires authentication which doesn't work for me, despite that I have all the appropriate Genuine Windows certificates of Authenticity, holograms, asset tags and product keys. Probably because I have configured my machine to disable a bunch of unnecessary services.

    As for counter arguments. It's hard to know what to counter until I know what advantages it is meant to have? Hence another reason for asking. I'm not at all convinced that entropy-based RNGs, especially those that require callouts to third-party websites, (I've failed to find out if capicom is one of these?), are much more secure than long period PRNGs like the Mersenne Twister, but I'm open to education on that.

    I am aware that it is necessary to seed the MT correctly in order to use it for cryptographic purposes, but that doesn't seem to be a consideration here.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      If you are still interested in capicom.dll, this download link might work for you: CAPICOM — Download the update

      Since it is a security update, there is no "Genuine Windows" authentification needed. Or at least so it seems to me.

        Offline, pKai asked me the following question, which I reproduce here with his permission.

        Sorry, I don't get it. Every major subsystem of Windows has been subject to priority 1 security patches in the past. If you are concerned that this has been patched, shouldn't you abandon Win as a platform then?

        The problem is not that it has been patched. Timely or not, that indicates it is maintained at least.

        The problem is the idea of a library intended for cryptographic uses that even permits the potential for 'remote code execution', never mind has an exploitable vulnerability. It's like fitting a really expensive, sophisticated front door lock and then hanging the key on a piece of string inside the letterbox.

        Nothing I do is particularly secret. No lives will be lost if it is exposed and I don't keep or use financial data on my general purpose PC. My security needs are therefore minimal and 'best efforts' are good enough for my purposes. None the less, it would be inconvenient and upset me greatly to risk the contents of my harddrive to every random oik on the net, so I take a sensible level of precaution to that end.

        That leaves my main use for random being for simulations and the like. To that end, I don't see the point in installing a CSPRNG, that potentially breaches the security of my machine by exposing net visible, 'remote code execution interface' in order to seed a non-cryptographically secure PRNG. Does that make sense to you? Why not just use the CSPRNG once you've installed it?

        As for abandoning Win:Why? The simplest answer to 95% of the exposures that Win has been subject to, is don't run the code. Hence, I don't use IE, or Exchange or Word or Excel. I have turned off nearly 80% of the services that are started by default and mostly sit there doing nothing 99% of the time, except exposing vulnerabilities and consuming memory. When I need to use a service, I turn it on temporarially and then disable it again.

        Does it mean I'm 100% secure. Obviously not. There is no such thing. Not even with other OSs.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        Many thanks pKai.

        However, given the reason that update exists:

        A remote code execution vulnerability exists in Cryptographic API Component Object Model (CAPICOM) that allows an attacker who successfully exploits this vulnerability to take complete control of an affected system.

        I think it knocks the whole "required for secure cryptographics purposes" idea on the head. I'll stick with Math::Random::MT and my own mechanism for seeding it :)


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
      Thanks for expanding on your comment. One of these days, I'm hoping somebody drops a real PRNG into the perl core for use on platforms where $Config{randbits} < 48 (msvcrt is 15 :( ).

        Agreed. It is pathetic that msvcrt is stuck with that prng. It's not even a good example of a 15-bit prng. It's almost worse that Perl hasn't corrected that deficiency. I guess it would just takes someone with the guts to work up the patch and champion it.

        The MT consists of less that 80 lines of code, we could do worse than just use that everywhere. If there is concern that its 32-bit output would be a retrograde step for those that currently provide a 48-bit PRNG, there is now a 64-bit variant, which given the inexorable increase in 64-bit machines around, would seem to make sense, though it's not clear to me if that would compile on a 32-bit machine.

        However, there is also a new, faster SIMD varient that is 2 - 4 times faster, produces 128-bit PRNs, has 64-bit, 32-bit and double output apis. I wonder if that would be portable enough for inclusion in perl?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://629668]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-25 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found