File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 paths-ignore :
66 - README.md
77 push :
8- branches : main
98 paths-ignore :
109 - README.md
1110
@@ -16,14 +15,17 @@ jobs:
1615 test :
1716 runs-on : ubuntu-latest
1817 strategy :
18+ fail-fast : false
1919 matrix :
2020 ruby :
21- - ruby-2.5
22- - ruby-2.6
2321 - ruby-2.7
2422 - ruby-3.0
23+ - ruby-3.1
24+ - ruby-3.2
25+ - ruby-3.3
26+ - ruby-head
2527 steps :
26- - uses : actions/checkout@v2
28+ - uses : actions/checkout@v4
2729 - uses : ruby/setup-ruby@v1
2830 with :
2931 ruby-version : ${{ matrix.ruby }}
3436 rubocop :
3537 runs-on : ubuntu-latest
3638 steps :
37- - uses : actions/checkout@v2
39+ - uses : actions/checkout@v4
3840 - uses : ruby/setup-ruby@v1
3941 with :
40- ruby-version : 2.5
42+ ruby-version : 2.7
4143 bundler-cache : true
4244 - run : bundle exec rubocop --format progress --color
Original file line number Diff line number Diff line change 1+ require :
2+ - rubocop-performance
3+ - rubocop-rake
4+ - rubocop-rspec
5+
16AllCops :
2- TargetRubyVersion : 2.5
7+ TargetRubyVersion : 2.7
38 DisplayCopNames : true
9+ NewCops : enable
410
511#
612# Metrics
@@ -36,3 +42,13 @@ Style/FrozenStringLiteralComment:
3642
3743Style/StringLiterals :
3844 EnforcedStyle : double_quotes
45+
46+ #
47+ # RSpec
48+ #
49+
50+ RSpec/MultipleExpectations :
51+ Max : 3
52+
53+ RSpec/ExampleLength :
54+ Max : 6
Original file line number Diff line number Diff line change @@ -8,5 +8,8 @@ group :development, :test do
88 gem "rake" , require : false
99 gem "rake-compiler" , "~> 1.0" , require : false
1010 gem "rspec" , "~> 3.10" , require : false
11- gem "rubocop" , "1.18" , require : false
11+ gem "rubocop" , "1.68" , require : false
12+ gem "rubocop-performance" , "1.23.0" , require : false
13+ gem "rubocop-rake" , "0.6.0" , require : false
14+ gem "rubocop-rspec" , "3.2.0" , require : false
1215end
Original file line number Diff line number Diff line change 44
55require "mkmf"
66
7- if RUBY_PLATFORM =~ /x86_64|x64/
7+ if RUBY_PLATFORM . match? ( /x86_64|x64/ )
88 $CFLAGS << " -Wall -O3 -pedantic -std=c99 -mbmi -mbmi2 -march=haswell"
99
1010 create_makefile "x25519_precomputed"
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33RSpec . describe X25519 ::MontgomeryU do
4- let ( :coordinate_hex ) { "e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c" }
5-
64 subject ( :point ) { described_class . new ( unhex ( coordinate_hex ) ) }
75
6+ let ( :coordinate_hex ) { "e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c" }
7+
88 describe "#to_bytes" do
99 it "serializes #{ described_class } as a Encoding::BINARY String" do
1010 bytes = point . to_bytes
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33RSpec . describe X25519 ::Scalar do
4- let ( :scalar_hex ) { "a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4" }
5-
64 subject ( :scalar ) { described_class . new ( unhex ( scalar_hex ) ) }
75
6+ let ( :scalar_hex ) { "a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4" }
7+
88 describe ".generate" do
99 it "generates random keys" do
1010 # Not great, but better than nothing
2121 expect { scalar . multiply ( "derp" ) } . to raise_error ( TypeError )
2222 end
2323
24- context "RFC 7748 test vectors" do
24+ context "with RFC 7748 test vectors" do
2525 it "passes the test vectors" do
2626 X25519 ::TestVectors ::VARIABLE_BASE . each do |v |
2727 scalar = described_class . new ( unhex ( v . scalar ) )
3535 end
3636
3737 describe "#multiply_base" do
38- context "RFC 7748 test vectors" do
38+ context "with RFC 7748 test vectors" do
3939 it "passes the test vectors" do
4040 X25519 ::TestVectors ::FIXED_BASE . each do |v |
4141 scalar = described_class . new ( unhex ( v . scalar ) )
Original file line number Diff line number Diff line change 22
33RSpec . describe X25519 do
44 it "has a version number" do
5- expect ( described_class ::VERSION ) . not_to be nil
5+ expect ( described_class ::VERSION ) . not_to be_nil
66 end
77
88 describe ".diffie_hellman" do
2424 end . to raise_error ( X25519 ::InvalidKeyError )
2525 end
2626
27- context "RFC 7748 test vectors" do
27+ context "with RFC 7748 test vectors" do
2828 it "passes the test vectors" do
2929 X25519 ::TestVectors ::VARIABLE_BASE . each do |v |
3030 shared_secret = described_class . diffie_hellman ( unhex ( v . scalar ) , unhex ( v . input_coord ) )
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- require File . expand_path ( "lib/x25519/version" , __dir__ )
3+ require_relative "lib/x25519/version"
44
55Gem ::Specification . new do |spec |
66 spec . name = "x25519"
@@ -16,12 +16,8 @@ Gem::Specification.new do |spec|
1616 spec . homepage = "https://github.com/RubyCrypto/x25519"
1717 spec . license = "BSD-3-Clause" # https://spdx.org/licenses/BSD-3-Clause.html
1818 spec . files = `git ls-files -z` . split ( "\x0 " ) . reject { |f | f . match ( %r{^(test|spec|features)/} ) }
19- spec . bindir = "exe"
20- spec . executables = spec . files . grep ( %r{^exe/} ) { |f | File . basename ( f ) }
21- spec . require_paths = [ "lib" ]
2219 spec . platform = Gem ::Platform ::RUBY
2320 spec . extensions = [ "ext/x25519_precomputed/extconf.rb" , "ext/x25519_ref10/extconf.rb" ]
2421
25- spec . required_ruby_version = ">= 2.5"
26- spec . add_development_dependency "bundler" , "~> 2.1"
22+ spec . required_ruby_version = ">= 2.7"
2723end
You can’t perform that action at this time.
0 commit comments