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

Detect CPU capabilities and set scheme accordingly #62

Merged
merged 3 commits into from
Jun 3, 2021

Conversation

robertodauria
Copy link
Contributor

@robertodauria robertodauria commented Jun 2, 2021

This PR changes the default value for the -scheme flag to be based on the detected CPU features. The scheme is set to wss only on architectures that have hardware AES capabilities so that we don't use TLS where it would otherwise impact performances significantly.

This change is Reviewable

Copy link
Contributor

@bassosimone bassosimone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐳

@robertodauria robertodauria changed the title Detect GOARCH and set scheme accordingly. Detect CPU capabilities and set scheme accordingly Jun 3, 2021
@robertodauria
Copy link
Contributor Author

@bassosimone I've changed the code to detect the CPU capabilities via x/sys/cpu rather than relying on GOARCH. It looks like it's totally possible for an ARMv8 CPU to lack AES support, since cryptographic extensions are licensed separately by ARM.

PTAL again?

Copy link
Contributor

@bassosimone bassosimone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐳

@robertodauria robertodauria merged commit 343e5b2 into master Jun 3, 2021
@robertodauria robertodauria deleted the sandbox-roberto-detect-arch branch June 3, 2021 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants