aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-07-15 04:45:08 -0500
committerRob Landley <rob@landley.net>2016-07-15 04:45:08 -0500
commitadef5dcb1857f524e2a24dd0223f31db7cd7a8b9 (patch)
tree2201bf6146fdf17426e0d75d708189b42c27f485 /scripts
parentfff20ab005ccd98373c5a0675c286e20cf84cbb7 (diff)
downloadtoybox-adef5dcb1857f524e2a24dd0223f31db7cd7a8b9.tar.gz
Add optional openssl accelerated versions of hash functions, loosely based on
a patch from Elliott Hughes, who said: [PATCH] Add support for libcrypto for MD5/SHA. Orders of magnitude faster (for architectures where OpenSSL/BoringSSL has optimized assembler). Also adds sha224sum, sha256sum, sha384sum, and sha512sum for folks building with libcrypto. The fallback portable C implementations could easily be refactored to be API-compatible, but I don't know whether they'd stay here or move to lib/ so I've left that part alone for now.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/make.sh2
-rw-r--r--scripts/mkflags.c13
2 files changed, 5 insertions, 10 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index 07bf2ac8..50415e55 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -103,7 +103,7 @@ then
# for it.
> generated/optlibs.dat
- for i in util crypt m resolv selinux smack attr rt
+ for i in util crypt m resolv selinux smack attr rt crypto
do
echo "int main(int argc, char *argv[]) {return 0;}" | \
${CROSS_COMPILE}${CC} $CFLAGS -xc - -o generated/libprobe -Wl,--as-needed -l$i > /dev/null 2>/dev/null &&
diff --git a/scripts/mkflags.c b/scripts/mkflags.c
index 8b3d0aa3..27fc5172 100644
--- a/scripts/mkflags.c
+++ b/scripts/mkflags.c
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
for (;;) {
struct flag *flist, *aflist, *offlist;
- char *gaps, *mgaps, c;
+ char *mgaps;
unsigned bit;
*command = *flags = *allflags = 0;
@@ -142,14 +142,9 @@ int main(int argc, char *argv[])
bit = 0;
printf("// %s %s %s\n", command, flags, allflags);
mgaps = mark_gaps(flags, allflags);
- for (gaps = mgaps; *gaps == 1; gaps++);
- if (*gaps) c = '"';
- else {
- c = ' ';
- gaps = "0";
- }
- printf("#undef OPTSTR_%s\n#define OPTSTR_%s %c%s%c\n",
- command, command, c, gaps, c);
+ // If command disabled, use allflags for OLDTOY()
+ printf("#undef OPTSTR_%s\n#define OPTSTR_%s \"%s\"\n",
+ command, command, strcmp(flags, " ") ? mgaps : allflags);
free(mgaps);
flist = digest(flags);