]> jfr.im git - irc/atheme/atheme.git/log
irc/atheme/atheme.git
4 years agochanserv/akick: replace chanacs-based system origin/akick-not-as-chanacs
Nicole Kleinhoff [Thu, 13 Feb 2020 11:42:55 +0000 (11:42 +0000)] 
chanserv/akick: replace chanacs-based system

This does *not* provide a migration path for existing chanacs-based
akicks, which will have to be provided by a followup commit.

4 years agom4/atheme-featuretest-nls.m4: fix option name
Aaron Jones [Sun, 9 Feb 2020 13:00:41 +0000 (13:00 +0000)] 
m4/atheme-featuretest-nls.m4: fix option name

This is a default off option; its help string should be enable.

[ci skip]

4 years agom4/: tidy up NLS logic
Aaron Jones [Sun, 9 Feb 2020 12:46:26 +0000 (12:46 +0000)] 
m4/: tidy up NLS logic

We shouldn't do all the NLS checks before parsing --enable-nls; it should
be the other way around: only do the checks if --enable-nls=yes was given.

Since all but one of our translations are currently broken, also change
the default from yes to no. This can be revisited after our translations
are brought up to scratch.

4 years agomodules/crypto/pbkdf2v2: correct erroneous debugging statement
Aaron Jones [Thu, 6 Feb 2020 19:36:21 +0000 (19:36 +0000)] 
modules/crypto/pbkdf2v2: correct erroneous debugging statement

This is not necessarily SHA; we support verifying with MD5 too, and might
support non-SHA in the future.

[ci skip]

4 years agoTravis CI: Explicitly install gettext(1) package
Aaron Jones [Thu, 6 Feb 2020 09:03:44 +0000 (09:03 +0000)] 
Travis CI: Explicitly install gettext(1) package

The libgettextpo-dev package no longer seems to pull this in.

[ci skip]

4 years agoMake the SASL mechanism tools optional
Aaron Jones [Thu, 6 Feb 2020 07:24:42 +0000 (07:24 +0000)] 
Make the SASL mechanism tools optional

4 years agoMake the crypto benchmarking utility optional
Aaron Jones [Thu, 6 Feb 2020 06:43:50 +0000 (06:43 +0000)] 
Make the crypto benchmarking utility optional

4 years agom4/atheme-conditional-compilation.m4: sort functions alphabetically
Aaron Jones [Thu, 6 Feb 2020 06:44:42 +0000 (06:44 +0000)] 
m4/atheme-conditional-compilation.m4: sort functions alphabetically

4 years agom4/atheme-libtest-clock-gettime: this is a kernel function, not userland
Aaron Jones [Thu, 6 Feb 2020 06:10:09 +0000 (06:10 +0000)] 
m4/atheme-libtest-clock-gettime: this is a kernel function, not userland

[ci skip]

4 years agom4/atheme-libtest-clock-gettime: do link test with required API & constants
Aaron Jones [Thu, 6 Feb 2020 06:03:02 +0000 (06:03 +0000)] 
m4/atheme-libtest-clock-gettime: do link test with required API & constants

This is what we do in all the other library test files.

[ci skip]

4 years agom4/atheme-print-configuration: make even nicer output
Aaron Jones [Thu, 6 Feb 2020 05:29:50 +0000 (05:29 +0000)] 
m4/atheme-print-configuration: make even nicer output

Group lines by category, indent them some more, indicate which SASL
mechanisms are going to be built (some are always built, so this output
won't change, but they're just there for consistency's sake...).

Good news for all of those stuck in 1995: Aside from the build variables
(CC/CFLAGS/CPPFLAGS/LDFLAGS/LIBS), it all still fits into 80 columns, so
your VGA console can render it just fine.

4 years agom4/atheme-libtest-rt.m4: rename to clock-gettime
Aaron Jones [Thu, 6 Feb 2020 05:16:54 +0000 (05:16 +0000)] 
m4/atheme-libtest-rt.m4: rename to clock-gettime

This file tests whether we can use the clock_gettime(3) function, and
whether we need to link against -lrt to do so (as on older GNU libc...)

However, the functionality we're actually looking for is clock_gettime(3),
not whether we need -lrt or not, so don't name it after the library we
might need, but rather after the function we do need.

4 years agolibathemecore/gcrypt: header inclusion guards aren't necessary in units
Aaron Jones [Thu, 6 Feb 2020 05:16:10 +0000 (05:16 +0000)] 
libathemecore/gcrypt: header inclusion guards aren't necessary in units

Silences two harmless unused macro diagnostics.

[ci skip]

4 years agolibathemecore/memory_frontend: smemzero: support OPENSSL_cleanse(3ssl)
Aaron Jones [Sun, 2 Feb 2020 22:32:07 +0000 (22:32 +0000)] 
libathemecore/memory_frontend: smemzero: support OPENSSL_cleanse(3ssl)

4 years agoUse #elif more to avoid pointless preprocessor soup
Aaron Jones [Sun, 2 Feb 2020 22:19:54 +0000 (22:19 +0000)] 
Use #elif more to avoid pointless preprocessor soup

This looks *MUCH* better, and is also much more maintainable.

Also document, in libathemecore/memory_frontend.c, where various memory
comparison and wiping functions originated, and clean up some other
miscellaneous things.

4 years agolibathemecore/memory: support consttime_memequal & explicit_memset
Aaron Jones [Sun, 2 Feb 2020 11:24:28 +0000 (11:24 +0000)] 
libathemecore/memory: support consttime_memequal & explicit_memset

These C library functions are present in NetBSD v7.0+ and possibly other
C libraries. On NetBSD they both require only <string.h>, which we
already include (by way of <atheme/stdheaders.h>).

Also move the preprocessor warning directive down to where it is actually
needed.

4 years agoconfigure.ac: move most build system / toolchain / header / etc checks
Aaron Jones [Sun, 2 Feb 2020 11:17:20 +0000 (11:17 +0000)] 
configure.ac: move most build system / toolchain / header / etc checks

This puts them in a dedicated file, where they can live in peace and not
pollute the rest.

We also put needed things once per line, even if it is a bit more verbose,
it saves us having to re-wrap lines when we add or remove something.

4 years agodoc/SASL-SCRAM: clarify setup instructions
Aaron Jones [Sun, 2 Feb 2020 05:34:28 +0000 (05:34 +0000)] 
doc/SASL-SCRAM: clarify setup instructions

- Explain the ./configure argument to force GNU libidn to be available
  and what to look for when it prints its configuration.

- Reorder mechanisms in order of strength when asking to decide.

- Clarify that regular PBKDF2 credentials definitely allow impersonation,
  and that this is why the SCRAM module does nothing if this style of
  credentials is being used.

- Move loadmodule advice to next to eachother.

- Space everything out a bit more for readability.

- Directly discourage uncommenting the SCRAM loadmodule line in the
  example configuration file without having read the documentation.

4 years agodist/atheme.conf.example: improve PBKDF2 documentation
Aaron Jones [Sun, 2 Feb 2020 05:23:54 +0000 (05:23 +0000)] 
dist/atheme.conf.example: improve PBKDF2 documentation

4 years agomodules/crypto/pbkdf2v2: parse_dbentry: use less stack space
Aaron Jones [Sun, 2 Feb 2020 05:21:55 +0000 (05:21 +0000)] 
modules/crypto/pbkdf2v2: parse_dbentry: use less stack space

Also denote lack of need for zeroing potentially-sensitive information.

4 years agomodules/crypto/pbkdf2v2: option parsing: some improvements
Aaron Jones [Sun, 2 Feb 2020 05:20:00 +0000 (05:20 +0000)] 
modules/crypto/pbkdf2v2: option parsing: some improvements

- Give clearer error message for the SCRAM- variants being unavailable

- Accept more digest names differing only by e.g. hyphen or lack of, or
  an implied or explicit version, for broader compatibility

- Only assign to pbkdf2v2_digest once

4 years agolibathemecore/digest_testsuite: a few style and ordering cleanups
Aaron Jones [Sat, 1 Feb 2020 20:22:16 +0000 (20:22 +0000)] 
libathemecore/digest_testsuite: a few style and ordering cleanups

- When performing an HKDF test, check the PRK matches before going on
  to compute and verify the OKM. If the PRK was incorrectly generated,
  the OKM is also going to be incorrect, and this saves some pointless
  computation.

- Now that there's only one vector for each of the PBKDF2 tests, un-
  indent the vector and remove it from its now-unnecessary containing
  block.

- Perform all modes of operation on a message digest algorithm (plain,
  HMAC, HKDF, PBKDF2), before moving on to the next algorithm. This
  illuminates a misbehaving mode sooner.

4 years agolibathemecore/atheme.c: guard gcrypt.h header inclusion by build system
Aaron Jones [Sat, 1 Feb 2020 19:40:32 +0000 (19:40 +0000)] 
libathemecore/atheme.c: guard gcrypt.h header inclusion by build system

4 years agolibathemecore/atheme.c: add missing header
Aaron Jones [Sat, 1 Feb 2020 19:38:54 +0000 (19:38 +0000)] 
libathemecore/atheme.c: add missing header

If not building with the gcrypt digest frontend, this doesn't get included
by atheme.h -> atheme/digest.h -> atheme/digest/gcrypt.h

But we need it always.

4 years agoDigest API: Add GNU libgcrypt binding
Aaron Jones [Sat, 1 Feb 2020 19:26:38 +0000 (19:26 +0000)] 
Digest API: Add GNU libgcrypt binding

This makes up for the recent removal of the GNU Nettle binding, which
was necessary for the compiler sanitizers feature (-fsanitize=function).
See the commit message in ed8a3fce8f196d139732 for more information.

This library does not tolerate PBKDF2 with a no-password and/or no-salt
situation, which is why the previous commit was necessary.

4 years agolibathemecore/digest_testsuite: remove PBKDF2 no-pass/no-salt vectors
Aaron Jones [Sat, 1 Feb 2020 07:20:49 +0000 (07:20 +0000)] 
libathemecore/digest_testsuite: remove PBKDF2 no-pass/no-salt vectors

Some cryptographic libraries don't tolerate being told to perform a
PBKDF2 computation with no password and/or no salt. It is well-defined
behaviour to do so, but it's probably just an anti-footgun measure on
the part of the library authors.

However, nothing in this codebase performs such a PBKDF2 calculation.
So just remove the test vectors and prohibit such behaviour in our
Digest API.

4 years agoDigest API: Make low-level direct digest routines always available
Aaron Jones [Mon, 27 Jan 2020 09:50:51 +0000 (09:50 +0000)] 
Digest API: Make low-level direct digest routines always available

Rework the Internal Digest API frontend to use the renamed direct
low-level routines and unify their interface. Declare said interface
in a separate header so that modules which need access to the low-
level primitives directly (like Anope's enc_sha256 crypto module)
can always use them regardless of which Digest API frontend we're
building with and without awful header/preprocessor hacks.

While I'm doing this, simplify the endianness reversal logic in that
crypto module too, and add some test vectors, generated by Anope
v2.0.7, for both 32-character and 288-character passwords (the
default Anope password length, and the maximum Atheme length,
respectively).

4 years agoDigest API: Remove Nettle frontend
Aaron Jones [Mon, 27 Jan 2020 07:46:03 +0000 (07:46 +0000)] 
Digest API: Remove Nettle frontend

This will never work with '-fsanitize=cfi' or '-fsanitize=function' due
to the necessary function pointer casts to incompatible prototypes.

(nettle_md5_init takes different arguments than nettle_sha1_init etc.)

While we're at it, add some missing error/sanity checking to the digest
API, and denote in the ifdef soup and './configure --help' output the
order in which frontends are searched for.

4 years agoContinue updating more old author e-mail addresses.
Aaron Jones [Sun, 26 Jan 2020 15:36:55 +0000 (15:36 +0000)] 
Continue updating more old author e-mail addresses.

[ci skip]

4 years agoCorrect some minor oversights in commit 8f1afa5d55929db3b428.
Aaron Jones [Sun, 26 Jan 2020 04:46:10 +0000 (04:46 +0000)] 
Correct some minor oversights in commit 8f1afa5d55929db3b428.

This file includes the ISC license permissions text, so add an ISC
license header tag to it, which was overlooked by commit
507f49117bea9a3f70bf.

Also document authorship and modifications properly, and update the
original author's e-mail address and current repository location to
match the present reality.

Finally, indent comments with only one space.

[ci skip]

4 years agoCorrect some minor oversights in commit 8f1afa5d55929db3b428.
Aaron Jones [Sun, 26 Jan 2020 04:44:58 +0000 (04:44 +0000)] 
Correct some minor oversights in commit 8f1afa5d55929db3b428.

[ci skip]

4 years agoEntire codebase: Clean up Makefiles and assorted build system stuff
Aaron Jones [Sun, 26 Jan 2020 04:14:25 +0000 (04:14 +0000)] 
Entire codebase: Clean up Makefiles and assorted build system stuff

- Add a license header to Makefiles (and the files they include)
  where missing, and indicate who has modified each Makefile based on
  the Git history. This was overlooked by commit 507f49117bea9a3f.

- Add myself to the copyright headers in Makefiles that I have heavily
  modified; mostly during my work over the last 2 years on refactoring
  and cleaning up the entire build system.

- Relicense Makefiles I have entirely (re)written to CC0-1.0, i.e. now
  Public Domain.

- Always include extra.mk first, then define any non-additive variables
  that buildsys.mk depends on for dependency tracking, then include
  buildsys.mk and, if needed, buildsys.module.mk, before adding to any
  variables those would have defined.

- Add missing test for the preprocessor to configure.ac

  buildsys.mk.in was relying on this being set

- Don't use ${PACKAGE} in includesubdir because the header files
  themselves have a hardcoded "atheme/" inclusion of other headers.

- Don't add '-I.' to CPPFLAGS; the compiler always looks in the current
  directory first for #include "foo.h" style directives.

- Use ${foo} instead of $(foo) in Makefiles; make allows either form,
  and treats them identically, except when you mix () and {} in some
  expressions, so settle on a single set of braces now.

- Break long lists of sources / libraries / flags into a list of one per
  line, indent and align with spaces instead of tabs so that it still
  renders the same for people who change the tab width in their editor,
  and align the line-continuation marker to a column not a multiple of 8
  to immediately discourage most future additions that use tabs.

- Alphabetise some erroneously-overlooked source file lists in Makefiles,
  particularly modules/nickserv/Makefile.

- Use $@ in Makefiles where possible to avoid using redundant filenames

- Test for -Wno-format-zero-length to hide a harmless diagnostic
  introduced during the addition of translation support to the crypto
  benchmarking utility

- Library test M4 files that don't use pkg-config now unconditionally
  set FOO_CFLAGS as well as FOO_LIBS. Normally the _CFLAGS variable is
  provided by pkg-config, but we should start using it unconditionally
  in extra.mk.in and Makefiles so that if those libraries gain pkg-config
  compatibility in the future we can start making use of it immediately.

- Put all conditional build variables/targets first in their respective
  variables in Makefiles.

- Move the "Remember to edit your config file" notice to the Makefile in
  src/services/ so that it is displayed close to the bottom of the install
  target, where it is more likely to be read.

- Remove obsolete rm calls from src/services/Makefile for installing into
  a directory containing an extremely old Atheme installation.

- Move installation of NEWS.md -> RELEASE outside of the bottom of a
  subshell in src/services/Makefile -- its presence there was only
  confusing.

- Add missing subdirectory to SUBDIRS in tools/Makefile.

- Make both tools/*/Makefiles not install their respective programs.

  These are not expected to be used by users, and in fact are not even
  installed at all anyway because tools itself is not in the SUBDIRS
  variable in the root Makefile, nor does this commit add it.

4 years agom4/atheme-libtest-*.m4: don't break build with --without-foo
Aaron Jones [Sat, 25 Jan 2020 18:23:57 +0000 (18:23 +0000)] 
m4/atheme-libtest-*.m4: don't break build with --without-foo

The recent work to enable providing custom paths to libraries didn't account
for the fact that a --with-option can be "no" as well as "auto". Fix it.

4 years agopo/: make *.po
Aaron Jones [Thu, 23 Jan 2020 03:48:35 +0000 (03:48 +0000)] 
po/: make *.po

4 years agopo/: make atheme.pot
Aaron Jones [Thu, 23 Jan 2020 03:48:26 +0000 (03:48 +0000)] 
po/: make atheme.pot

4 years agopo/: make POTFILES.in
Aaron Jones [Thu, 23 Jan 2020 03:48:18 +0000 (03:48 +0000)] 
po/: make POTFILES.in

4 years agosrc/ecdh-x25519-tool/: make translateable (i18n)
Aaron Jones [Thu, 23 Jan 2020 03:47:55 +0000 (03:47 +0000)] 
src/ecdh-x25519-tool/: make translateable (i18n)

4 years agomodules/crypto/anope-enc-sha256: add missing smemzero
Aaron Jones [Wed, 22 Jan 2020 18:10:35 +0000 (18:10 +0000)] 
modules/crypto/anope-enc-sha256: add missing smemzero

The 2 message digest buffers are already erased at the end of
the function, but the buffer holding the base64-encoded digest
wasn't. Fix that; the data it contains is just as sensitive.

[ci skip]

4 years agomodules/crypto/anope-enc-sha256: remove debugging memsets
Aaron Jones [Wed, 22 Jan 2020 18:08:16 +0000 (18:08 +0000)] 
modules/crypto/anope-enc-sha256: remove debugging memsets

These were only to assist in debugging; they make the output of
gdb's print command easier to parse. The sscanf(3) function
already writes null-terminating bytes for strings (%s and %[]),
so we don't need to pre-fill the array with zeroes to avoid our
base64 decoder over-running it.

[ci skip]

4 years agopo/: make *.po
Aaron Jones [Wed, 22 Jan 2020 01:14:42 +0000 (01:14 +0000)] 
po/: make *.po

4 years agopo/: make atheme.pot
Aaron Jones [Wed, 22 Jan 2020 01:14:27 +0000 (01:14 +0000)] 
po/: make atheme.pot

4 years agopo/: make POTFILES.in
Aaron Jones [Wed, 22 Jan 2020 01:14:13 +0000 (01:14 +0000)] 
po/: make POTFILES.in

4 years agosrc/crypto-benchmark/: make translateable (i18n)
Aaron Jones [Wed, 22 Jan 2020 01:11:33 +0000 (01:11 +0000)] 
src/crypto-benchmark/: make translateable (i18n)

4 years agosrc/crypto-benchmark/optimal: run CI builds in SCRAM mode
Aaron Jones [Tue, 21 Jan 2020 22:49:12 +0000 (22:49 +0000)] 
src/crypto-benchmark/optimal: run CI builds in SCRAM mode

This saves having a preprocessor definition to limit the CPU
impact of build jobs, since the PBKDF2 code now starts at the
Cyrus iteration count limit in SCRAM mode, which is much lower.

4 years agosrc/crypto-benchmark/optimal: a few final PBKDF2 fixups
Aaron Jones [Tue, 21 Jan 2020 22:36:18 +0000 (22:36 +0000)] 
src/crypto-benchmark/optimal: a few final PBKDF2 fixups

- When running in SCRAM mode, start at the Cyrus iteration count cap

  This avoids wasting time when we're going to cap it to this later
  anyway (for maximum IRC client compatibility)

- Run a SHA-1 test (but do not consider its performance)

  Even if SCRAM-SHA-1 were more widely implemented than SCRAM-SHA-256,
  the IRCv3 working group is pushing the latter

- Always recommend SCRAM-SHA-256 even if SCRAM-SHA-512 is faster

  This is further to the point above

- Print which iteration count and digest algorithm we choose

- Run benchmarks in digest output length order

- Start slightly above (+10%) our projected optimal iteration count
  after having selected a digest algorithm

- If the iteration count we chose is the iteration count we started
  with (e.g. SCRAM mode and the Cyrus maximum being fast enough),
  don't run another benchmark with the same iteration count again

- Don't print whether it was capped in the configuration section

4 years agosrc/crypto-benchmark/optimal: tidy up error messages
Aaron Jones [Tue, 21 Jan 2020 21:28:54 +0000 (21:28 +0000)] 
src/crypto-benchmark/optimal: tidy up error messages

4 years agoinclude/atheme/Makefile: add missing headers
Aaron Jones [Tue, 21 Jan 2020 20:35:07 +0000 (20:35 +0000)] 
include/atheme/Makefile: add missing headers

4 years agosrc/crypto-benchmark/: print memory sizes in a more readable manner
Aaron Jones [Sat, 18 Jan 2020 21:13:18 +0000 (21:13 +0000)] 
src/crypto-benchmark/: print memory sizes in a more readable manner

[ci skip]

4 years agoREADME.md: clarify which Argon2 implementation Atheme looks for
Aaron Jones [Sat, 18 Jan 2020 20:50:48 +0000 (20:50 +0000)] 
README.md: clarify which Argon2 implementation Atheme looks for

[ci skip]

4 years agosrc/crypto-benchmark/: only warn about SCRAM if support was requested
Aaron Jones [Sat, 18 Jan 2020 20:45:53 +0000 (20:45 +0000)] 
src/crypto-benchmark/: only warn about SCRAM if support was requested

[ci skip]

4 years agoCryptographic Benchmarking Utility: Add SASL SCRAM support
Aaron Jones [Sat, 18 Jan 2020 20:39:27 +0000 (20:39 +0000)] 
Cryptographic Benchmarking Utility: Add SASL SCRAM support

4 years agodoc/SASL-SCRAM: note that configuring pbkdf2v2_digest is required
Aaron Jones [Sat, 18 Jan 2020 19:15:04 +0000 (19:15 +0000)] 
doc/SASL-SCRAM: note that configuring pbkdf2v2_digest is required

Also re-wrap some paragraphs.

[ci skip]

4 years agoconfigure: --enable-warnings: remove -Wno-missing-include-dirs
Aaron Jones [Sat, 18 Jan 2020 18:41:56 +0000 (18:41 +0000)] 
configure: --enable-warnings: remove -Wno-missing-include-dirs

Removing this diagnostic has not been necessary since commit
dc97ef3b0a4bd29871da.

4 years agoconfigure: --enable-warnings: remove -Wno-missing-variable-declarations
Aaron Jones [Sat, 18 Jan 2020 18:29:08 +0000 (18:29 +0000)] 
configure: --enable-warnings: remove -Wno-missing-variable-declarations

Only GroupServ (to be addressed shortly) and NickServ LIST (ditto)
are the major remaining violators of using non-static symbols without
a previous extern declaration for them. Re-enable this warning so that
future changes that introduce more of this behaviour are caught.

4 years agoEverything: Mark which variables are supposed to be extern or not
Aaron Jones [Sat, 18 Jan 2020 18:26:12 +0000 (18:26 +0000)] 
Everything: Mark which variables are supposed to be extern or not

4 years agomodules/botserv/: improve symbol imports
Aaron Jones [Sat, 18 Jan 2020 17:52:37 +0000 (17:52 +0000)] 
modules/botserv/: improve symbol imports

Annotate which symbols are exported to other modules, import
a structure containing all symbols instead of importing one
symbol at a time, avoid casting function pointers to (void *)
and back.

4 years agomodules/saslserv/scram-sha: rename to scram
Aaron Jones [Sat, 18 Jan 2020 15:41:53 +0000 (15:41 +0000)] 
modules/saslserv/scram-sha: rename to scram

It's conceivable in the future that SCRAM would be updated to
include other kinds of password hashing algorithms, such as
scrypt and/or Argon2. The name of the mechanism is itself also
just "SCRAM", so name the module that instead, while we can
rename it now to avoid breaking configuration compatibility.

While we're at it, make the module register all supported
mechanisms. This is because changing the digest algorithm
should not break logins that would have continued to succeed
before doing so. Clients can try each mechanism in turn until
one succeeds, or cache the configuration and credentials that
succeeded last time and continue to re-use them without even
noticing.

4 years agom4/atheme-print-configuration.m4: indicate if scrypt is available
Aaron Jones [Thu, 16 Jan 2020 19:51:55 +0000 (19:51 +0000)] 
m4/atheme-print-configuration.m4: indicate if scrypt is available

Also group password hashing modules together on their own.

[ci skip]

4 years agoCompiler Sanitizers: Don't warn for unsigned integer overflow
Aaron Jones [Thu, 16 Jan 2020 19:38:47 +0000 (19:38 +0000)] 
Compiler Sanitizers: Don't warn for unsigned integer overflow

This is well-defined behaviour. Leaving it enabled produces tons
of unnecessary noise.

4 years agoscripts/ci-build.sh: when building with sanitizers, don't do -Wl,-z,defs
Aaron Jones [Thu, 16 Jan 2020 19:25:14 +0000 (19:25 +0000)] 
scripts/ci-build.sh: when building with sanitizers, don't do -Wl,-z,defs

This prevents linking, and the configure script checks for it for that
reason.

4 years agoconfigure: replace --enable-debugging with --enable-compiler-sanitizers
Aaron Jones [Thu, 16 Jan 2020 18:47:02 +0000 (18:47 +0000)] 
configure: replace --enable-debugging with --enable-compiler-sanitizers

This enables ASan, UBSan, et al. and supports both GCC and Clang.

Clang support requires an LLVM-bitcode-parsing-capable linker (because
Clang requires LTO for these sanitizers, and Clang in LTO mode outputs
LLVM bitcode, instead of machine code, leaving it to the linker to
translate it after performing its link-time optimisations).

If you need to, pass LDFLAGS="-fuse-ld=lld" to override the LD variable
set by `./configure` (which isn't used anyway) and use the LLVM linker.

Alternatively, use the Gold linker with the LLVM plugin.

Or just use GCC, but that doesn't support as many sanitizers ...

This commit removes the `--enable-debugging` flag added by commit
447cda49a9549c2e1631. It wasn't particularly useful anyway. The build
system still checks for CFLAGS="-g", with or without this new option, &
with or without any explicit CFLAGS being passed to `./configure`, so
that the occasionally-submitted backtraces are at least still somewhat
useful.

This commit also makes the CI build script pass the following options
to `./configure`:

    --disable-heap-allocator
    --enable-compiler-sanitizers              (this newly-added option)
    --enable-warnings

The former is so that the sanitizers can catch any memory issues. The
shared heap allocator(s) hide use-after-free problems, because they
don't taint the memory, or release it back to the OS, after Atheme
"frees" it.

4 years agolibathemecore/memory_fe_sodium: use sodium_allocarray() to back calloc()
Aaron Jones [Thu, 16 Jan 2020 18:08:15 +0000 (18:08 +0000)] 
libathemecore/memory_fe_sodium: use sodium_allocarray() to back calloc()

4 years agolibathemecore/memory_fe_sodium: several small improvements
Aaron Jones [Thu, 16 Jan 2020 09:33:13 +0000 (09:33 +0000)] 
libathemecore/memory_fe_sodium: several small improvements

- Correct opening header comment block.

- Document why a list of allocations is needed.

- Use C99-style comments for single-line comments.

- When performing a new memory allocation, and freeing an existing
  allocation, don't iterate the entire list of allocations and change
  the memory protection permissions on everything; only change what
  is necessary.

- When performing a new memory allocation, add the new allocation to
  the head of the allocations list. Statistically speaking, the most
  recently-allocated memory is the memory that is most likely to be
  freed soon. This makes freeing it faster, because it's closer to
  the start of the list that you need to iterate over.

- When freeing the information about an allocation, also free the
  allocation itself. This avoids needing to do so in the 3 places
  that free allocation information, which removes some duplication.

- Remove an unnecessary typecast.

- Liberally comment everything.

4 years agoNEWS.md: Update for previous commit
Aaron Jones [Wed, 15 Jan 2020 08:48:35 +0000 (08:48 +0000)] 
NEWS.md: Update for previous commit

[ci skip]

4 years agolibathemecore: ARM mbedTLS RNG: remove CTR-DRBG support
Aaron Jones [Wed, 15 Jan 2020 08:39:53 +0000 (08:39 +0000)] 
libathemecore: ARM mbedTLS RNG: remove CTR-DRBG support

HMAC-DRBG has a security proof of correctness [1]; CTR-DRBG on the other
hand does not, and additionally suffers catastrophically if you sample
too much output from it.

[1] https://www.cs.princeton.edu/~appel/papers/verified-hmac-drbg.pdf

4 years agoconfigure: prioritise OpenSSL RNG above ARM mbedTLS RNG
Aaron Jones [Wed, 15 Jan 2020 08:14:19 +0000 (08:14 +0000)] 
configure: prioritise OpenSSL RNG above ARM mbedTLS RNG

This is likely to be faster, with more access to hardware
primitives. The user can still override with the
--with-rng-api-frontend= argument to `configure`.

4 years agomodules/crypto/scrypt: correct module name
Aaron Jones [Wed, 15 Jan 2020 07:30:15 +0000 (07:30 +0000)] 
modules/crypto/scrypt: correct module name

[ci skip]

4 years agodist/atheme.conf.example: minor fixup for scrypt
Aaron Jones [Wed, 15 Jan 2020 07:28:09 +0000 (07:28 +0000)] 
dist/atheme.conf.example: minor fixup for scrypt

[ci skip]

4 years agoMakefile: If building libmowgli, build it before anything else
Aaron Jones [Wed, 15 Jan 2020 07:20:41 +0000 (07:20 +0000)] 
Makefile: If building libmowgli, build it before anything else

4 years agoconfigure.ac: check for more functions required by the codebase
Aaron Jones [Wed, 15 Jan 2020 07:15:55 +0000 (07:15 +0000)] 
configure.ac: check for more functions required by the codebase

4 years agosrc/crypto-benchmark/: add scrypt support
Aaron Jones [Wed, 15 Jan 2020 07:13:28 +0000 (07:13 +0000)] 
src/crypto-benchmark/: add scrypt support

4 years agomodules/crypto/: make the libsodium scrypt module encryption-capable
Aaron Jones [Wed, 15 Jan 2020 07:07:25 +0000 (07:07 +0000)] 
modules/crypto/: make the libsodium scrypt module encryption-capable

4 years agoconfigure: re-generate
Aaron Jones [Wed, 15 Jan 2020 07:02:10 +0000 (07:02 +0000)] 
configure: re-generate

Fixes: 9ee4aa337c0e2e894597
4 years agoinclude/atheme/argon2.h: prefix macro names
Aaron Jones [Wed, 15 Jan 2020 06:59:49 +0000 (06:59 +0000)] 
include/atheme/argon2.h: prefix macro names

This will eliminate any potential future conflicts with the
definitions contained within <argon2.h> proper.

4 years agosrc/crypto-benchmark/: consolidate code & fixups
Aaron Jones [Wed, 15 Jan 2020 06:54:10 +0000 (06:54 +0000)] 
src/crypto-benchmark/: consolidate code & fixups

- Combine two related small source files into one

- Add missing header inclusion

  It didn't prevent compilation, but it should be included

- Don't print benchmark information twice when not running in
  optimal mode

- Make operation modes exclusionary

- Rename variables in main.c for clearer identification of
  their purpose

- Calculate bench_short_opts[] dynamically from the contents of
  the bench_long_opts[] array

  This will aid future refactoring or feature additions without
  introducing option parsing regressions

- Always print version and library information at start-up

- Rename some command-line options for clearer identification

- Print valid types & digests for Argon2 & PBKDF2 in --help

- Cap the wall-clock time limits (minimum and maximum) for -g

- Remind user they should give -l if giving -o

  But don't print anything if they gave -l but kept it at the
  default value

- Use `unsigned long long' where appropriate to prevent unsigned
  integer truncation or nonsense bit-shifts

- Don't run unnecessary further iteration in optimal bench-
  marking mode if we just so happen to land exactly at the wall-
  clock time limit first

- Clarify note with regards to SASL SCRAM in optimal PBKDF2
  benchmark output

- Document simpler determination methodology in optimal PBKDF2
  benchmarking

4 years agolibathemecore/random_frontend.c: fix buffer off-by-one error
Aaron Jones [Wed, 15 Jan 2020 05:18:52 +0000 (05:18 +0000)] 
libathemecore/random_frontend.c: fix buffer off-by-one error

This was caught by Clang's AddressSanitizer.

4 years agodist/atheme.conf.example: correct erroneous comment
Aaron Jones [Tue, 14 Jan 2020 13:33:29 +0000 (13:33 +0000)] 
dist/atheme.conf.example: correct erroneous comment

The minimum value is the default, so you can't "reset it to its
default" and then subsequently "decrement it".

[ci skip]

4 years agomodules/statserv/pwhashes: fix off-by-one error
Aaron Jones [Sat, 11 Jan 2020 15:46:56 +0000 (15:46 +0000)] 
modules/statserv/pwhashes: fix off-by-one error

sscanf(3) returns the number of items matched, and we're only asking
it to match 7 items.

[ci skip]

4 years agomodules/statserv/pwhashes: mark unused parameter
Aaron Jones [Fri, 10 Jan 2020 18:39:18 +0000 (18:39 +0000)] 
modules/statserv/pwhashes: mark unused parameter

[ci skip]

4 years agomodules/statserv/pwhashes: indicate algorithms for all modules
Aaron Jones [Fri, 10 Jan 2020 18:38:17 +0000 (18:38 +0000)] 
modules/statserv/pwhashes: indicate algorithms for all modules

Also mark plain-text with the appropriate amount of seriousness.

[ci skip]

4 years agomodules/statserv/pwhashes: correct typo
Aaron Jones [Fri, 10 Jan 2020 18:26:14 +0000 (18:26 +0000)] 
modules/statserv/pwhashes: correct typo

[ci skip]

4 years agomodules/statserv/pwhashes: indent hash type names more
Aaron Jones [Fri, 10 Jan 2020 18:21:49 +0000 (18:21 +0000)] 
modules/statserv/pwhashes: indent hash type names more

[ci skip]

4 years agomodules/statserv/: add password hashes statistics module
Aaron Jones [Fri, 10 Jan 2020 18:05:32 +0000 (18:05 +0000)] 
modules/statserv/: add password hashes statistics module

cf. https://github.com/atheme/atheme/issues/688

4 years agosrc/crypto-benchmark/optimal.c: cap iterations to starting value
Aaron Jones [Fri, 10 Jan 2020 03:36:13 +0000 (03:36 +0000)] 
src/crypto-benchmark/optimal.c: cap iterations to starting value

In the extremely unlikely event that the initial iteration count
is faster than the target time, cap the derived iteration count
to the initial one, to prevent it from being exceeded. This
currently only happens on CI (with a reduced initial count) which
has no consequences, but if in some magical pixie dust future
world CPUs become fast enough to do the maximum iteration count
within an acceptable timeframe, don't arrive at a value higher
than the maximum.

[ci skip]

4 years agoBuild System: Include library names with custom paths
Aaron Jones [Fri, 10 Jan 2020 03:25:45 +0000 (03:25 +0000)] 
Build System: Include library names with custom paths

When taking a `--with-foo=/some/directory`, include the library
name itself into the LIBS variable, or it will always fail to link.

4 years agoBuild System: Replace some more missed in previous commit
Aaron Jones [Fri, 10 Jan 2020 02:16:44 +0000 (02:16 +0000)] 
Build System: Replace some more missed in previous commit

[ci skip]

4 years agoBuild System: Replace 'dnl' autoconf comments with '#' shell comments
Aaron Jones [Fri, 10 Jan 2020 01:54:34 +0000 (01:54 +0000)] 
Build System: Replace 'dnl' autoconf comments with '#' shell comments

Ask me how I discovered that a 'dnl' in the middle of AC_LANG_PROGRAM()
renders all 'dnl' comments a syntax error; resulting in autoreconf(1)
aborting on the very first one.

Oh, and it prints that *first* occurence as the source of the problem!
A most-excellent diagnostic.

[ci skip]

4 years agoBuild System: Assign copyright headers to all of our own M4sh files
Aaron Jones [Thu, 9 Jan 2020 20:37:04 +0000 (20:37 +0000)] 
Build System: Assign copyright headers to all of our own M4sh files

4 years agoBuild System: Re-indent M4sh macros with spaces instead of tabs
Aaron Jones [Thu, 9 Jan 2020 20:11:59 +0000 (20:11 +0000)] 
Build System: Re-indent M4sh macros with spaces instead of tabs

These lines are getting very long, and they contain a lot of nested
indentation; make them easier to read and follow along.

4 years agoBuild System: Use CFLAGS instead of CPPFLAGS for pkg-config things
Aaron Jones [Thu, 9 Jan 2020 20:10:16 +0000 (20:10 +0000)] 
Build System: Use CFLAGS instead of CPPFLAGS for pkg-config things

It only ever ends up setting a CPPFLAG in practice anyway (-Ifoo),
but it is named FOO_CFLAGS, so modify CFLAGS with it instead. The
practical consequence of this is nothing, but it is consistent,
especially since we're also modifying LIBS instead of LDFLAGS.
Basically, it's an autotools-ism.

4 years agoBuild System: Rename some configure --with-options for consistency
Aaron Jones [Thu, 9 Jan 2020 20:01:52 +0000 (20:01 +0000)] 
Build System: Rename some configure --with-options for consistency

Strip the "lib" prefix from their name; consistent with the other
library test options.

This does not break backward-compatibility; v7.2 and below do not
support linking to either of these libraries at all.

4 years agoBuild System: Improve library tests
Aaron Jones [Thu, 9 Jan 2020 19:48:38 +0000 (19:48 +0000)] 
Build System: Improve library tests

For libraries that use pkg-config to detect their presence, make
pkg-config optional. This allows the user to set LIBFOO_CFLAGS and
LIBFOO_LIBS and still have it work, whether they have pkg-config
installed or not.

Also make it possible to specify the (full) path to the library
installation directory as an argument to the --with-foo= option.
This assumes that there are "include" and "lib" directories under
it, so use this as a last resort; override pkg-config (as described
above) instead if at all possible.

4 years agoREADME: Fix ommission in previous commit
Aaron Jones [Thu, 9 Jan 2020 17:28:24 +0000 (17:28 +0000)] 
README: Fix ommission in previous commit

[ci skip]

4 years agoREADME: Document some strange build requirements for library features
Aaron Jones [Thu, 9 Jan 2020 17:24:48 +0000 (17:24 +0000)] 
README: Document some strange build requirements for library features

[ci skip]

4 years agomodules/saslserv/scram-sha: log on failures due to MU_NOPASSWORD
Aaron Jones [Mon, 6 Jan 2020 17:33:38 +0000 (17:33 +0000)] 
modules/saslserv/scram-sha: log on failures due to MU_NOPASSWORD

[ci skip]

4 years agomodules/saslserv/plain: log on failures due to MU_NOPASSWORD
Aaron Jones [Mon, 6 Jan 2020 17:33:26 +0000 (17:33 +0000)] 
modules/saslserv/plain: log on failures due to MU_NOPASSWORD

[ci skip]

4 years agomodules/protocol/{charybdis,ircd-seven}: support cmode +u (nofilter)
Aaron Jones [Sun, 5 Jan 2020 17:40:20 +0000 (17:40 +0000)] 
modules/protocol/{charybdis,ircd-seven}: support cmode +u (nofilter)

cf. https://github.com/freenode/ircd-seven/commit/782d48653e68f12dcca3
cf. https://github.com/charybdis-ircd/charybdis/commit/58a70480063bdca25d52

Closes #686

4 years agosrc/crypto-benchmark: warn if using internal digest frontend
Aaron Jones [Fri, 3 Jan 2020 18:25:41 +0000 (18:25 +0000)] 
src/crypto-benchmark: warn if using internal digest frontend

[ci skip]

4 years agoTravis CI: Reduce CPU impact of testing benchmark tool
Aaron Jones [Fri, 3 Jan 2020 17:54:27 +0000 (17:54 +0000)] 
Travis CI: Reduce CPU impact of testing benchmark tool

4 years agoTravis CI: Install libpasswdqc-dev too
Aaron Jones [Fri, 3 Jan 2020 17:17:01 +0000 (17:17 +0000)] 
Travis CI: Install libpasswdqc-dev too