To prevent replay attacks, HOTP uses a counter, while TOTP keeps track of the time the key was last used. Since these values have the same type and are never used at the same time, merge them into an anonymous union.
Introduce a new macro, CRYB_I_AM, which replaces CRYB_INIT for projects that provide Cryb components or extensions. Currently, the main difference is that they are not required to have the exact same PACKAGE_VERSION as the Cryb version that they use.
Most importantly, differentiate between library and non-library components. The former can be provided and required, and if provided but disabled, can be replaced by pre-installed versions. The latter can only be provided and cannot be the target of a dependency relationship.
Previously, we always invoked AX_PKG_CONFIG_CHECK() for a disabled component (i.e. a component which we provide but which was disabled on the configure command line). This is both excessive (because we only need to run this check for components that will be needed during the build) and insufficient (because we also need to run it for components from other Cryb projects).
The caveat is needed because if you include one of these headers on a system that defines rsize_t without having the correct incantations in your configure.ac, you are going to have a bad time. But there is no good general solution to the problem.
These macros are designed to work in concert with the AX_PKG_CONFIG macros. It is now possible to disable any component, even if another depends on it, provided that it is already installed. For enabled components, we define the same variables as AX_PKG_CONFIG would, so Makefiles don't need to know if a component they rely on is being built as part of this packge or if it was already installed.
This is the default if the AM_MAINTAINER_MODE macro is not invoked, but invoking it also creates the --disable-maintainer-mode option which some automated build tools use to speed up builds from a clean tree.
Instead of using the enclosing source tree, use automake's distdir target to copy a clean set of sources into WRKSRC. This protects us from a polluted tree, prevents us from polluting it in turn, and allows the ports framework to perform necessary substitutions in libtool and the like.
- The API has changed so that the function now writes its output into a caller-provided buffer, in a style similar to libcryb-enc.
- All parameter values are now correctly percent-encoded.
- The issuer parameter is now supported.
- The API has been redesigned so the caller is now responsible for allocating storage.
- A few more macros and typedefs have been added to clean up the namespace.
- Key parameter validation has been strengthened.
We can read the issuer from a URI (as a separate parameter, not as a prefix to the label) and store it, but not yet output it. That will be implemented in a future rewrite of oath_key_to_uri().
This adds a `CRYB_UNREACHABLE` macro which will cause a segfault if reached, and modifies `CRYB_NO_DEFAULT_CASE` to have essentially the same semantics. It also removes the conditionals since the coverage macros are always defined.
This was harmless as it would either fall through to an empty default statement (if CRYB_COVERAGE was defined) or out of the switch, but it's still bad style.