- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
You're being racist. Can you please stop?
Admin
Given:
And, assuming (typical) development:
Let us look at some failure cases:
The key vector is computed incorrectly. In this case, the entire stack appears to work fine. The data may even appear "random". Of course, an entropy calculation filter on the actual stream would highlight the problem.
Everything has been done as above. Except that the decryption component has been replaced by another implementation, with a simple "pass/fail". Again, the RNG or key computation is incorrect. Message are "brute forcible". (Actually happened with Debian SSH). Can only be detected by proper analysis of the key path.
Once the key path is confirmed, it must be "boxed away" (the Debian fiasco occurred because a packaging dev "opened" the box to get rid of some valgrind warnings).
The testing of a crypto component in particular is difficult. Very, very difficult. It starts with known vectors. Followed by code path and data analysis. "Random" tests are really not at all useful, and mostly just hurt because they install a false sense of security. Aside from a "smoke test", but that is done more usefully with known vectors as well. Simply because, if the "smoke test" doesn't work, it needs to be replicated anyway.
(FWIW: FIPS 140 validation involves code analysis, and known test vectors. I have never needed "random" tests. However random testing for customer demonstration, along with a entropy analyzer is useful for sales purposes)
If random vectors are used in a smoke test, they would need to be stored along with the results (just in case of failure).
Admin
Joe
If someone does 10 billion random tests for 4 billion possible cases -- that's, um... a serious WTF.
Just do 4 billion directed tests and guarantee 100% coverage.
That's all I meant to say.
Admin
Admin
Sure. Sometimes, a randomizer is used with a seed, which will make it return a consistent, rather than a random, result.
Randomizers used in this way are a nice tool in encrypting.
Seeing how the product is called 'legacy', the randomizer may be there to not exactly duplicate the behavior of the .NET randomizer, but an different one... for instance, the VB6 randomizer.
Been there, done that. Burnt the T-shirt.
peter
Captcha: quibus -- strangely enough, that is a (misspelled) Dutch colloquial word for a nutcase (kwibus).
Admin
So on a 16-bit system:
Admin
"Don't rely on the compiler to do your math." by "Not sure if Fry or just Philip"
That has to be the Dumbest or the Funniest phrase I've ever seen on The Daily WTF! (or both!)
ROFL, Jim
There are 10 types who have programming jobs:
Admin
Nope. That assumes that the PRNG is only called once per transaction (or whatever the main loop is doing). If it is called twice you need to square that (trice and **3, etc). And even then you might miss problems caused by leftover values from one iteration affecting the next.
Example (though not of a PRNG): One of my employer's computers had a bug where if a Procedure Exit instruction was preceded by one particular innocuous instruction, the exit would, well, not exit properly. No amount of individual instruction testing would have caught the bug. Some machine state was left weird, and it only affected the Procedure Exit instruction.
A PRNG example: a friend of mine was using a PRNG to initially place stars in a volume of space for a simulation of galaxy evolution. The PRNG was highly thought of, and passed many tests with flying colors (die, dice, poker hands, and other tests). When he took a stereoscopic picture of the resulting array he got what he called a "cosmic potato chip" instead of a spherical structure. It turned out that that PRNG had a known - but undocumented -- weakness -- sets of triplet values did have a non-random behavior. But it was fine for anything else! (or so they said).
An excellent PRNG is hard to find. Bad ones are easy and common.
Jim
Admin
I'll also write "1000 * 60 * 10" to define 10 minutes in milliseconds, rather than "600000".
"199 + 6" could have been a left-over of some test code that ended up being kept, or it could relate to something that Mr. smart-ass Ryan failed to mention.
Ryan, honey, is that seriously the worst piece in that whole codebase that you were able to find, and you absolutely and desperately just had to find something to ridicule? Dumb-ass...
Admin
There's a HUGE difference between an "199 + 6" (*with nothing other than "Sanity Check" as a comment, and "1000 * 60 * 10" with a comment indicating something like "ten minutes, in ms".
The latter is clear and understandable, the former is not.
And there's no need to resort to name calling - While I freely admit to being a smart-ass, I don't particularly appreciate being called "honey" or "dumb-ass".
So lay off, if you will. There was plenty in the code base that was questionable, but that was a single line of code (2 with the comment) that made me bust out laughing in a slightly incredulous "This makes me so sad that I can only laugh to keep my sanity" type of laugh.
Captcha: nisl (National Institute of Silly Lexicon"