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 support for openssl 3 #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Verify

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
actions: none
checks: none
contents: none
deployments: none
id-token: none
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30

strategy:
fail-fast: true
matrix:
ruby:
- 2.6
- 2.7
- 3.0
- 3.1
os:
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-22.04
exclude:
- { os: ubuntu-22.04, ruby: 2.6 }
- { os: ubuntu-22.04, ruby: 2.7 }
- { os: ubuntu-22.04, ruby: 3.0 }
test_cmd:
- bundle exec rake test

name: ${{ matrix.os }} - Ruby ${{ matrix.ruby }} - ${{ matrix.test_cmd }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: ${{ matrix.test_cmd }}
run: |
echo "${CMD}"
bash -c "${CMD}"
env:
CMD: ${{ matrix.test_cmd }}
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ gem 'rake', '>=12.3.2'
gem 'rdoc', '>=4.3.0'
gem 'yard', '>=0.9.16'
gem 'rubocop', '>=0.50.0'
gem 'test-unit', '>=3.2.9'
gem 'coveralls', '>=0.8.22'
gem 'test-unit', '>=3.5.3'
26 changes: 4 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.0)
coveralls (0.8.22)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
term-ansicolor (~> 1.3)
thor (~> 0.19.4)
tins (~> 1.6)
docile (1.3.1)
json (2.1.0)
parallel (1.12.1)
parser (2.5.3.0)
ast (~> 2.4.0)
power_assert (1.1.3)
power_assert (2.0.1)
powerpack (0.1.2)
rainbow (2.2.2)
rake
Expand All @@ -27,30 +19,20 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.10.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
term-ansicolor (1.7.0)
tins (~> 1.0)
test-unit (3.2.9)
test-unit (3.5.3)
power_assert
thor (0.19.4)
tins (1.20.2)
unicode-display_width (1.4.1)
yard (0.9.16)

PLATFORMS
ruby

DEPENDENCIES
coveralls (>= 0.8.22)
rake (>= 12.3.2)
rdoc (>= 4.3.0)
rubocop (>= 0.50.0)
test-unit (>= 3.2.9)
test-unit (>= 3.5.3)
yard (>= 0.9.16)

BUNDLED WITH
1.17.1
2.2.22
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![Gem Version](https://badge.fury.io/rb/openssl-ccm.png)](http://badge.fury.io/rb/openssl-ccm)
[![Dependency Status](https://gemnasium.com/SmallLars/openssl-ccm.png)](https://gemnasium.com/SmallLars/openssl-ccm)
[![Build Status](https://travis-ci.org/SmallLars/openssl-ccm.png?branch=master)](https://travis-ci.org/SmallLars/openssl-ccm)
[![Coverage Status](https://coveralls.io/repos/SmallLars/openssl-ccm/badge.png?branch=master)](https://coveralls.io/r/SmallLars/openssl-ccm)
[![Code Climate](https://codeclimate.com/github/SmallLars/openssl-ccm.png)](https://codeclimate.com/github/SmallLars/openssl-ccm)
[![Inline docs](http://inch-ci.org/github/smalllars/openssl-ccm.png)](http://inch-ci.org/github/smalllars/openssl-ccm)

Expand Down
2 changes: 2 additions & 0 deletions lib/openssl/ccm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def mac(data, nonce, additional_data)
@cipher.reset
@cipher.encrypt
@cipher.key = @key
@cipher.iv = "\x00" * 16
Copy link
Contributor Author

@adfoster-r7 adfoster-r7 Jul 20, 2022

Choose a reason for hiding this comment

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

I can't tell if this is a regression in OpenSSL's reset function or intentional behavior, but it's required to have the tests passing with OpenSSL 3.0 on Ubuntu 22.04 though


b_0 = Array.new(8, 0)
b_0[0] = (additional_data.empty? ? 0 : 64) \
Expand Down Expand Up @@ -164,6 +165,7 @@ def get_counter(nonce, index)
@cipher.reset
@cipher.encrypt
@cipher.key = @key
@cipher.iv = "\x00" * 16
@cipher.update(a.pack('C*'))
end
end
Expand Down
5 changes: 2 additions & 3 deletions openssl-ccm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ Gem::Specification.new do |s|
s.post_install_message = "Thanks for installing!"

s.files = Dir.glob('lib/openssl/*.rb') +
Dir.glob("lib/openssl/ccm/*.rb") +
Dir.glob("lib/openssl/ccm/*.rb") +
['Gemfile', 'Rakefile', '.rubocop.yml', '.yardopts']
s.test_files = Dir.glob('test/test_*.rb') + Dir.glob('test/data_*')

s.add_development_dependency 'rake', '~> 12.3', '>= 12.3.2'
s.add_development_dependency 'rdoc', '~> 4.3', '>= 4.3.0'
s.add_development_dependency 'yard', '~> 0.9', '>= 0.9.16'
s.add_development_dependency 'rubocop', '~> 0.50', '>= 0.50.0'
s.add_development_dependency 'test-unit', '~> 3.2', '>=3.2.9'
s.add_development_dependency 'coveralls', '~> 0.8', '>= 0.8.22'
s.add_development_dependency 'test-unit', '~> 3.5', '>=3.5.3'

s.rdoc_options += ['-x', 'test/data_*']
s.extra_rdoc_files = ['README.md', 'LICENSE']
Expand Down
2 changes: 0 additions & 2 deletions test/test_ccm.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'coveralls'
Coveralls.wear!
require 'test/unit'
require 'openssl/ccm'

Expand Down