From eabd19ce98879d65891a1c42f86c353a53f03f7c Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Thu, 28 Dec 2023 22:03:55 +0100 Subject: [PATCH 1/5] Upgrade fast_pdkdf --- rebar.config | 4 +++- rebar.lock | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rebar.config b/rebar.config index 1539d1c..9ce5bfa 100644 --- a/rebar.config +++ b/rebar.config @@ -1,6 +1,8 @@ {erl_opts, []}. -{deps, [{fast_pbkdf2, "1.0.3"}]}. +{deps, [ + {fast_pbkdf2, "1.0.5"} +]}. {plugins, [rebar3_hex]}. {profiles, [ diff --git a/rebar.lock b/rebar.lock index 511b258..9ed2a73 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,8 +1,8 @@ {"1.2.0", -[{<<"fast_pbkdf2">>,{pkg,<<"fast_pbkdf2">>,<<"1.0.3">>},0}]}. +[{<<"fast_pbkdf2">>,{pkg,<<"fast_pbkdf2">>,<<"1.0.5">>},0}]}. [ {pkg_hash,[ - {<<"fast_pbkdf2">>, <<"4F09D6C6C20DBEE1970E0A6AE91432E1B7731F88426C671D083BAC31FFA1FDAD">>}]}, + {<<"fast_pbkdf2">>, <<"6045138C4C209FC8222A0B18B2CB1D7BD7407EF4ADAD0F14C5E0F7F4726E3E41">>}]}, {pkg_hash_ext,[ - {<<"fast_pbkdf2">>, <<"2900431E2E6402F23A92754448BBD949DA366BC9C984FDC791DDCFCC41042434">>}]} + {<<"fast_pbkdf2">>, <<"BC3B5A3CAB47AD114FF8BB815FEDE62A6187ACD14D8B37412F2AF8236A089CEF">>}]} ]. From c2f9df95d3569e946c647b76d9c8e7334bd355b5 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Thu, 28 Dec 2023 22:29:06 +0100 Subject: [PATCH 2/5] Update docs to new version --- rebar.config | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/rebar.config b/rebar.config index 9ce5bfa..d559f96 100644 --- a/rebar.config +++ b/rebar.config @@ -3,7 +3,12 @@ {deps, [ {fast_pbkdf2, "1.0.5"} ]}. -{plugins, [rebar3_hex]}. + +{project_plugins, [ + rebar3_hex, + rebar3_ex_doc +]}. + {profiles, [ {test, [ @@ -13,8 +18,10 @@ {base16, "2.0.1"} ]}, {plugins, [ - {rebar3_codecov, "0.4.0"} - ]} + {rebar3_codecov, "0.6.0"} + ]}, + {cover_enabled, true}, + {cover_export_enabled, true} ]}, {prod, [ {erl_opts, [inline_list_funcs, deterministic]} @@ -22,5 +29,11 @@ ] }. -{cover_enabled, true}. -{cover_export_enabled, true}. +{hex, [ + {doc, #{provider => ex_doc}} +]}. +{ex_doc, [ + {source_url, <<"https://github.com/esl/fast_scram">>}, + {extras, [<<"README.md">>, <<"LICENSE">>]}, + {main, <<"readme">>} +]}. From 66dc569a438f0d0e9a0c160e80b69cf01bb033a5 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Thu, 28 Dec 2023 22:29:44 +0100 Subject: [PATCH 3/5] Update CI scripts --- .github/workflows/ci.yml | 33 +++++++++++++++++---------------- Makefile | 36 ------------------------------------ 2 files changed, 17 insertions(+), 52 deletions(-) delete mode 100644 Makefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e94ddd2..3066641 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,23 +12,24 @@ jobs: name: OTP ${{matrix.otp}} strategy: matrix: - otp: ['24.0', '23.3', '22.3', '21.3'] - runs-on: 'ubuntu-20.04' + otp: ['26.2', '25.3', '24.3'] + rebar3: ['3.22.1'] + runs-on: 'ubuntu-22.04' env: OTPVER: ${{ matrix.otp }} steps: - - uses: actions/checkout@v2 - - uses: ErlGang/setup-erlang@v1.0.0 + - uses: actions/checkout@v3 + - uses: erlef/setup-beam@v1 with: - otp-version: ${{ matrix.otp }} - - run: make rebar3 - - run: make - - run: make test - - run: make dialyzer - if: ${{ matrix.otp == '24.0' }} - - run: make codecov - if: ${{ matrix.otp == '24.0' }} - - run: pip install --user codecov - if: ${{ matrix.otp == '24.0' }} - - run: /home/runner/.local/bin/codecov - if: ${{ matrix.otp == '24.0' }} + otp-version: ${{matrix.otp}} + rebar3-version: ${{matrix.rebar3}} + - run: rebar3 do ct --cover + - run: rebar3 as test codecov analyze + - run: rebar3 dialyzer + if: ${{ matrix.otp == '26.2' }} + - uses: codecov/codecov-action@v3 + name: Upload coverage reports to Codecov + if: ${{ matrix.otp == '26.2' }} + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true # optional (default = false) diff --git a/Makefile b/Makefile deleted file mode 100644 index 246c763..0000000 --- a/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -.PHONY: rel deps test - -REBARVER = 3.13.2 -ifeq ($(OTPVER),24.0) - REBARVER = 3.15.1 -endif - -all: deps compile - -compile: rebar3 - ./rebar3 compile - -deps: rebar3 - ./rebar3 get-deps - -clean: rebar3 - ./rebar3 clean - -test-deps: rebar3 - ./rebar3 get-deps - -test-compile: rebar3 test-deps - ./rebar3 compile - -test: test-compile - ./rebar3 ct - -codecov: _build/test/cover/ct.coverdata - ./rebar3 as test codecov analyze - -rebar3: - wget https://github.com/erlang/rebar3/releases/download/${REBARVER}/rebar3 &&\ - chmod u+x rebar3 - -dialyzer: rebar3 - ./rebar3 dialyzer From c8a233d7b7a92f3fcdef52762e5464366befd376 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Thu, 28 Dec 2023 22:30:54 +0100 Subject: [PATCH 4/5] Unify duplicated call to pbkdf2 --- src/fast_scram.erl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/fast_scram.erl b/src/fast_scram.erl index cd161a7..fc336fe 100644 --- a/src/fast_scram.erl +++ b/src/fast_scram.erl @@ -327,10 +327,6 @@ server_key(Sha, SaltedPassword) -> server_signature(Sha, ServerKey, AuthMessage) -> fast_scram_definitions:server_signature(Sha, ServerKey, AuthMessage). -%%%=================================================================== -%%% NIF -%%%=================================================================== -spec hi(sha_type(), binary(), binary(), non_neg_integer()) -> binary(). -hi(Hash, Password, Salt, IterationCount) - when ?is_valid_hash(Hash), is_binary(Password), is_binary(Salt), ?is_positive_integer(IterationCount) -> - fast_pbkdf2:pbkdf2(Hash, Password, Salt, IterationCount). +hi(Hash, Password, Salt, IterationCount) -> + fast_scram_definitions:salted_password(Hash, Password, Salt, IterationCount). From 26af7022796b8fb2ebd277275df68d6771b37725 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Thu, 28 Dec 2023 22:33:34 +0100 Subject: [PATCH 5/5] Update version in the readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3fa24de..70eee0c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ [{compile, {pc, compile}}, {clean, {pc, clean}}]}]}. {deps, - [{fast_scram, {git, "https://github.com/esl/fast_scram.git", {branch, "master"}}}]}. + [{fast_scram, "0.6.0"}]}. ``` ## Using