bcrypt_pbkdf 1.1.0-x64-mingw32 → 1.1.1.rc2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e540fac541e2db1ea7205dd5ea692c79f548287578e61a7ccaa19a08d1b4af9e
4
- data.tar.gz: d622b4067dcde8fc4ea463a6a1a263e230a5f7f9a127f0b47c7d62264f0c77b6
3
+ metadata.gz: 7d678f74fa2ca21e3937197568d3da37823b0f2c2d0770e865a26860ba04f77d
4
+ data.tar.gz: ac42d3bf7b06a825760a5f5ea0cc194e1cad149e60b97e9d0acb90ffe0a14653
5
5
  SHA512:
6
- metadata.gz: b78d5adcdcb69bb46880875b781e9c81ccfbfaac67a8c921b0e203cede9cfeb62bff714b038e0a716ad813ca6d4cf4e2fbb4d7f52975306786e5308e635d8482
7
- data.tar.gz: 60777f05a32dfde3d0cb0110b35e88061aa5fd6db2b86ac38464e063a17e95184488a884292befe0d45a93c7fffb55019418df1a8e3e1ac5772fd9668fa6fa25
6
+ metadata.gz: a7991faf70f942ee1cbd44dea463f93ce74400496967ae6a21eb6aba8daff4cc918f366e5ea1890522b00a364a3cd06ad592908dbd107dd43584142688dd00d7
7
+ data.tar.gz: 52ac5c8e0a988a0891a20c58072e5fc8f25a317ab9c634efe26e72bda4bc337c021ee5fe0d1fbec2d25156b2f43ef52dc3bd8584c9058d3991470ca765acecbc
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: ci
3
+
4
+ on:
5
+ pull_request:
6
+ branches: [ main ]
7
+ push:
8
+ branches: [ main ]
9
+ workflow_dispatch:
10
+
11
+ concurrency:
12
+ group: ${{ github.workflow }}-${{ github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ windows:
17
+ name: ${{ matrix.os }} ruby ${{ matrix.ruby }}
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby: [2.7, 3.3, head, mingw, mswin, ucrt]
22
+ os: [windows-latest]
23
+ runs-on: ${{ matrix.os }}
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby }}
29
+ bundler-cache: true
30
+ - run: bundle exec rake compile
31
+ - run: bundle exec rake test
32
+
33
+ unix:
34
+ name: ${{ matrix.os }} ruby ${{ matrix.ruby }}
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ ruby: [2.7, 3.3, head]
39
+ os: [ubuntu-latest, macos-latest]
40
+ runs-on: ${{ matrix.os }}
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+ - uses: ruby/setup-ruby@v1
44
+ with:
45
+ ruby-version: ${{ matrix.ruby }}
46
+ bundler-cache: true
47
+ - run: bundle exec rake compile
48
+ - run: bundle exec rake test
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ lib/
2
+ pkg/
3
+ tmp/
4
+ Gemfile.lock
5
+ .bundle/
data/README.md CHANGED
@@ -2,21 +2,21 @@
2
2
 
3
3
  bcrypt_pbkdf is a ruby gem implementing bcrypt_pbkdf from OpenBSD. This is currently used by net-ssh to read password encrypted Ed25519 keys.
4
4
 
5
- [![Build Status](https://travis-ci.org/mfazekas/bcrypt_pbkdf-ruby.png?branch=master)](https://travis-ci.org/mfazekas/bcrypt_pbkdf-ruby)
5
+ [![Build Status](https://github.com/net-ssh/bcrypt_pbkdf-ruby/actions/workflows/ci.yml/badge.svg?branch=master&event=push)](https://github.com/net-ssh/bcrypt_pbkdf-ruby/actions/workflows/ci.yml)
6
6
 
7
- # Acknowledgements
7
+ ## Acknowledgements
8
8
 
9
9
  * The gut of the code is based on OpenBSD's bcrypt_pbkdf.c implementation
10
10
  * Some ideas/code were taken adopted bcrypt-ruby: https://github.com/codahale/bcrypt-ruby
11
11
 
12
- # Links:
12
+ ## Links
13
13
 
14
- http://www.tedunangst.com/flak/post/bcrypt-pbkdf
15
- http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/bcrypt_pbkdf.c?rev=1.13&content-type=text/x-cvsweb-markup
14
+ * http://www.tedunangst.com/flak/post/bcrypt-pbkdf
15
+ * http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/bcrypt_pbkdf.c?rev=1.13&content-type=text/x-cvsweb-markup
16
16
 
17
- # Building
17
+ ## Building
18
18
 
19
- For windows cross build make sure you checked out the gem source under the home directory
19
+ For windows and osx cross build make sure you checked out the gem source under the home directory and have docker installed.
20
20
 
21
21
  ```sh
22
22
  gem install rake-compiler-dock
@@ -26,7 +26,7 @@ gem install rake-compiler-dock
26
26
  bundle exec rake compile
27
27
  bundle exec rake test
28
28
  bundle exec rake clean clobber
29
- bundle exec rake gem:windows
29
+ bundle exec rake gem:all
30
30
  bundle exec rake release
31
- bundle exec rake gem:windows:release
31
+ bundle exec rake gem:release
32
32
  ```
data/Rakefile CHANGED
@@ -5,37 +5,19 @@ require 'rake/extensiontask'
5
5
  require 'rake/clean'
6
6
  require 'rdoc/task'
7
7
  require 'benchmark'
8
+ require 'rake_compiler_dock'
8
9
 
10
+ CLEAN.add("{ext,lib}/**/*.{o,so}", "pkg")
9
11
 
10
- CLEAN.include(
11
- "tmp",
12
- "lib/2.0",
13
- "lib/2.1",
14
- "lib/2.2",
15
- "lib/2.3",
16
- "lib/2.4",
17
- "lib/2.5",
18
- "lib/2.6",
19
- "lib/2.7",
20
- "lib/3.0",
21
- "lib/bcrypt_pbkdf_ext.so"
22
- )
23
- CLOBBER.include(
24
- "doc",
25
- "pkg"
26
- )
27
-
28
- task 'gem:windows' do
29
- require 'rake_compiler_dock'
30
- sh "bundle package" # Avoid repeated downloads of gems by using gem files from the host.
31
- RakeCompilerDock.sh "bundle && rake cross native gem RUBY_CC_VERSION=3.0.0:2.7.0:2.6.0:2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0"
32
- end
33
-
34
- task 'gem:windows:release' do
35
- version = Gem::Specification::load("bcrypt_pbkdf.gemspec").version
36
- sh "gem push pkg/bcrypt_pbkdf-#{version}-x86-mingw32.gem"
37
- sh "gem push pkg/bcrypt_pbkdf-#{version}-x64-mingw32.gem"
38
- end
12
+ cross_rubies = ["3.3.0", "3.2.0", "3.1.0", "3.0.0", "2.7.0"]
13
+ cross_platforms = [
14
+ "arm64-darwin",
15
+ "x64-mingw-ucrt",
16
+ "x64-mingw32",
17
+ "x86-mingw32",
18
+ "x86_64-darwin",
19
+ ]
20
+ ENV["RUBY_CC_VERSION"] = cross_rubies.join(":")
39
21
 
40
22
  GEMSPEC = Gem::Specification.load("bcrypt_pbkdf.gemspec")
41
23
 
@@ -59,13 +41,128 @@ RDoc::Task.new do |rdoc|
59
41
  rdoc.rdoc_files.include(*GEMSPEC.extra_rdoc_files)
60
42
  end
61
43
 
62
- Gem::PackageTask.new(GEMSPEC) do |pkg|
63
- pkg.need_zip = true
64
- pkg.need_tar = true
65
- end
66
-
67
44
  Rake::ExtensionTask.new("bcrypt_pbkdf_ext", GEMSPEC) do |ext|
68
45
  ext.ext_dir = 'ext/mri'
69
46
  ext.cross_compile = true
70
- ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
47
+ ext.cross_platform = cross_platforms
48
+ ext.cross_config_options << "--enable-cross-build" # so extconf.rb knows we're cross-compiling
49
+ end
50
+
51
+ namespace "gem" do
52
+ cross_platforms.each do |platform|
53
+ desc "build native gem for #{platform}"
54
+ task platform do
55
+ RakeCompilerDock.sh(<<~EOF, platform: platform, verbose: true)
56
+ gem install bundler --no-document &&
57
+ BUNDLE_IGNORE_CONFIG=1 BUNDLE_PATH=.bundle/#{platform} bundle &&
58
+ BUNDLE_IGNORE_CONFIG=1 BUNDLE_PATH=.bundle/#{platform} bundle exec rake gem:#{platform}:buildit
59
+ EOF
60
+ end
61
+
62
+ namespace platform do
63
+ # this runs in the rake-compiler-dock docker container
64
+ task "buildit" do
65
+ # use Task#invoke because the pkg/*gem task is defined at runtime
66
+ Rake::Task["native:#{platform}"].invoke
67
+ Rake::Task["pkg/#{GEMSPEC.full_name}-#{Gem::Platform.new(platform)}.gem"].invoke
68
+ end
69
+
70
+ task "release" do
71
+ sh "gem push pkg/#{GEMSPEC.full_name}-#{Gem::Platform.new(platform)}.gem"
72
+ end
73
+ end
74
+ end
75
+
76
+ desc "build native gem for all platforms"
77
+ task "all" do
78
+ cross_platforms.each do |platform|
79
+ Rake::Task["gem:#{platform}"].invoke
80
+ end
81
+ end
82
+
83
+ desc "release native gem for all platforms"
84
+ task "release" do
85
+ cross_platforms.each do |platform|
86
+ Rake::Task["gem:#{platform}:release"].invoke
87
+ end
88
+ end
89
+ end
90
+
91
+ def change_version(&block)
92
+ version = GEMSPEC.version
93
+ version_file = 'bcrypt_pbkdf.gemspec'
94
+ raise "No version found" if version.nil?
95
+ final = version.segments.take_while{ |i| i.is_a?(Integer) }.to_a
96
+ pre = version.segments.drop_while{ |i| i.is_a?(Integer) }.to_a.join("")
97
+ pre = nil if pre.empty?
98
+ tiny = final.last
99
+ result = block[pre: pre, tiny: tiny]
100
+ raise ArgumentError, "Version change logic should always return a pre" unless result.key?(:pre)
101
+
102
+ puts "result: #{result.inspect}"
103
+
104
+ new_pre = result[:pre] || []
105
+ new_tiny = result[:tiny] || tiny
106
+ final[-1] = new_tiny
107
+ new_version = Gem::Version.new([final, *new_pre].join("."))
108
+
109
+ found = false
110
+ File.open("#{version_file}.new", "w") do |f|
111
+ File.readlines(version_file).each do |line|
112
+ match = /^(\s+s\.version\s*=\s*\')[\d[a-z]\.]+(\'\s*)$/.match(line)
113
+ if match
114
+ prefix = match[1]
115
+ postfix = match[2]
116
+ new_line = "#{prefix}#{new_version.to_s}#{postfix}"
117
+ puts "Changing:\n - #{line} + #{new_line}"
118
+ line = new_line
119
+ found = true
120
+ end
121
+ f.write(line)
122
+ end
123
+ raise ArgumentError, "Cound not find version line in #{version_file}" unless found
124
+ end
125
+
126
+ FileUtils.mv version_file, "#{version_file}.old"
127
+ FileUtils.mv "#{version_file}.new", version_file
128
+ FileUtils.rm_f "#{version_file}.old"
129
+ end
130
+
131
+ namespace :vbump do
132
+ desc "Final release"
133
+ task :final do
134
+ change_version do |pre:, tiny:|
135
+ _ = tiny
136
+ if pre.nil?
137
+ { tiny: tiny + 1, pre: nil }
138
+ else
139
+ raise ArgumentError, "Unexpected pre: #{pre}" if pre.nil?
140
+
141
+ { pre: nil }
142
+ end
143
+ end
144
+ end
145
+
146
+ desc "Increment prerelease"
147
+ task :pre, [:type] do |_t, args|
148
+ change_version do |pre:, tiny:|
149
+ puts " PRE => #{pre.inspect}"
150
+ match = /^([a-z]+)(\d+)/.match(pre)
151
+ raise ArgumentError, "Unexpected pre: #{pre}" if match.nil? && args[:type].nil?
152
+
153
+ if match.nil? || (!args[:type].nil? && args[:type] != match[1])
154
+ if pre.nil?
155
+ { pre: "#{args[:type]}1", tiny: tiny + 1 }
156
+ else
157
+ { pre: "#{args[:type]}1" }
158
+ end
159
+ else
160
+ { pre: "#{match[1]}#{match[2].to_i + 1}" }
161
+ end
162
+ end
163
+ end
71
164
  end
165
+
166
+ task "package" => cross_platforms.map { |p| "gem:#{p}" } # "package" task for all the native platforms
167
+
168
+ Rake::Task["package"].prerequisites.prepend("compile")
data/bcrypt_pbkdf.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'bcrypt_pbkdf'
3
- s.version = '1.1.0'
3
+ s.version = '1.1.1.rc2'
4
4
 
5
5
  s.summary = "OpenBSD's bcrypt_pbkdf (a variant of PBKDF2 with bcrypt-based PRF)"
6
6
  s.description = <<-EOF
@@ -10,13 +10,12 @@ Gem::Specification.new do |s|
10
10
  s.files = `git ls-files`.split("\n")
11
11
  s.require_path = 'lib'
12
12
 
13
- s.add_development_dependency 'rake-compiler', '~> 1.1.0'
14
- s.add_development_dependency 'minitest', '>= 5'
15
- s.add_development_dependency 'openssl'
16
- s.add_development_dependency 'rdoc', '~> 3.12'
17
- s.add_development_dependency 'rake-compiler-dock', '~> 1.0.1'
13
+ s.add_development_dependency 'rake-compiler', '~> 1.2.5'
14
+ s.add_development_dependency 'minitest', '~> 5'
15
+ s.add_development_dependency 'openssl', '~> 3'
16
+ s.add_development_dependency 'rdoc', '~> 6'
17
+ s.add_development_dependency 'rake-compiler-dock', '~> 1.5.0'
18
18
 
19
- s.has_rdoc = true
20
19
  s.rdoc_options += ['--title', 'bcrypt_pbkdf', '--line-numbers', '--inline-source', '--main', 'README.md']
21
20
  s.extra_rdoc_files += ['README.md', 'COPYING', 'CHANGELOG.md', *Dir['lib/**/*.rb']]
22
21
 
@@ -15,6 +15,6 @@
15
15
  void
16
16
  explicit_bzero(void *p, size_t n)
17
17
  {
18
- bzero(p, n);
18
+ memset(p, 0, n);
19
19
  }
20
20
  #endif
data/ext/mri/includes.h CHANGED
@@ -4,7 +4,7 @@
4
4
  #include <stdint.h>
5
5
  #include <sys/types.h>
6
6
  #include <stdlib.h>
7
- #include <strings.h>
7
+ #include <string.h>
8
8
 
9
9
  #if defined(_WIN32) || (defined(__sun) && defined(__SVR4))
10
10
 
Binary file
Binary file
@@ -1,4 +1,5 @@
1
1
  require 'minitest/autorun'
2
+ require 'minitest/unit'
2
3
  require 'test_helper'
3
4
 
4
5
  # bcrypt_pbkdf in ruby
@@ -43,7 +44,7 @@ def bcrypt_pbkdf(password, salt, keylen, rounds)
43
44
 
44
45
  amt = [amt, remlen].min
45
46
  (0...amt).each do |i|
46
- dest = i * stride + (count -1)
47
+ dest = i * stride + (count - 1)
47
48
  key[dest] = out[i] if (dest < keylen)
48
49
  end
49
50
 
@@ -54,7 +55,7 @@ def bcrypt_pbkdf(password, salt, keylen, rounds)
54
55
  end
55
56
 
56
57
 
57
- class TestExt < MiniTest::Unit::TestCase
58
+ class TestExt < Minitest::Unit::TestCase
58
59
  def test_table
59
60
  assert_equal table, table.map{ |p,s,l,r| [p,s,l,r,BCryptPbkdf::Engine::__bc_crypt_pbkdf(p,s,l,r).bytes] }
60
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcrypt_pbkdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1.rc2
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Miklos Fazekas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-01 00:00:00.000000000 Z
11
+ date: 2024-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -16,70 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
19
+ version: 1.2.5
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.0
26
+ version: 1.2.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '5'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: openssl
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rdoc
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.12'
61
+ version: '6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.12'
68
+ version: '6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake-compiler-dock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.1
75
+ version: 1.5.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.1
82
+ version: 1.5.0
83
83
  description: " This gem implements bcrypt_pbkdf (a variant of PBKDF2 with bcrypt-based
84
84
  PRF)\n"
85
85
  email: mfazekas@szemafor.com
@@ -91,7 +91,8 @@ extra_rdoc_files:
91
91
  - CHANGELOG.md
92
92
  - lib/bcrypt_pbkdf.rb
93
93
  files:
94
- - ".travis.yml"
94
+ - ".github/workflows/ci.yml"
95
+ - ".gitignore"
95
96
  - CHANGELOG.md
96
97
  - COPYING
97
98
  - Gemfile
@@ -111,12 +112,8 @@ files:
111
112
  - ext/mri/sha2.h
112
113
  - ext/mri/util.h
113
114
  - ext/mri/utils.h
114
- - lib/2.2/bcrypt_pbkdf_ext.so
115
- - lib/2.3/bcrypt_pbkdf_ext.so
116
- - lib/2.4/bcrypt_pbkdf_ext.so
117
- - lib/2.5/bcrypt_pbkdf_ext.so
118
- - lib/2.6/bcrypt_pbkdf_ext.so
119
115
  - lib/2.7/bcrypt_pbkdf_ext.so
116
+ - lib/3.0/bcrypt_pbkdf_ext.so
120
117
  - lib/bcrypt_pbkdf.rb
121
118
  - test/bcrypt_pnkdf/engine_test.rb
122
119
  - test/test_helper.rb
@@ -138,17 +135,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
135
  requirements:
139
136
  - - ">="
140
137
  - !ruby/object:Gem::Version
141
- version: '2.0'
138
+ version: '2.7'
142
139
  - - "<"
143
140
  - !ruby/object:Gem::Version
144
141
  version: 3.1.dev
145
142
  required_rubygems_version: !ruby/object:Gem::Requirement
146
143
  requirements:
147
- - - ">="
144
+ - - ">"
148
145
  - !ruby/object:Gem::Version
149
- version: '0'
146
+ version: 1.3.1
150
147
  requirements: []
151
- rubygems_version: 3.1.2
148
+ rubygems_version: 3.3.26
152
149
  signing_key:
153
150
  specification_version: 4
154
151
  summary: OpenBSD's bcrypt_pbkdf (a variant of PBKDF2 with bcrypt-based PRF)
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- arch:
3
- - amd64
4
- - ppc64le
5
- rvm:
6
- - 2.3.0
7
- - 2.4.0
8
- - 2.5.0
9
- - 2.6.0
10
- - 2.7.0
11
- script: bundle exec rake
Binary file
Binary file
Binary file
Binary file
Binary file