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

Add x25519 gem, support Curve25519 #840

Merged
merged 1 commit into from
Jun 18, 2024
Merged

Add x25519 gem, support Curve25519 #840

merged 1 commit into from
Jun 18, 2024

Conversation

HLFH
Copy link
Contributor

@HLFH HLFH commented Jun 15, 2024

Fixes:

  ERROR (Net::SSH::Exception): Exception while executing on host example.com: could not settle on kex algorithm
Server kex preferences: [email protected],ext-info-s,[email protected]
Client kex preferences: ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1

Fixes:

```
  ERROR (Net::SSH::Exception): Exception while executing on host example.com: could not settle on kex algorithm
Server kex preferences: [email protected],ext-info-s,[email protected]
Client kex preferences: ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1```

add x25519 in Gemfile.lock
@djmb djmb merged commit 0a6b0b7 into basecamp:main Jun 18, 2024
8 checks passed
@kobaltz
Copy link

kobaltz commented Jul 9, 2024

I think that there could be an issue with this gem on amd64 docker images using Ruby:3.3.4-slim

10.76 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
10.76
10.76 current directory:
10.76 /usr/local/bundle/gems/x25519-1.0.10/ext/x25519_precomputed
10.76 /usr/local/bin/ruby extconf.rb
10.76 creating Makefile
10.76
10.76 current directory: /usr/local/bundle/gems/x25519-1.0.10/ext/x25519_precomputed
10.76 make DESTDIR\= sitearchdir\=./.gem.20240709-8-s8aykj
10.76 sitelibdir\=./.gem.20240709-8-s8aykj clean
10.76
10.76 current directory: /usr/local/bundle/gems/x25519-1.0.10/ext/x25519_precomputed
10.76 make DESTDIR\= sitearchdir\=./.gem.20240709-8-s8aykj
10.76 sitelibdir\=./.gem.20240709-8-s8aykj
10.76 compiling cputest.c
10.76 cputest.c: In function ‘check_xcr0_ymm’:
10.76 cputest.c:28:12: warning: old-style function definition [-Wold-style-definition]
10.76    28 | static int check_xcr0_ymm()
10.76       |            ^~~~~~~~~~~~~~
10.76 cputest.c: In function ‘check_4th_gen_intel_core_features’:
10.76 cputest.c:39:5: warning: old-style function definition [-Wold-style-definition]
10.76    39 | int check_4th_gen_intel_core_features()
10.76       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10.76 At top level:
10.76 cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been
10.76 intended to silence earlier diagnostics
10.76 cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have
10.76 been intended to silence earlier diagnostics
10.76 cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may
10.76 have been intended to silence earlier diagnostics
10.76 compiling fp25519_x64.c
10.76 fp25519_x64.c: In function ‘mul2_256x256_integer_x64’:
10.76 fp25519_x64.c:112:3: error: the register ‘%r13’ cannot be clobbered in ‘asm’ for
10.76 the current target
10.76   112 |   __asm__ __volatile__(
10.76       |   ^~~~~~~
10.76 fp25519_x64.c: In function ‘sqr2_256x256_integer_x64’:
10.76 fp25519_x64.c:292:3: error: the register ‘%r14’ cannot be clobbered in ‘asm’ for
10.76 the current target
10.76   292 |   __asm__ __volatile__(
10.76       |   ^~~~~~~
10.76 fp25519_x64.c: In function ‘red_EltFp25519_2w_x64’:
10.76 fp25519_x64.c:443:3: error: the register ‘%r11’ cannot be clobbered in ‘asm’ for
10.76 the current target
10.76   443 |   __asm__ __volatile__(
10.76       |   ^~~~~~~
10.76 fp25519_x64.c: In function ‘mul_256x256_integer_x64’:
10.76 fp25519_x64.c:529:3: error: the register ‘%r13’ cannot be clobbered in ‘asm’ for
10.76 the current target
10.76   529 |   __asm__ __volatile__(
10.76       |   ^~~~~~~
10.76 fp25519_x64.c: In function ‘sqr_256x256_integer_x64’:
10.76 fp25519_x64.c:627:4: error: the register ‘%r14’ cannot be clobbered in ‘asm’ for
10.76 the current target
10.76   627 |    __asm__ __volatile__(
10.76       |    ^~~~~~~
10.76 fp25519_x64.c: In function ‘red_EltFp25519_1w_x64’:
10.76 fp25519_x64.c:711:3: error: the register ‘%r11’ cannot be clobbered in ‘asm’ for
10.76 the current target
10.76   711 |   __asm__ __volatile__(
10.76       |   ^~~~~~~
10.76 fp25519_x64.c: In function ‘add_EltFp25519_1w_x64’:
10.76 fp25519_x64.c:766:3: error: the register ‘%r11’ cannot be clobbered in ‘asm’ for
10.76 the current target
10.76   766 |   __asm__ __volatile__(
10.76       |   ^~~~~~~
10.76 fp25519_x64.c: In function ‘sub_EltFp25519_1w_x64’:
10.76 fp25519_x64.c:789:3: error: the register ‘%r11’ cannot be clobbered in ‘asm’ for
10.76 the current target
10.76   789 |   __asm__ __volatile__(
10.76       |   ^~~~~~~
10.76 fp25519_x64.c: In function ‘mul_a24_EltFp25519_1w_x64’:
10.76 fp25519_x64.c:816:3: error: the register ‘%r11’ cannot be clobbered in ‘asm’ for
10.76 the current target
10.76   816 |   __asm__ __volatile__(
10.76       |   ^~~~~~~
10.76 At top level:
10.76 cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been
10.76 intended to silence earlier diagnostics
10.76 cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have
10.76 been intended to silence earlier diagnostics
10.76 cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may
10.76 have been intended to silence earlier diagnostics
10.76 make: *** [Makefile:248: fp25519_x64.o] Error 1
10.76
10.76 make failed, exit code 2
10.76
10.76 Gem files will remain installed in /usr/local/bundle/gems/x25519-1.0.10 for
10.76 inspection.
10.76 Results logged to
10.76 /usr/local/bundle/extensions/x86-linux/3.3.0/x25519-1.0.10/gem_make.out
10.76
10.76   /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:125:in `run'
10.76 /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:51:in `block in
10.76 make'
10.76   /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:43:in `each'
10.76   /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:43:in `make'
10.76 /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/ext/ext_conf_builder.rb:42:in
10.76 `build'
10.76 /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:193:in
10.76 `build_extension'
10.76 /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:227:in `block in
10.76 build_extensions'
10.76   /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:224:in `each'
10.76 /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:224:in
10.76 `build_extensions'
10.76 /usr/local/lib/ruby/site_ruby/3.3.0/rubygems/installer.rb:853:in
10.76 `build_extensions'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/rubygems_gem_installer.rb:79:in
10.76 `build_extensions'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/rubygems_gem_installer.rb:28:in
10.76 `install'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/source/rubygems.rb:205:in
10.76 `install'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/installer/gem_installer.rb:54:in
10.76 `install'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/installer/gem_installer.rb:16:in
10.76 `install_from_spec'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/installer/parallel_installer.rb:132:in
10.76 `do_install'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/installer/parallel_installer.rb:123:in
10.76 `block in worker_pool'
10.76   /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/worker.rb:62:in `apply_func'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/worker.rb:57:in `block in
10.76 process_queue'
10.76   <internal:kernel>:187:in `loop'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/worker.rb:54:in
10.76 `process_queue'
10.76 /usr/local/bundle/gems/bundler-2.5.14/lib/bundler/worker.rb:90:in `block (2
10.76 levels) in create_threads'
10.76
10.76 An error occurred while installing x25519 (1.0.10), and Bundler cannot continue.
10.76
10.76 In Gemfile:
10.76   kamal was resolved to 1.7.3, which depends on
10.76     x25519

@djmb
Copy link
Collaborator

djmb commented Jul 15, 2024

Thanks for the report @kobaltz. I think we'll need to revert this then, if we can't reliably build the dependency we'll need to drop it.

@HLFH - you'll have to use a wrapper script to include the Curve25519 support, something like this maybe (though I haven't tested this works):

#!/usr/bin/env ruby

require "bundler/inline"

gemfile(true, quiet: true) do
  source "https://rubygems.org"

  gem "kamal", "~> 1.7"
  gem "x25519"
end

load Gem.bin_path("kamal", "kamal")

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.

3 participants