News for hackers. Stuff that matters.
Re:CTTK: Constant-Time Toolkit by friendlydude12 on Sunday February 25, 2018 @02:17PM (#16460603)
Calling this “Constant time” is a bit confusing. I thought it was going to be a library of algorithms for solving O(1) problems. “Timing attack resistant” would be a better name.
Re:CTTK: Constant-Time Toolkit by cperciva on Sunday February 25, 2018 @05:44PM (#16461648)
O(1) is not constant time. It's bounded from above by a constant times 1 for sufficiently large values of N time.

In particular, sin(N) is O(1) despite never taking the same value twice.

Re:CTTK: Constant-Time Toolkit by friendlydude12 on Sunday February 25, 2018 @06:28PM (#16461847)
Thanks, I went to college too and was fully aware of the formal definition of O() notation. That doesn’t change the fact that colloquially it’s far more common to use the phrase “constant time” when referring to time complexity rather than timing attack resistance.
Re:CTTK: Constant-Time Toolkit by pinko on Monday February 26, 2018 @09:46AM (#16465588)
Colin did a little more than "go to college".
Re:CTTK: Constant-Time Toolkit by friendlydude12 on Monday February 26, 2018 @03:27PM (#16468681)
Oh really? Please explain to me how that is relevant to the point being made in this thread. https://en.wikipedia.org/wiki/Time_complexity#Constant_time
Re:CTTK: Constant-Time Toolkit by IncRnd on Sunday February 25, 2018 @03:04PM (#16460872)
Constant Time refers to algorithms that execute in constant time without predictive branches on secret data. Constant Time is the accepted standard name for such.
Re:CTTK: Constant-Time Toolkit by friendlydude12 on Monday February 26, 2018 @03:33PM (#16468731)
It also refers to time complexity: https://en.wikipedia.org/wiki/Time_complexity#Constant_time this predates the crypto jargon.
Re:CTTK: Constant-Time Toolkit by IncRnd on Monday February 26, 2018 @07:23PM (#16470183)
> It also refers to time complexity: https://en.wikipedia.org/wiki/Time_complexity#Constant_time this predates the crypto jargon.

Looking at the very first sentence of your link: An algorithm is said to be constant time (also written as O(1) time) if the value of T(n) is bounded by a value that does not depend on the size of the input.

That is true in this case.

Also, from the article here: It shall be noted that the expression "constant-time" is traditional but slightly confusing: constant-time code does not always execute in a constant amount of time; rather, this means that any variation in execution time is uncorrelated with secret information.

You are drawing a distinction that doesn't exist.

Re:CTTK: Constant-Time Toolkit by friendlydude12 on Monday February 26, 2018 @10:34PM (#16470887)
There is in fact a distinction between the two usages. I can show it with a simple counter example:

    def matches_secret(a):
        return a == “secret”
The execution time of matches_secret is bounded by a constant and the variation in execution time is correlated with secret information. This precisely means that matches_secret is constant time in the O(1) sense and not in the security sense referenced by the original article.
Re:CTTK: Constant-Time Toolkit by IncRnd on Monday February 26, 2018 @11:49PM (#16471140)
Your example is incorrect. In your example, matches_secret's runtime depends on the input. You should reread the link that you posted.

An algorithm is said to be constant time (also written as O(1) time) if the value of T(n) is bounded by a value that does not depend on the size of the input.

Re:CTTK: Constant-Time Toolkit by friendlydude12 on Tuesday February 27, 2018 @04:47AM (#16472224)
There exists a constant, K, such that T(n) < K always holds true regardless of the input length. K is proportional to the length of the constant string “secret” and has no dependence on the input. Thus, matches_secret is O(1).

Furthermore, even though T(n) is bounded by a constant, it is not constant itself and its runtime is proportional to the amount of prefix characters the input has in common with the secret. This makes it not “constant time” in the crypto sense and it is susceptible to timing attacks.

The existence of a function that is constant time in the O(1) sense but not in the crypto sense proves that they are distinct concepts.

Re:CTTK: Constant-Time Toolkit by IncRnd on Tuesday February 27, 2018 @09:02AM (#16473371)
Fair point.
Re:CTTK: Constant-Time Toolkit by minitech on Tuesday February 27, 2018 @05:39AM (#16472390)
It’s extremely standard terminology and only confusing if you haven’t been exposed to the concept timing attacks. (Which is great! Now you have.)
Re:CTTK: Constant-Time Toolkit by friendlydude12 on Tuesday February 27, 2018 @10:30AM (#16474181)
No. I’ve known about timing attacks for as long as I can remember. In any case, any specific individual’s familiarity with timing attacks doesn’t change the fact that using the term “constant time” to refer to time complexity is far more common than using the term to refer to timing attacks susceptibility. Not to mention formal algorithm analysis predates the formal description of timing attacks by many years. https://en.wikipedia.org/wiki/Time_complexity#Constant_time
Re:CTTK: Constant-Time Toolkit by minitech on Tuesday February 27, 2018 @07:36PM (#16479608)
> using the term “constant time” to refer to time complexity is far more common than using the term to refer to timing attacks susceptibility

This doesn’t make it “confusing”.

Re:CTTK: Constant-Time Toolkit by friendlydude12 on Tuesday February 27, 2018 @08:11PM (#16479825)
The same terminology being used for distinct concepts is indeed a potential source of confusion. If you were to say “this is a constant time algorithm” I would need more information to clarify what you meant, rendering the original term less useful.
Re:CTTK: Constant-Time Toolkit by floatboth on Sunday February 25, 2018 @05:16PM (#16461508)
It's fair to let cryptographers steal the "constant time" phrase. After all, buttcoiners stole "crypto" from them :)