mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-17 11:04:10 -04:00
dev-libs/lsbcrypt: fix to install the built lib
* Drop superfluous eclasses * Add the public-domain license * Patch tests to abort on failure * Actually install the compiled lib in src_install Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
This commit is contained in:
1
dev-libs/lsbcrypt/Manifest
Normal file
1
dev-libs/lsbcrypt/Manifest
Normal file
@@ -0,0 +1 @@
|
||||
DIST lsbcrypt-1.0.0.gh.tar.gz 35444 BLAKE2B b179a4d117aa90520f91432feecae0c94bda91024a349c6b3efc88aa8fedd9f0e9ba285fb2d0b5b45ec6ee28189a118f1785c7afd3375b64cbdb0f6ed392339b SHA512 7304acb02031fe2d7aaa667179b0539b30570750676c8474ea662a5505cf1b9f09d29e2927d15996fa1ee5c181f9c9aea54137b48252f82430b75a3d5e36d80b
|
||||
55
dev-libs/lsbcrypt/files/1.0.0-fix-tests.patch
Normal file
55
dev-libs/lsbcrypt/files/1.0.0-fix-tests.patch
Normal file
@@ -0,0 +1,55 @@
|
||||
Extend pre-computed hash{1,2} by 3 bytes each to BCRYPT_HASHSIZE = 64 bytes.
|
||||
bcrypt_hashpw expects the second and third argument to have room for at least
|
||||
many characters.
|
||||
Though this is probably not an issue in production, I have contacted upstream
|
||||
about it on 2023-07-02 at <info@litespeedtech.com>.
|
||||
|
||||
Additionally, abort execution of test runner on failure for "die" to trigger.
|
||||
|
||||
Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
|
||||
diff --git a/bcrypt.c b/bcrypt.c
|
||||
index bd8722b..0c230f2 100644
|
||||
--- a/bcrypt.c
|
||||
+++ b/bcrypt.c
|
||||
@@ -155,8 +155,8 @@ int main(void)
|
||||
int ret;
|
||||
|
||||
const char pass[] = "hi,mom";
|
||||
- const char hash1[] = "$2a$10$VEVmGHy4F4XQMJ3eOZJAUeb.MedU0W10pTPCuf53eHdKJPiSE8sMK";
|
||||
- const char hash2[] = "$2a$10$3F0BVk5t8/aoS.3ddaB3l.fxg5qvafQ9NybxcpXLzMeAt.nVWn.NO";
|
||||
+ const char hash1[] = "$2a$10$VEVmGHy4F4XQMJ3eOZJAUeb.MedU0W10pTPCuf53eHdKJPiSE8sMK\0\0\0";
|
||||
+ const char hash2[] = "$2a$10$3F0BVk5t8/aoS.3ddaB3l.fxg5qvafQ9NybxcpXLzMeAt.nVWn.NO\0\0\0";
|
||||
|
||||
ret = bcrypt_gensalt(12, salt);
|
||||
assert(ret == 0);
|
||||
@@ -171,22 +171,26 @@ int main(void)
|
||||
|
||||
ret = bcrypt_hashpw(pass, hash1, hash);
|
||||
assert(ret == 0);
|
||||
- printf("First hash check: %s\n", (strcmp(hash1, hash) == 0)?"OK":"FAIL");
|
||||
+ assert(strcmp(hash1, hash) == 0);
|
||||
+ printf("First hash check: OK\n");
|
||||
ret = bcrypt_hashpw(pass, hash2, hash);
|
||||
assert(ret == 0);
|
||||
- printf("Second hash check: %s\n", (strcmp(hash2, hash) == 0)?"OK":"FAIL");
|
||||
+ assert(strcmp(hash2, hash) == 0);
|
||||
+ printf("Second hash check: OK\n");
|
||||
|
||||
before = clock();
|
||||
ret = (bcrypt_checkpw(pass, hash1) == 0);
|
||||
after = clock();
|
||||
- printf("First hash check with bcrypt_checkpw: %s\n", ret?"OK":"FAIL");
|
||||
+ assert(ret == 1);
|
||||
+ printf("First hash check with bcrypt_checkpw: OK\n");
|
||||
printf("Time taken: %f seconds\n",
|
||||
(double)(after - before) / CLOCKS_PER_SEC);
|
||||
|
||||
before = clock();
|
||||
ret = (bcrypt_checkpw(pass, hash2) == 0);
|
||||
after = clock();
|
||||
- printf("Second hash check with bcrypt_checkpw: %s\n", ret?"OK":"FAIL");
|
||||
+ assert(ret == 1);
|
||||
+ printf("Second hash check with bcrypt_checkpw: OK\n");
|
||||
printf("Time taken: %f seconds\n",
|
||||
(double)(after - before) / CLOCKS_PER_SEC);
|
||||
|
||||
28
dev-libs/lsbcrypt/lsbcrypt-1.0.0-r1.ebuild
Normal file
28
dev-libs/lsbcrypt/lsbcrypt-1.0.0-r1.ebuild
Normal file
@@ -0,0 +1,28 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
COMMIT="55ff64349dec3012cfbbb1c4f92d4dbd46920213"
|
||||
DESCRIPTION="libcrypt wrapper for LiteSpeedTech"
|
||||
HOMEPAGE="https://github.com/litespeedtech/libbcrypt/"
|
||||
SRC_URI="https://github.com/litespeedtech/libbcrypt/archive/${COMMIT}.tar.gz -> ${P}.gh.tar.gz"
|
||||
LICENSE="CC0-1.0 public-domain"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
|
||||
S="${WORKDIR}/libbcrypt-${COMMIT}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PV}-fix-tests.patch
|
||||
)
|
||||
|
||||
src_test() {
|
||||
default
|
||||
./bcrypt_test || die "Tests failed!"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
newlib.a bcrypt.a libbcrypt.a
|
||||
einstalldocs
|
||||
}
|
||||
Reference in New Issue
Block a user