Description: Autogenerated patch header for a single-debian-patch file. The delta against upstream is either kept as a single patch, or maintained in some VCS, and exported as a single patch instead of more manageable atomic patches. Forwarded: not-needed --- --- /dev/null +++ scrypt-1.3.3/.autom4te.cfg @@ -0,0 +1,7 @@ +## ------------------ ## +## User Preferences. ## +## ------------------ ## + +begin-language: "Autoconf-without-aclocal-m4" +args: --no-cache +end-language: "Autoconf-without-aclocal-m4" --- /dev/null +++ scrypt-1.3.3/.github/workflows/compile.yml @@ -0,0 +1,114 @@ +name: Compile & test + +# Run whenever we push to any branch without a "/", other than [coverity-scan]. +on: + push: + branches: + - '*' + - '!coverity-scan' + +env: + # Shared variables amongst all projects / platforms / compilers. + CFLAGS_ALL: -std=c99 -O2 + CFLAGS_CLANG_LIBCPERCIVA: -Wall -Wextra -Werror -Weverything + -Wno-#warnings -Wno-pedantic -Wno-padded + -Wno-format-nonliteral + -Wno-disabled-macro-expansion + -Wno-missing-noreturn + -Wno-unused-macros + -Wno-documentation-unknown-command + -Wno-implicit-fallthrough + CFLAGS_GCC_LIBCPERCIVA: -Wall -Wextra -Werror -Wpedantic + -pedantic-errors -Wno-clobbered + # Variables for specific projects / platforms / compilers. + CFLAGS_CLANG_PROJECT: -Wno-reserved-id-macro + CFLAGS_GCC_PROJECT: -Wno-cpp + CFLAGS_OSX: -Wno-poison-system-directories + -Wno-deprecated-declarations + LDFLAGS_OSX: + +jobs: + Ubuntu: + name: Ubuntu + runs-on: ubuntu-20.04 + steps: + - name: Update apt-get + run: sudo apt-get update + - name: Install software + run: sudo apt-get install --no-install-recommends + valgrind autoconf-archive + - name: Checkout code + uses: actions/checkout@v4 + - name: Run autoreconf + run: + autoreconf -i + - name: Configure with clang + env: + CC: clang-10 + CFLAGS: ${{ env.CFLAGS_ALL }} + run: ./configure + - name: Compile with clang + env: + CC: clang-10 + CFLAGS: ${{ env.CFLAGS_ALL }} + ${{ env.CFLAGS_CLANG_LIBCPERCIVA }} + ${{ env.CFLAGS_CLANG_PROJECT }} + # make(1) doesn't automatically override the CFLAGS macro set inside + # Makefile with the environment variable. + run: make CFLAGS="${{ env.CFLAGS }}" + - name: Test clang binaries + env: + USE_VALGRIND: 1 + run: make test VERBOSE=1 + - name: Clean + run: make clean + - name: Configure with gcc + env: + CC: gcc-10 + CFLAGS: ${{ env.CFLAGS_ALL }} + run: ./configure + - name: Compile with gcc + env: + CC: gcc-10 + CFLAGS: ${{ env.CFLAGS_ALL }} + ${{ env.CFLAGS_GCC_LIBCPERCIVA }} + ${{ env.CFLAGS_GCC_PROJECT }} + # make(1) doesn't automatically override the CFLAGS macro set inside + # Makefile with the environment variable. + run: make CFLAGS="${{ env.CFLAGS }}" + - name: Test gcc binaries + env: + USE_VALGRIND: 1 + run: make test VERBOSE=1 + - name: Check for untracked files + run: test -z "$(git status --porcelain=v1)" + macOS: + name: macOS + runs-on: macOS-13 + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install software + run: brew install automake + - name: Run autoreconf + run: autoreconf -i + - name: Configure with clang + env: + CC: clang + CFLAGS: ${{ env.CFLAGS_ALL }} + ${{ env.CFLAGS_OSX }} + LDFLAGS: ${{ env.LDFLAGS_OSX }} + run: ./configure + - name: Compile with clang + env: + CC: clang + CFLAGS: ${{ env.CFLAGS_ALL }} + ${{ env.CFLAGS_CLANG_LIBCPERCIVA }} + ${{ env.CFLAGS_CLANG_PROJECT }} + ${{ env.CFLAGS_OSX }} + LDFLAGS: ${{ env.LDFLAGS_OSX }} + # make(1) doesn't automatically override the CFLAGS macro set inside + # Makefile with the environment variable. + run: make CFLAGS="${{ env.CFLAGS }}" + - name: Test clang binaries + run: make test VERBOSE=1 --- /dev/null +++ scrypt-1.3.3/.github/workflows/coverity-scan.yml @@ -0,0 +1,29 @@ +name: coverity-scan + +# Only trigger on the [coverity-scan] branch. +on: + push: + branches: + - coverity-scan + +# Run coverity scan. For now, we're re-using the Travis-CI script, which +# requires us to fake a TRAVIS_BRANCH environment variable. +jobs: + coverity-scan: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run autoreconf + run: autoreconf -i + - name: Configure with the default compiler + run: ./configure + - name: Coverity scan + env: + COVERITY_SCAN_PROJECT_NAME: ${{ github.repository }} + COVERITY_SCAN_BRANCH_PATTERN: coverity-scan + COVERITY_SCAN_NOTIFICATION_EMAIL: cperciva@tarsnap.com + COVERITY_SCAN_BUILD_COMMAND: make all + COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + TRAVIS_BRANCH: coverity-scan + run: curl -s "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" | bash || true --- /dev/null +++ scrypt-1.3.3/Makefile.am @@ -0,0 +1,297 @@ +bin_PROGRAMS= scrypt +noinst_PROGRAMS= \ + tests/valgrind/potential-memleaks \ + tests/verify-strings/test_scrypt +dist_man_MANS=$(scrypt_man_MANS) +ACLOCAL_AMFLAGS= -I m4 + +# These files fulfill the crypto_scrypt() function, with the exception of +# libcperciva/alg/sha256_shani.c +# lib/crypto/crypto_scrypt_smix_sse2.c +# which require special compiler flags and are thus compiled as separate +# libraries. See test_scrypt for an example. +crypto_scrypt_files= \ + lib-platform/crypto/crypto_scrypt.c \ + lib-platform/crypto/crypto_scrypt.h \ + lib-platform/platform.h \ + lib/crypto/crypto_scrypt_smix.c \ + lib/crypto/crypto_scrypt_smix.h \ + lib/crypto/crypto_scrypt_smix_sse2.h \ + libcperciva/alg/sha256.c \ + libcperciva/alg/sha256.h \ + libcperciva/alg/sha256_arm.h \ + libcperciva/alg/sha256_shani.h \ + libcperciva/alg/sha256_sse2.h \ + libcperciva/cpusupport/cpusupport.h \ + libcperciva/util/insecure_memzero.c \ + libcperciva/util/insecure_memzero.h \ + libcperciva/util/warnp.c \ + libcperciva/util/warnp.h + +# Don't include crypto_aesctr_shared.c in this list, as it should be included +# directly into other translation unit(s), and not compiled on its own. +scrypt_SOURCES= \ + $(crypto_scrypt_files) \ + lib-platform/util/memlimit.h \ + lib/scryptenc/scryptenc.c \ + lib/scryptenc/scryptenc.h \ + lib/scryptenc/scryptenc_cpuperf.c \ + lib/scryptenc/scryptenc_cpuperf.h \ + lib/scryptenc/scryptenc_print_error.c \ + lib/scryptenc/scryptenc_print_error.h \ + lib/util/passphrase_entry.c \ + lib/util/passphrase_entry.h \ + libcperciva/crypto/crypto_aes.h \ + libcperciva/crypto/crypto_aes_aesni.h \ + libcperciva/crypto/crypto_aes_aesni_m128i.h \ + libcperciva/crypto/crypto_aes_arm.h \ + libcperciva/crypto/crypto_aes_arm_u8.h \ + libcperciva/crypto/crypto_aesctr.c \ + libcperciva/crypto/crypto_aesctr.h \ + libcperciva/crypto/crypto_aesctr_aesni.h \ + libcperciva/crypto/crypto_aesctr_arm.h \ + libcperciva/crypto/crypto_entropy.c \ + libcperciva/crypto/crypto_entropy.h \ + libcperciva/crypto/crypto_entropy_rdrand.h \ + libcperciva/crypto/crypto_verify_bytes.c \ + libcperciva/crypto/crypto_verify_bytes.h \ + libcperciva/util/align_ptr.h \ + libcperciva/util/asprintf.c \ + libcperciva/util/asprintf.h \ + libcperciva/util/entropy.c \ + libcperciva/util/entropy.h \ + libcperciva/util/getopt.c \ + libcperciva/util/getopt.h \ + libcperciva/util/humansize.c \ + libcperciva/util/humansize.h \ + libcperciva/util/monoclock.c \ + libcperciva/util/monoclock.h \ + libcperciva/util/parsenum.h \ + libcperciva/util/readpass.c \ + libcperciva/util/readpass.h \ + libcperciva/util/readpass_file.c \ + libcperciva/util/sysendian.h \ + main.c + +AM_CPPFLAGS= \ + -I$(srcdir)/lib \ + -I$(srcdir)/lib-platform \ + -I$(srcdir)/lib-platform/crypto \ + -I$(srcdir)/lib-platform/util \ + -I$(srcdir)/lib/crypto \ + -I$(srcdir)/lib/scryptenc \ + -I$(srcdir)/lib/util \ + -I$(srcdir)/libcperciva/alg \ + -I$(srcdir)/libcperciva/cpusupport \ + -I$(srcdir)/libcperciva/crypto \ + -I$(srcdir)/libcperciva/util \ + -DAPISUPPORT_CONFIG_FILE=\"apisupport-config.h\" \ + -DCPUSUPPORT_CONFIG_FILE=\"cpusupport-config.h\" \ + -D_POSIX_C_SOURCE=200809L \ + -D_XOPEN_SOURCE=700 \ + ${CFLAGS_POSIX} + +# Each "paragraph" denotes a rank of dependencies. Libraries without +# dependencies go in the bottom paragraph; a library which depends on one of +# those goes in the preceeding paragraph; and so on. +scrypt_LDADD= \ + libcperciva_crypto_aes.la \ + \ + libcperciva_aesni.la \ + libcperciva_arm_aes.la \ + libcperciva_arm_sha256.la \ + libcperciva_cpusupport_detect.la \ + libcperciva_rdrand.la \ + libcperciva_shani.la \ + libscrypt_memlimit.la \ + libscrypt_sse2.la \ + ${LDADD_POSIX} +scrypt_man_MANS= scrypt.1 + +# apisupport needs to access post-configure info: lib-platform/platform.h, +# config.h, and -DHAVE_CONFIG_H. +apisupport-config.h: + ( export CC="${CC}"; export CFLAGS="-I${top_srcdir}/lib-platform -I${builddir} ${DEFS} ${CFLAGS}"; command -p sh $(srcdir)/libcperciva/apisupport/Build/apisupport.sh "$$PATH") > apisupport-config.h.tmp && command -p mv apisupport-config.h.tmp apisupport-config.h +cpusupport-config.h: + ( export CC="${CC}"; export CFLAGS="${CFLAGS}"; command -p sh $(srcdir)/libcperciva/cpusupport/Build/cpusupport.sh "$$PATH") > cpusupport-config.h.tmp && command -p mv cpusupport-config.h.tmp cpusupport-config.h +BUILT_SOURCES= \ + apisupport-config.h \ + cpusupport-config.h +CLEANFILES= \ + apisupport-config.h \ + apisupport-config.h.tmp \ + cpusupport-config.h \ + cpusupport-config.h.tmp + +# Libraries from libcperciva code. +noinst_LTLIBRARIES= libcperciva_aesni.la +libcperciva_aesni_la_SOURCES= \ + libcperciva/crypto/crypto_aes_aesni.c \ + libcperciva/crypto/crypto_aesctr_aesni.c +nodist_libcperciva_aesni_la_SOURCES= cpusupport-config.h +libcperciva_aesni_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_X86_AESNI}` + +noinst_LTLIBRARIES+= libcperciva_arm_aes.la +libcperciva_arm_aes_la_SOURCES= \ + libcperciva/crypto/crypto_aes_arm.c \ + libcperciva/crypto/crypto_aesctr_arm.c +nodist_libcperciva_arm_aes_la_SOURCES= cpusupport-config.h +libcperciva_arm_aes_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_ARM_AES}` + +noinst_LTLIBRARIES+= libcperciva_rdrand.la +libcperciva_rdrand_la_SOURCES= libcperciva/crypto/crypto_entropy_rdrand.c +nodist_libcperciva_rdrand_la_SOURCES= cpusupport-config.h +libcperciva_rdrand_la_CFLAGS= \ + `. ./cpusupport-config.h; echo $${CFLAGS_X86_RDRAND}` + +noinst_LTLIBRARIES+= libcperciva_shani.la +libcperciva_shani_la_SOURCES= libcperciva/alg/sha256_shani.c +nodist_libcperciva_shani_la_SOURCES= cpusupport-config.h +libcperciva_shani_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_X86_SHANI} $${CFLAGS_X86_SSSE3}` + +noinst_LTLIBRARIES+= libcperciva_arm_sha256.la +libcperciva_arm_sha256_la_SOURCES= libcperciva/alg/sha256_arm.c +nodist_libcperciva_arm_sha256_la_SOURCES= cpusupport-config.h +libcperciva_arm_sha256_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_ARM_SHA256}` + +noinst_LTLIBRARIES+= libcperciva_crypto_aes.la +libcperciva_crypto_aes_la_SOURCES= libcperciva/crypto/crypto_aes.c +nodist_libcperciva_crypto_aes_la_SOURCES= cpusupport-config.h +libcperciva_crypto_aes_la_CFLAGS=`. ./apisupport-config.h; echo $${CFLAGS_LIBCRYPTO_LOW_LEVEL_AES}` + +noinst_LTLIBRARIES+= libcperciva_cpusupport_detect.la +libcperciva_cpusupport_detect_la_SOURCES= \ + libcperciva/cpusupport/cpusupport_arm_aes.c \ + libcperciva/cpusupport/cpusupport_arm_sha256.c \ + libcperciva/cpusupport/cpusupport_x86_aesni.c \ + libcperciva/cpusupport/cpusupport_x86_rdrand.c \ + libcperciva/cpusupport/cpusupport_x86_shani.c \ + libcperciva/cpusupport/cpusupport_x86_sse2.c \ + libcperciva/cpusupport/cpusupport_x86_ssse3.c +nodist_libcperciva_cpusupport_detect_la_SOURCES= cpusupport-config.h + + +# Library from libcperciva and scrypt code. +noinst_LTLIBRARIES+= libscrypt_sse2.la +libscrypt_sse2_la_SOURCES= \ + lib/crypto/crypto_scrypt_smix_sse2.c \ + libcperciva/alg/sha256_sse2.c +nodist_libscrypt_sse2_la_SOURCES= cpusupport-config.h +libscrypt_sse2_la_CFLAGS=`. ./cpusupport-config.h; echo $${CFLAGS_X86_SSE2}` + +# This library uses non-POSIX functionality, so we need to cancel the +# _POSIX_C_SOURCE and _XOPEN_SOURCE defined in AM_CPPFLAGS. +noinst_LTLIBRARIES+= libscrypt_memlimit.la +libscrypt_memlimit_la_SOURCES= \ + lib-platform/util/memlimit.c +libscrypt_memlimit_la_CFLAGS=`. ./apisupport-config.h; echo $${CFLAGS_NONPOSIX_MEMLIMIT}` + +# Install libscrypt-kdf? +if LIBSCRYPT_KDF +lib_LTLIBRARIES= libscrypt-kdf.la +libscrypt_kdf_la_LDFLAGS= \ + -export-symbols-regex 'crypto_scrypt$$' \ + -version-info 1 +include_HEADERS= libscrypt-kdf/scrypt-kdf.h +noinst_PROGRAMS+= tests/libscrypt-kdf/sample-libscrypt-kdf +else +# Allow the user to get a usable library even if they didn't run configure +# with --enable-libscrypt-kdf. If we didn't include this, they would get +# empty libraries if they ran `make libscrypt-kdf.la`. +EXTRA_LTLIBRARIES= libscrypt-kdf.la +endif + +# Shared definitions for libscrypt-kdf. +libscrypt_kdf_la_SOURCES= $(crypto_scrypt_files) +libscrypt_kdf_la_LIBADD= \ + libcperciva_arm_sha256.la \ + libcperciva_cpusupport_detect.la \ + libcperciva_shani.la \ + libscrypt_sse2.la +# Workaround for "created with both libtool and without". +libscrypt_kdf_la_CFLAGS= $(AM_CFLAGS) + +# Test libscrypt-kdf compile. +tests_libscrypt_kdf_sample_libscrypt_kdf_SOURCES= \ + tests/libscrypt-kdf/sample-libscrypt-kdf.c +tests_libscrypt_kdf_sample_libscrypt_kdf_CPPFLAGS= \ + -I$(srcdir)/libscrypt-kdf/ +tests_libscrypt_kdf_sample_libscrypt_kdf_LDADD= libscrypt-kdf.la + +# crypto_aesctr_shared.c is in this list because it can't be included in the +# _SOURCES because it should only be included as part of another translation +# unit. +EXTRA_DIST= \ + .autom4te.cfg \ + BUILDING \ + COPYRIGHT \ + FORMAT \ + README.md \ + STYLE \ + get-version.sh \ + lib/README \ + lib/crypto/crypto_scrypt-ref.c \ + libcperciva/POSIX/README \ + libcperciva/POSIX/posix-abstract-declarator.c \ + libcperciva/POSIX/posix-cflags.sh \ + libcperciva/POSIX/posix-clock_gettime.c \ + libcperciva/POSIX/posix-clock_realtime.c \ + libcperciva/POSIX/posix-inet-addrstrlen.c \ + libcperciva/POSIX/posix-inet6-addrstrlen.c \ + libcperciva/POSIX/posix-l.sh \ + libcperciva/POSIX/posix-msg_nosignal.c \ + libcperciva/POSIX/posix-restrict.c \ + libcperciva/POSIX/posix-stat-st_mtim.c \ + libcperciva/POSIX/posix-trivial.c \ + libcperciva/apisupport/Build/apisupport-LIBCRYPTO-LOW_LEVEL_AES.c\ + libcperciva/apisupport/Build/apisupport-NONPOSIX-MEMLIMIT.c \ + libcperciva/apisupport/Build/apisupport.sh \ + libcperciva/cpusupport/Build/cpusupport-ARM-AES.c \ + libcperciva/cpusupport/Build/cpusupport-ARM-SHA256.c \ + libcperciva/cpusupport/Build/cpusupport-HWCAP-ELF_AUX_INFO.c \ + libcperciva/cpusupport/Build/cpusupport-HWCAP-GETAUXVAL.c \ + libcperciva/cpusupport/Build/cpusupport-X86-AESNI.c \ + libcperciva/cpusupport/Build/cpusupport-X86-CPUID.c \ + libcperciva/cpusupport/Build/cpusupport-X86-CPUID_COUNT.c \ + libcperciva/cpusupport/Build/cpusupport-X86-RDRAND.c \ + libcperciva/cpusupport/Build/cpusupport-X86-SHANI.c \ + libcperciva/cpusupport/Build/cpusupport-X86-SSE2.c \ + libcperciva/cpusupport/Build/cpusupport-X86-SSSE3.c \ + libcperciva/cpusupport/Build/cpusupport.sh \ + libcperciva/crypto/crypto_aesctr_shared.c \ + tests/01-known-values.sh \ + tests/02-decrypt-reference-file.sh \ + tests/03-encrypt-decrypt-file.sh \ + tests/04-force-resources.sh \ + tests/05-system-scrypt-encrypt-decrypt.sh \ + tests/06-decrypt-fail.sh \ + tests/07-passphrase-env.sh \ + tests/08-passphrase-file.sh \ + tests/09-explicit-params.sh \ + tests/shared_test_functions.sh \ + tests/shared_valgrind_functions.sh \ + tests/test_scrypt.sh \ + tests/verify-strings/test_scrypt.good \ + tests/verify-strings/test_scrypt_good.enc \ + tests/verify-strings/test_scrypt_small.good + +# Binary to test the crypto_scrypt() function. +tests_verify_strings_test_scrypt_SOURCES= \ + tests/verify-strings/test_scrypt.c \ + $(crypto_scrypt_files) + +tests_verify_strings_test_scrypt_LDADD= \ + libcperciva_arm_sha256.la \ + libcperciva_cpusupport_detect.la \ + libcperciva_shani.la \ + libscrypt_sse2.la \ + ${LDADD_POSIX} + +# Eliminate false positives while memory-checking for the test framework. +tests_valgrind_potential_memleaks_SOURCES= tests/valgrind/potential-memleaks.c + +.PHONY: test +# we can't only build "scrypt tests/verify-strings/test_scrypt" because that +# won't build the BUILT_SOURCES. +test: all + $(top_srcdir)/tests/test_scrypt.sh . --- /dev/null +++ scrypt-1.3.3/configure.ac @@ -0,0 +1,65 @@ +AC_PREREQ([2.69]) +AC_INIT([scrypt],[m4_esyscmd([sh get-version.sh])], + [https://github.com/Tarsnap/scrypt],[scrypt],[http://www.tarsnap.com/scrypt/]) + +# Safety check: make sure that the srcdir contains this file. +AC_CONFIG_SRCDIR([lib/scryptenc/scryptenc.c]) +# Use auxiliary subscripts from this subdirectory (cleans up root). +AC_CONFIG_AUX_DIR([config.aux]) +# Directory for our additional macros. +AC_CONFIG_MACRO_DIR([m4]) +# Compute $target_os and related variables. +AC_CANONICAL_TARGET +AM_INIT_AUTOMAKE([foreign subdir-objects]) + +# Checks for programs. +m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99]) +AM_PROG_AR +LT_INIT + +# Don't rebuild the configure script. I'm distributing a perfectly good one. +AM_MAINTAINER_MODE + +# Get the POSIX sh early, in case the configure script causes +# `command -p getconf` to fail in a broken environment. +CHECK_POSIX_SH + +# Check if we need -std=c99 in LDFLAGS (for gcc on Solaris). +CHECK_SOLARIS_C99 + +# Check if we need to add extra paths to CPPFLAGS and LDFLAGS for macOS. +CHECK_DARWIN_PATHS + +# Checks for AES support in OpenSSL. +AC_SEARCH_LIBS([AES_encrypt], [crypto],, + AC_MSG_ERROR([function AES_ENCRYPT not found])) +AC_CHECK_HEADERS([openssl/aes.h],, + [AC_MSG_ERROR([Unable to find the openssl/aes.h header])]) + +# Check how we can find out the available memory. +CHECK_MEMLIMIT_SUPPORT + +# Check for posix_memalign. +AC_CHECK_FUNCS_ONCE([posix_memalign]) + +# Check for mmap so we can work around its absence on Minix. +AC_CHECK_FUNCS_ONCE([mmap]) + +# Use 64-bit file offsets. +AC_SYS_LARGEFILE + +# Check whether the user has requested to disable compiler warnings. +CHECK_DISABLE_COMPILER_WARNINGS + +# Check libcperciva POSIX compatibility. +CHECK_LIBCPERCIVA_POSIX([${srcdir}/libcperciva]) + +# Check whether the user wants to install libscrypt-kdf. +AC_ARG_ENABLE(libscrypt-kdf, AS_HELP_STRING([--enable-libscrypt-kdf], + [Install libscrypt-kdf and development headers.])) +AM_CONDITIONAL([LIBSCRYPT_KDF], [test "x${enable_libscrypt_kdf}" = "xyes"]) + +# Write configure results and the Makefile. +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT --- /dev/null +++ scrypt-1.3.3/get-version.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +version=1.3.3-head + +# This script outputs a version number for this project to stdout. +# - if $SCRYPT_VERSION is given, it is used. +# - otherwise, it uses ${version}. +# - if there is a ".git/" directory, it will attempt to get a version number +# from `git describe` in the form 1.2.0-238-g0a25a7c, where the middle value +# is the number of commits since the 1.2.0 tag. + +# Use $SCRYPT_VERSION if it exists. +if [ -n "${SCRYPT_VERSION}" ]; then + # Do not use \n; that confuses autoconf. + printf "%s" "${SCRYPT_VERSION}" + exit 0 +fi + +# Get a version number from git, if it exists. +if git rev-parse 2>/dev/null; then + # Get a version string from the latest git tag. + if version_git=$( git describe --tags --match '[[:digit:]].*' ) \ + 2>/dev/null ; then + version_decapitated=$( echo "${version}" | sed "s/-head//" ) + # Check that the beginning of this tag matches the version. + case ${version_git} in + "${version_decapitated}"*) + # If so, use that version string. + version=${version_git};; + *) + printf "git tag does not match version\n" 1>&2 + exit 1;; + esac + fi +fi + +# Output the version to stdout. Do not use \n; that confuses autoconf. +printf "%s" "${version}" --- /dev/null +++ scrypt-1.3.3/release-tools/create-sign-tarball.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# Process command-line arguments +SCRYPTVERSION=$1 +GNUPG_SIGNING_HOME=$2 + +# Check for required arguments +if [ -z "${SCRYPTVERSION}" ] || [ -z "${GNUPG_SIGNING_HOME}" ]; then + echo "Usage: $0 SCRYPTVERSION GNUPG_SIGNING_HOME" + exit 1 +fi + +# Check for correct OS +if [ "$(uname)" != "FreeBSD" ]; then + echo "Error: This script only works on FreeBSD due to the" + echo " sha256 \${PKGNAME}.tgz" + echo "command, which has a different meaning on other OSes." + exit 1 +fi + +# Constants +PKGNAME=scrypt-${SCRYPTVERSION} +PKGSIGS=scrypt-sigs-${SCRYPTVERSION} + +# Get directory of script +dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P) + +# Create tarball +sh "${dir}/mktarball.sh" "${SCRYPTVERSION}" + +# Sign tarball +sha256 "${PKGNAME}.tgz" | \ + GNUPGHOME=${GNUPG_SIGNING_HOME} gpg --clearsign \ + > "${PKGSIGS}.asc" --- /dev/null +++ scrypt-1.3.3/release-tools/mktarball.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +VERSION=$1 +if [ -z "${VERSION}" ]; then + echo "Please specify the version number" + exit 1 +fi +DESTDIR=scrypt-${VERSION} +RELEASEDATE=$(date "+%B %d, %Y") + +# Copy bits in +mkdir "${DESTDIR}" "${DESTDIR}/autotools" +cp main.c FORMAT COPYRIGHT BUILDING README.md STYLE "${DESTDIR}" +cp Makefile.am .autom4te.cfg "${DESTDIR}" +cp Makefile.am "${DESTDIR}/autotools" +cp -R lib lib-platform libcperciva libscrypt-kdf m4 tests "${DESTDIR}" +# Copy with substitution +sed -e "s/@DATE@/${RELEASEDATE}/" < scrypt.1 > "${DESTDIR}/scrypt.1" +sed -e "s/\[m4_esyscmd(\[sh get-version\.sh\])]/${VERSION}/" \ + < configure.ac > "${DESTDIR}/configure.ac" +cp "${DESTDIR}/configure.ac" "${DESTDIR}/autotools" + +# Generate autotools files +( cd "${DESTDIR}" || exit +autoreconf -i +rm .autom4te.cfg Makefile.am aclocal.m4 configure.ac ) + +# Create tarball +tar -czf "${DESTDIR}.tgz" "${DESTDIR}" +rm -r "${DESTDIR}" --- scrypt-1.3.3.orig/scrypt.1 +++ scrypt-1.3.3/scrypt.1 @@ -21,7 +21,7 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.Dd February 13, 2025 +.Dd @DATE@ .Dt SCRYPT 1 .Os .Sh NAME