From: rich@example.invalid   
      
   c186282 wrote:   
   > On 2/12/26 04:55, Richard Kettlewell wrote:   
   >> "Carlos E. R." writes:   
   >>> In the example posted:   
   >>>   
   >>> The user types in a password, which gets checked against   
   >>> a database, character by character. Once the first character   
   >>> doesn't match, an error message is returned.   
   >>>   
   >>> ...the fault is not of the compiler, but of the programmer. He has to   
   >>> examine all characters even if he knows there is no point.   
   >>   
   >> Obviously you didn’t read the whole article...   
   >   
   > It's "examining" behavior that's the fault :-)   
   >   
   > If you ALWAYS process ALL the characters, and/or try   
   > to make fake timing so success/fail will use up the   
   > same amount of CPU time, THEN you're ahead of the game.   
      
   Obviously you didn’t read [Richard Kettlewell's posts]   
      
   The C code was, if executed literally as written, processing ALL the   
   characters.   
      
   But in both the optimized state (-O3) and the "do not optimize" state   
   (-O0) the GCC output object code was skipping execution of much of the   
   object code that needed to be executed for a "constant time"   
   comparison.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|