Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OpenSSL/libsodium binding for shared secret computation (when possible) #149

Closed
Minishlink opened this issue Mar 17, 2018 · 4 comments
Closed

Comments

@Minishlink
Copy link
Member

Follow-up of #5.

Thanks to #147, we generate the encryption keys with OpenSSL, when possible.

We're still using PHP to compute the shared secret though. It's not yet possible (to my knowledge) to do it with OpenSSL or libsodium, but if it becomes possible, please comment on this issue or (better) send a PR to fix it.

@Spomky
Copy link
Contributor

Spomky commented Nov 11, 2018

Hi,

This will be really difficult to achieve ; I’ve just seen this closed question.
The problem is that without any optimized scalar multiplication over NIST curves (from OpenSSL or libSodium), the shared secret computation will remain slow.

@ozgurhangisi
Copy link

Hi,

I've seen that in php 7.3 there is a new openssl_pkey_derive function that creates shared secret for ECDH. Can it be useful for the shared secret computation ?

@Spomky
Copy link
Contributor

Spomky commented Apr 22, 2019

Hi @ozgurhangisi,

Sorry for the very late reply.
I confirm that the key agreement computation on PHP 7.3 will use the new openssl_pkey_derive function.

This will be available in few days.

The first tests I ran showed that this operation is approx 50 to 80 times faster than the pure php method.
So stay tuned!

Edit:

  • PHP7.3+: 1,471.122μs
  • PHP7.1/7.2: 84,756.735μs

=> 57x faster

@Rotzbua
Copy link
Contributor

Rotzbua commented Feb 6, 2024

@Minishlink Can be closed. Was fixed by #289

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

Successfully merging a pull request may close this issue.

4 participants