Skip to content

Commit fa2ec78

Browse files
committed
alvistack/4.1.1
git clean -xdf mkdir -p .cargo cargo vendor --manifest-path ./src/_bcrypt/Cargo.toml > .cargo/config.toml tar zcvf ../python-bcrypt_4.1.1.orig.tar.gz --exclude=.git . debuild -uc -us cp python-bcrypt.spec ../python-bcrypt_4.1.1-1.spec cp ../python*-bcrypt*4.1.1*.{gz,xz,spec,dsc} /osc/home\:alvistack/pyca-bcrypt-4.1.1/ rm -rf ../python*-bcrypt*4.1.1*.* See pyca#695 See pyca#714 Signed-off-by: Wong Hoi Sing Edison <[email protected]>
1 parent 7881c5b commit fa2ec78

17 files changed

+207
-52
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ pip-log.txt
2727

2828
#Translations
2929
*.mo
30+
31+
.cargo/
32+
vendor/
33+
.pybuild/

debian/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.substvars
2+
*debhelper*
3+
.debhelper
4+
files
5+
python3-bcrypt
6+
tmp

debian/changelog

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
python-bcrypt (100:4.1.1-1) UNRELEASED; urgency=medium
2+
3+
* https://github.com/pyca/bcrypt/releases/tag/4.1.1
4+
5+
-- Wong Hoi Sing Edison <[email protected]> Mon, 01 Jan 2024 17:59:55 +0800

debian/control

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Source: python-bcrypt
2+
Section: python
3+
Priority: optional
4+
Standards-Version: 4.5.0
5+
Maintainer: Wong Hoi Sing Edison <[email protected]>
6+
Homepage: https://github.com/pyca/bcrypt/tags
7+
Vcs-Browser: https://github.com/alvistack/pyca-bcrypt
8+
Vcs-Git: https://github.com/alvistack/pyca-bcrypt.git
9+
Build-Depends:
10+
cargo,
11+
cython3,
12+
debhelper,
13+
debhelper-compat (= 10),
14+
dh-python,
15+
fdupes,
16+
python3-dev,
17+
python3-pycparser,
18+
python3-setuptools (>= 42.0.0),
19+
python3-setuptools-rust (>= 0.11.4),
20+
rustc (>= 1.64.0),
21+
22+
Package: python3-bcrypt
23+
Architecture: amd64
24+
Description: Modern(-ish) password hashing for your software and your servers
25+
Good password hashing for your software and your servers.
26+
Depends:
27+
${misc:Depends},
28+
${shlibs:Depends},
29+
${python3:Depends},
30+
python3,

debian/copyright

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
3+
Files: debian/*
4+
Copyright: 2024 Wong Hoi Sing Edison <[email protected]>
5+
License: Apache-2.0
6+
7+
License: Apache-2.0
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
.
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
.
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
.
20+
The complete text of the Apache version 2.0 license
21+
can be found in "/usr/share/common-licenses/Apache-2.0".

debian/python3-bcrypt.install

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
usr/lib/python*/*-packages/*
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
python3-bcrypt: copyright-without-copyright-notice
2+
python3-bcrypt: initial-upload-closes-no-bugs
3+
python3-bcrypt: no-manual-page
4+
python3-bcrypt: zero-byte-file-in-doc-directory

debian/rules

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/make -f
2+
3+
SHELL := /bin/bash
4+
5+
override_dh_auto_install:
6+
dh_auto_install --destdir=debian/tmp
7+
find debian/tmp/usr/lib/python*/*-packages -type f -name '*.pyc' -exec rm -rf {} \;
8+
fdupes -qnrps debian/tmp/usr/lib/python*/*-packages
9+
10+
override_dh_auto_test:
11+
12+
override_dh_auto_clean:
13+
14+
%:
15+
dh $@ --buildsystem=pybuild --with python3

debian/source/format

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (quilt)

debian/source/lintian-overrides

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
python-bcrypt source: file-without-copyright-information
2+
python-bcrypt source: no-debian-changes
3+
python-bcrypt source: source-contains-prebuilt-windows-binary
4+
python-bcrypt source: source-package-encodes-python-version
5+
python-bcrypt source: unpack-message-for-orig

python-bcrypt.spec

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Copyright 2024 Wong Hoi Sing Edison <[email protected]>
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
%global debug_package %{nil}
16+
17+
%global source_date_epoch_from_changelog 0
18+
19+
Name: python-bcrypt
20+
Epoch: 100
21+
Version: 4.1.1
22+
Release: 1%{?dist}
23+
Summary: Modern(-ish) password hashing for your software and your servers
24+
License: Apache-2.0
25+
URL: https://github.com/pyca/bcrypt/tags
26+
Source0: %{name}_%{version}.orig.tar.gz
27+
BuildRequires: cargo
28+
BuildRequires: fdupes
29+
BuildRequires: gcc
30+
BuildRequires: python-rpm-macros
31+
BuildRequires: python3-Cython3
32+
BuildRequires: python3-devel
33+
BuildRequires: python3-pycparser
34+
BuildRequires: python3-setuptools >= 42.0.0
35+
BuildRequires: python3-setuptools-rust >= 0.11.4
36+
BuildRequires: rust >= 1.64.0
37+
38+
%description
39+
Good password hashing for your software and your servers.
40+
41+
%prep
42+
%autosetup -T -c -n %{name}_%{version}-%{release}
43+
tar -zx -f %{S:0} --strip-components=1 -C .
44+
45+
%build
46+
%py3_build
47+
48+
%install
49+
%py3_install
50+
find %{buildroot}%{python3_sitearch} -type f -name '*.pyc' -exec rm -rf {} \;
51+
fdupes -qnrps %{buildroot}%{python3_sitearch}
52+
53+
%check
54+
55+
%if 0%{?suse_version} > 1500
56+
%package -n python%{python3_version_nodots}-bcrypt
57+
Summary: Modern(-ish) password hashing for your software and your servers
58+
Requires: python3
59+
Provides: python3-bcrypt = %{epoch}:%{version}-%{release}
60+
Provides: python3dist(bcrypt) = %{epoch}:%{version}-%{release}
61+
Provides: python%{python3_version}-bcrypt = %{epoch}:%{version}-%{release}
62+
Provides: python%{python3_version}dist(bcrypt) = %{epoch}:%{version}-%{release}
63+
Provides: python%{python3_version_nodots}-bcrypt = %{epoch}:%{version}-%{release}
64+
Provides: python%{python3_version_nodots}dist(bcrypt) = %{epoch}:%{version}-%{release}
65+
66+
%description -n python%{python3_version_nodots}-bcrypt
67+
Good password hashing for your software and your servers.
68+
69+
%files -n python%{python3_version_nodots}-bcrypt
70+
%license LICENSE
71+
%{python3_sitearch}/*
72+
%endif
73+
74+
%if !(0%{?suse_version} > 1500)
75+
%package -n python3-bcrypt
76+
Summary: Modern(-ish) password hashing for your software and your servers
77+
Requires: python3
78+
Provides: python3-bcrypt = %{epoch}:%{version}-%{release}
79+
Provides: python3dist(bcrypt) = %{epoch}:%{version}-%{release}
80+
Provides: python%{python3_version}-bcrypt = %{epoch}:%{version}-%{release}
81+
Provides: python%{python3_version}dist(bcrypt) = %{epoch}:%{version}-%{release}
82+
Provides: python%{python3_version_nodots}-bcrypt = %{epoch}:%{version}-%{release}
83+
Provides: python%{python3_version_nodots}dist(bcrypt) = %{epoch}:%{version}-%{release}
84+
85+
%description -n python3-bcrypt
86+
Good password hashing for your software and your servers.
87+
88+
%files -n python3-bcrypt
89+
%license LICENSE
90+
%{python3_sitearch}/*
91+
%endif
92+
93+
%changelog

setup.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[egg_info]
2+
tag_build =
3+
tag_date = 0
4+

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
RustExtension(
3838
"bcrypt._bcrypt",
3939
"src/_bcrypt/Cargo.toml",
40-
py_limited_api=True,
40+
py_limited_api="auto",
4141
rust_version=(
4242
">=1.64.0"
4343
if os.environ.get("BCRYPT_ALLOW_RUST_163", "0") != "0"

src/_bcrypt/Cargo.lock

+16-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/_bcrypt/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66
publish = false
77

88
[dependencies]
9-
pyo3 = { version = "0.20.0", features = ["abi3-py37"] }
9+
pyo3 = { version = "0.16.6", features = ["abi3"] }
1010
bcrypt = "0.15"
1111
bcrypt-pbkdf = "0.10.0"
1212
base64 = "0.21.5"

src/_bcrypt/src/lib.rs

-12
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,6 @@ fn kdf<'p>(
151151
));
152152
}
153153

154-
if rounds < 50 && !ignore_few_rounds {
155-
// They probably think bcrypt.kdf()'s rounds parameter is logarithmic,
156-
// expecting this value to be slow enough (it probably would be if this
157-
// were bcrypt). Emit a warning.
158-
pyo3::PyErr::warn(
159-
py,
160-
pyo3::exceptions::PyUserWarning::type_object(py),
161-
&format!("Warning: bcrypt.kdf() called with only {rounds} round(s). This few is not secure: the parameter is linear, like PBKDF2."),
162-
3
163-
)?;
164-
}
165-
166154
pyo3::types::PyBytes::new_with(py, desired_key_bytes, |output| {
167155
py.allow_threads(|| {
168156
bcrypt_pbkdf::bcrypt_pbkdf(password, salt, rounds, output).unwrap();

tests/test_bcrypt.py

-5
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,6 @@ def test_kdf_no_warn_rounds():
462462
bcrypt.kdf(b"password", b"salt", 10, 10, True)
463463

464464

465-
def test_kdf_warn_rounds():
466-
with pytest.warns(UserWarning):
467-
bcrypt.kdf(b"password", b"salt", 10, 10)
468-
469-
470465
@pytest.mark.parametrize(
471466
("password", "salt", "desired_key_bytes", "rounds", "error"),
472467
[

0 commit comments

Comments
 (0)