diff options
author | Rob Landley <rob@landley.net> | 2016-07-15 04:45:08 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-07-15 04:45:08 -0500 |
commit | adef5dcb1857f524e2a24dd0223f31db7cd7a8b9 (patch) | |
tree | 2201bf6146fdf17426e0d75d708189b42c27f485 /scripts/mkflags.c | |
parent | fff20ab005ccd98373c5a0675c286e20cf84cbb7 (diff) | |
download | toybox-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/mkflags.c')
-rw-r--r-- | scripts/mkflags.c | 13 |
1 files changed, 4 insertions, 9 deletions
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); |