Skip to content

Comments

bn/asm/*-mont.pl: harmonize with BN_from_montgomery_word.#6141

Closed
dot-asm wants to merge 1 commit intoopenssl:masterfrom
dot-asm:bn-mont
Closed

bn/asm/*-mont.pl: harmonize with BN_from_montgomery_word.#6141
dot-asm wants to merge 1 commit intoopenssl:masterfrom
dot-asm:bn-mont

Conversation

@dot-asm
Copy link
Contributor

@dot-asm dot-asm commented Apr 30, 2018

Montgomery multiplication post-conditions in some of code paths is
formally non-constant time. Cache access pattern is result-neutral,
but a little bit asymmetric, which might produce a signal [on
processor can reorder load and stores at run-time].

Montgomery multiplication post-conditions in some of code paths is
formally non-constant time. Cache access pattern is result-neutral,
but a little bit asymmetric, which might produce a signal [on
processor can reorder load and stores at run-time].
@dot-asm dot-asm added branch: master Applies to master branch branch: 1.0.2 Applies to OpenSSL_1_0_2-stable branch (EOL) 1.1.0 branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) labels Apr 30, 2018
@dot-asm
Copy link
Contributor Author

dot-asm commented Apr 30, 2018

BTW! This is unrelated to this merge request, but test_rand hung on qemu-alpha for me. Question is therefore if it's qemu deficiency or would it hang even on hardware? So if anybody has Alpha hardware, it would be nice to hear about it...

@dot-asm
Copy link
Contributor Author

dot-asm commented May 1, 2018

The hang appears to be multi-threading deadlock [naturally in multi-threading test in drbgtest]. It still might be qemu-specific problem, but it also might happen that qemu-alpha is slow in an unfortunate way and triggers some subtle timing problem. Which can mean that it can be triggered under some other circumstances. After all, qemu-user simply passes system calls to native kernel...

@dot-asm
Copy link
Contributor Author

dot-asm commented May 2, 2018

If I drop amount of threads and reduce time, test does pass occasionally. I mean it doesn't actually go straight to deadlock, but makes some progress, then gets stuck [in futex].

Once again, this is totally unrelated to this request. Request by itself is ready to roll...

@richsalz
Copy link
Contributor

richsalz commented May 2, 2018

Did the old code also fail on qemu-alpha, or is this a new failure? I suppose we could live with new regressions on Alpha, for closing the side-channel on all popular platforms. But maybe it's better to remove the alpha code from this PR?

@dot-asm
Copy link
Contributor Author

dot-asm commented May 2, 2018

It's drbgtest that hangs, and alpha-mont.pl is not involved there, at all. It does mean that it hangs even without suggested modification. Yes, I did check. Once again, hang in test_rand is actually unrelated to this request. The fact that it surfaced now is purely because I don't exercise alpha build that often. But I'm a bit reluctant to claim it as [separate] problem with drbg, because it still might be qemu-specific...

@dot-asm
Copy link
Contributor Author

dot-asm commented May 2, 2018

As it turns out drbgtest does work with newer qemu-alpha, newer than one I have on my desktop. Formally speaking it's not actually conclusive, because newer qemu might be faster [or slower] than one I have, but it would be appropriate to say that it's much more likely in fact a qemu-specific problem. Once again, "it" is actually unrelated to the code modifications in this request.

@richsalz
Copy link
Contributor

richsalz commented May 2, 2018

Glad to know it's unrelated. I approve.

@richsalz richsalz added the approval: done This pull request has the required number of approvals label May 2, 2018
levitte pushed a commit that referenced this pull request May 2, 2018
Montgomery multiplication post-conditions in some of code paths were
formally non-constant time. Cache access pattern was result-neutral,
but a little bit asymmetric, which might have produced a signal [if
processor reordered load and stores at run-time].

Reviewed-by: Rich Salz <[email protected]>
(Merged from #6141)
dot-asm pushed a commit to dot-asm/openssl that referenced this pull request May 2, 2018
Montgomery multiplication post-conditions in some of code paths were
formally non-constant time. Cache access pattern was result-neutral,
but a little bit asymmetric, which might have produced a signal [if
processor reordered load and stores at run-time].

Reviewed-by: Rich Salz <[email protected]>
(Merged from openssl#6141)

(cherry picked from commit 774ff8f)
@dot-asm
Copy link
Contributor Author

dot-asm commented May 2, 2018

It didn't cherry-pick, so there is #6163, while this one is merged and closing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: done This pull request has the required number of approvals branch: master Applies to master branch branch: 1.0.2 Applies to OpenSSL_1_0_2-stable branch (EOL) branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants