109f31ac23
The FIPS lab is required to test the service indicators and version information services of the module, i.e. the fips140_is_approved_service() and fips140_module_version() functions. There are several ways we could support this: - Implement the tests in the module ourselves. However it's unclear that CMVP would allow this, and we would need the full list of tests, which could change over time depending on what the lab decides to do. - Support the lab writing, building, and loading a custom kernel module (or a custom kernel image) that tests these functions. - Provide a userspace interface to these services, restricted to builds with CONFIG_CRYPTO_FIPS140_MOD_EVAL_TESTING=y. This would allow writing the tests in userspace, which would be much easier. Implement the last solution, since it's the easier of the two solutions that are "guaranteed" to be allowed. Make the module register a char device which supports some ioctls, one per function that needs to be tested. Also provide some sample userspace code in samples/crypto/. Note: copy_to_user() would break the integrity check, so take some care to exclude it. This is allowed since this is non-production code. Bug: 188620248 Change-Id: Ic256d9c5bd4d0c57ede88a3e3e76e89554909b38 Signed-off-by: Eric Biggers <ebiggers@google.com>
31 lines
1.2 KiB
C
31 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
|
|
#ifndef _CRYPTO_FIPS140_EVAL_TESTING_H
|
|
#define _CRYPTO_FIPS140_EVAL_TESTING_H
|
|
|
|
#include <linux/ioctl.h>
|
|
|
|
/*
|
|
* This header defines the ioctls that are available on the fips140 character
|
|
* device. These ioctls expose some of the module's services to userspace so
|
|
* that they can be tested by the FIPS certification lab; this is a required
|
|
* part of getting a FIPS 140 certification. These ioctls do not have any other
|
|
* purpose, and they do not need to be present in production builds.
|
|
*/
|
|
|
|
/*
|
|
* Call the fips140_is_approved_service() function. The argument must be the
|
|
* service name as a NUL-terminated string. The return value will be 1 if
|
|
* fips140_is_approved_service() returned true, or 0 if it returned false.
|
|
*/
|
|
#define FIPS140_IOCTL_IS_APPROVED_SERVICE _IO('F', 0)
|
|
|
|
/*
|
|
* Call the fips140_module_version() function. The argument must be a pointer
|
|
* to a buffer of size >= 256 chars. The NUL-terminated string returned by
|
|
* fips140_module_version() will be written to this buffer.
|
|
*/
|
|
#define FIPS140_IOCTL_MODULE_VERSION _IOR('F', 1, char[256])
|
|
|
|
#endif /* _CRYPTO_FIPS140_EVAL_TESTING_H */
|