openwall / openwall/john

Improve how dynamic_big_crypt.c is generated

Open
#4,869 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

maintenance/cleanup
Dominant language
C
Stars
13.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

The source file dynamic_big_crypt.c is made at make time, from many parts and with substitutions for build target (such as SIMD type and so on).

Makefile.in

dynamic_big_crypt.c: dynamic_big_crypt_hash.cin dynamic_big_crypt_header.cin dynamic_big_crypt_generator.sh dynamic_big_crypt_chopper.pl unused/dynamic_big_crypt.c
        $(shell ./dynamic_big_crypt_generator.sh)
        @if [ ! -f dynamic_big_crypt.c ] ; then $(CP) unused/dynamic_big_crypt.c dynamic_big_crypt.c ; fi

There seems to be a fallback in the above, copying a file from unused/ (which BTW is a poor location to keep a fallback) but this apparently backfired somehow in #4856 (where the problem was lack of perl).

src/dynamic_big_crypt_generator.sh in turn runs src/dynamic_big_crypt_chopper.pl introducing the need for perl. The perl script was introduced in 0aace8a0c, replacing dynamic_big_crypt_chopper.c which was apparently a C program doing the job - which had some problems with cross compiles according to this comment:

# Ported to Perl at request of Magnum. We were seeing build/run issues
# on cross complier environments.

See also #4868

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dynamic_big_crypt.c rule in Makefile.in, then read dynamic_big_crypt_generator.sh, dynamic_big_crypt_chopper.pl, and the related .cin files. Trace how substitutions and the unused/dynamic_big_crypt.c fallback behave, especially when Perl is unavailable or builds are cross-compiled. Done should mean the generation path is reliable for the supported build targets without the reported fallback problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, perl, shell
Domain
build-system
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.