OpenSSL UserGuide 2.0
OpenSSL UserGuide 2.0
for the
OpenSSL FIPS Object Module v2.0
(including v2.0.1, v2.0.2, v2.0.3, v2.0.4, v2.0.5, v2.0.6, v2.0.7,2.0.8,2.0.9,2.0.10)
OpenSSL Software Foundation
November 5, 2015
Sponsored by:
Page 2 of 207
Sponsored by:
Dell Inc.
sponsor of Beaglebone Black platforms
Page 3 of 207
Acknowledgments
The OpenSSL Software Foundation (OSF) serves as the "vendor" for this validation. Project
management coordination for this effort was provided by:
Steve Marquess
The OpenSSL Software Foundation
1829 Mount Ephraim Road
Adamstown, MD 21710
USA
+1 877-673-6775
[email protected]
[email protected]
[email protected]
http://www.drh-consultancy.co.uk/
[email protected]
[email protected]
[email protected]
http://www.cryptsoft.com/
805-783-0810 tel
805-783-0889 fax
[email protected]
http://www.infogard.com/
Page 4 of 207
Revision History
This document will be revised over time as new information becomes available; check
http://www.openssl.org/docs/fips/ for the latest version. Suggestions for additions, corrections, or
improvement are welcome and will be gratefully acknowledged; please send document error
reports or suggestions to [email protected].
Date
Description
2015-11-05
2015-09-30
2015-09-16
2015-09-05
2015-06-09
2015-04-16
2014-09-02
2014-07-21
2013-12-04
2013-11-01
2013-10-31
2013-09-29
2013-09-13
2013-02-02
2013-01-24
2013-01-10
2013-01-09
2013-01-08
2012-12-02
2012-11-29
2012-11-01
2012-10-25
2012-09-07
2012-07-17
2012-07-03
Page 5 of 207
2012-06-28
2012-05-15
2012-04-09
2012-03-15
2012-02-21
2011-09-07
Page 6 of 207
Table of Contents
1. INTRODUCTION.......................................................................................................................10
1.1 FIPS WHAT? WHERE DO I START?...............................................................................................10
1.2 CHANGE LETTER MODIFICATIONS................................................................................................11
1.3 THE PRIVATE LABEL VALIDATION................................................................................................11
2. BACKGROUND..........................................................................................................................12
2.1 TERMINOLOGY.............................................................................................................................13
2.1.1 FIPS 140-2 Specific Terminology.....................................................................................13
2.1.2 General Glossary.............................................................................................................14
2.2 THE FIPS MODULE AND INTEGRITY TEST.......................................................................................17
2.3 THE FIPS INTEGRITY TEST...........................................................................................................18
2.3.1 Requirement for Exclusive Integrity Test..........................................................................18
2.3.2 Requirement for Fixed Object Code Order......................................................................18
2.4 THE FILE INTEGRITY CHAIN..........................................................................................................19
2.4.1 Source File (Build Time) Integrity....................................................................................19
2.4.2 Object Module (Link Time) Integrity................................................................................20
2.4.3 Application Executable Object (Run Time) Integrity.......................................................20
2.5 RELATIONSHIP TO THE OPENSSL API............................................................................................20
2.6 FIPS MODE OF OPERATION..........................................................................................................22
2.6.1 FIPS Mode Initialization..................................................................................................22
2.6.2 Algorithms Available in FIPS Mode.................................................................................22
2.7 REVISIONS OF THE 2.0 MODULE.....................................................................................................23
2.8 PRIOR FIPS OBJECT MODULES.....................................................................................................25
2.9 FUTURE FIPS OBJECT MODULES...................................................................................................26
3. COMPATIBLE PLATFORMS...................................................................................................27
3.1 BUILD ENVIRONMENT REQUIREMENTS.............................................................................................27
3.2 KNOWN SUPPORTED PLATFORMS....................................................................................................28
3.2.1 Code Paths and Command Sets........................................................................................32
3.2.2 32 versus 64 Bit Architectures..........................................................................................38
3.2.3 Assembler Optimizations..................................................................................................39
3.3 CREATION OF SHARED LIBRARIES...................................................................................................40
3.4 CROSS-COMPILATION.....................................................................................................................40
4. GENERATING THE FIPS OBJECT MODULE.....................................................................43
4.1 DELIVERY OF SOURCE CODE..........................................................................................................43
4.1.1 Creation of a FIPS Object Module from Other Source Code...........................................44
4.1.2 Verifying Integrity of Distribution (Best Practice)...........................................................44
4.2 BUILDING AND INSTALLING THE FIPS OBJECT MODULE WITH OPENSSL (UNIX/LINUX).......................47
4.2.1 Building the FIPS Object Module from Source................................................................47
4.2.2 Installing and Protecting the FIPS Object Module..........................................................49
Page 7 of 207
Page 8 of 207
Page 9 of 207
1.
Introduction
This document is a guide to the use of the OpenSSL FIPS Object Module, a software component
intended for use with the OpenSSL cryptographic library and toolkit. It is a companion document
to the OpenSSL FIPS 140-2 Security Policy document submitted to NIST as part of the FIPS 140-2
validation process. It is intended as a technical reference for developers using, and system
administrators installing, the OpenSSL FIPS software, for use in risk assessment reviews by
security auditors, and as a summary and overview for program managers. It is intended as a guide
for annotation and more detailed explanation of the Security Policy, and not as a replacement. In
the event of a perceived conflict or inconsistency between this document and the Security Policy
the latter document is authoritative as only it has been reviewed and approved by the Cryptographic
Module Validation Program (CMVP), a joint U.S. - Canadian program for the validation of
cryptographic products (http://csrc.nist.gov/cryptval/).
Familiarity with the OpenSSL distribution and library API (Application Programming Interface) is
assumed. This document is not a tutorial on the use of OpenSSL and it only covers issues specific
to the FIPS 140-2 validation. For more information on the use of OpenSSL in general see the many
other sources of information such as http://openssl.org/docs/ and Network Security with OpenSSL
(Reference 4).
The Security Policy document (Reference 1) is available online at the NIST Cryptographic Module
Validation website, http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1747.pdf.
For more information on the OpenSSL Software Foundation see http://openssl.com/. For more
information on the OpenSSL project see http://openssl.org/. For more information on NIST and the
cryptographic module validation program, see http://csrc.nist.gov/cryptval/.
For information and announcements regarding current and future OpenSSL related validations see
http://openssl.org/docs/fips/fipsnotes.html. That web page also has a very quick introduction
extracted here:
1.1
Ok, so your company needs FIPS validated cryptography to land a big sale, and your product
currently uses OpenSSL. You haven't worked up the motivation to wade through the entire User
Guide and want the quick "executive summary". Here is a grossly oversimplified account:
OpenSSL itself is not validated,and never will be. Instead a carefully defined software component
called the OpenSSL FIPS Object Module has been created. The Module was designed for
compatibility with the OpenSSL library so products using the OpenSSL library and API can be
converted to use FIPS 140-2 validated cryptography with minimal effort.
Page 10 of 207
The OpenSSL FIPS Object Module validation is unique among all FIPS 140-2 validations in that
the product is "delivered" in source code form, meaning that if you can use it exactly as is and can
build it for your platform according to a very specific set of instructions, then you can use it as
validated cryptography3.
The OpenSSL library is also unique in that you can download and use it for free.
If you require source code or build process changes for your intended application, then you cannot
use the open source based validated module you must obtain your own validation. This situation
is common; see "Private Label" validation, below.
New FIPS 140-2 validations (of any type) are slow (6-12 months is typical), expensive (US$50,000
is typical for an uncomplicated validation), and unpredictable (completion dates are not only
uncertain when first beginning a validation, but remain so during the process).
Note that FIPS 140-2 validation is a complicated topic that the above summary does not adequately
address. You have been warned!
1.2
If the existing validated OpenSSL FIPS Object Module is almost what you need, but some minor
modifications are necessary for your intended use, then it may be possible to retroactively modify
the original validation to include those necessary changes. The process by which this is done is
known as the maintenance letter or change letter process. A change letter can be substantially
faster and less expensive than obtaining a new, independent validation.
Modifications to the FIPS module to support a new platform (operating system or compiler) are
often compatible with the change letter process.
1.3
The OSF would prefer to work on open source based validations which benefit the OpenSSL user
community at large. However, we understand not all work can benefit the community. We refer to
validations based directly on the OpenSSL FIPS Object Module but not available to the community
as "private label" validations. They are also sometimes referred to as "cookie cutter" validations.
Many ISVs and vendors are interested in private label validations, and the OSF will assist in such
efforts with a priced engagement. An ISV or vendor usually obtains a private label validation for
marketing or risk management purposes. For example, a company may choose to privately retain
its validation to ensure its competitive advantage, or a company might modify the sources and
choose to keep the changes private.
Either directly or via "User Affirmation" which is discussed in 5.5.
Page 11 of 207
OSF has performed numerous private validations for desktop, server, and mobile platforms with
very competitive pricing. Often, the pricing is less than the account setup fee for closed sourced and
locked-in solution. Trivial and uncomplicated validations can often be performed using fixed rate
contracts to assure cost constraints.
2. Background
For the purposes of FIPS 140-2 validation, the OpenSSL FIPS Object Module v2.0 is defined as a
specific discrete unit of binary object code (the FIPS Object Module) generated from a specific
set and revision level of source files embedded within a source distribution. These platform
portable source files are compiled to create the object code in an isolated and separate form. That
object code is then used to provide a cryptographic services to external applications. The terms
FIPS Object Module and FIPS Module elsewhere in this document refer to this OpenSSL FIPS
Object Module object code.
The FIPS Object Module provides an API for invocation of FIPS approved cryptographic functions
from calling applications, and is designed for use in conjunction with standard OpenSSL 1.0.1
distributions. These standard OpenSSL 1.0.1 source distributions support the original non-FIPS
API as well as a FIPS Mode in which the FIPS approved algorithms are implemented by the FIPS
Object Module and non-FIPS approved algorithms are disabled by default. These non-validated
algorithms include, but are not limited to, Blowfish, CAST, IDEA, RC-family, and non-SHA
message digest and other algorithms.
The FIPS Object Module was designed and implemented to meet FIPS 140-2, Level 1
requirements. There are no special steps required to ensure FIPS 140-2 compliant operation of the
FIPS Object Module, other than building, loading, and initializing the FIPS approved and HMACSHA-1 digest verified source code. This process of generating the application executable object
from source code for all supported platforms1 is documented in detail at 4 and 5.
The FIPS Object Module provides confidentiality, integrity signing, and verification services. The
FIPS Object Module supports the following algorithms: Triple DES, AES, CMAC, CCM, RSA (for
digital signatures), DH, DSA/DSA2, ECDSA/ECDSA2, SHA-1, SHA-224, SHA-256, SHA-384,
SHA-512, and HMAC-SHA-1, HMAC-SHA-224, HMAC-SHA-256, HMAC-SHA-384, HMACSHA-512. The FIPS Object Module supports SP 800-90 and ANSI X9.31 compliant pseudorandom number generators.
The FIPS Object Module supports the Suite B cryptographic algorithms and can be used with Suite
B cryptography exclusively. Suite B requires 128-bit security levels and forbids use of TLS lesser
than 1.2 (TLS 1.0 and 1.1 use MD5 as a PRF during key agreement).
By definition, for all platforms to which the validation can be extended. Per the requirements of the Security Policy,
any change to the documented build process renders the result non-FIPS approved.
Page 12 of 207
The FIPS Object Module v2.0 is similar in many respects to the earlier OpenSSL FIPS Object
Module v1.2.x. The v1.2.4 was originally validated in late 2008 with validation certificate #1051;
that original validation has been extended several times to incorporate additional platforms.
The v1.2.x Module is only compatible with OpenSSL 0.9.8 releases, while the v2.0 Module is
compatible with OpenSSL 1.0.1 and later releases. The v2.0 Module is the best choice for all new
software and product development.
2.1
Terminology
The term Officer does not imply a requirement for a military or government official, although some military or
government organizations may choose to restrict the performance of this system administration role to certain official
capacities.
Page 13 of 207
The concept of the cryptographic module is important for FIPS 140-2, and it has subtle nuances in
this context. Conceptually the Module is the binary object code and data in the FIPS Object Module
for a running process.
The cryptographic module is often referred to simply as module. That term is capitalized in
this document as a reminder that it has a somewhat different meaning than assumed by software
developers outside of a FIPS 140-2 context.
Note that traditionally the executable (or shared library) file on disk corresponding to this Module
as a running process is also considered to be a Module5 by the CMVP. An integrity check of the
entire executable file on disk prior to memory mapping is considered acceptable as long as that
executable file does not contain any extraneous6 software. In this traditional case the specific
executable file is submitted for testing and thus the precise content (as a bit string) is known in
advance.
In the case of the FIPS Object Module only source code is submitted for validation testing, so the
bit string value of the binary object code in memory cannot be known in advance. A chain of
checks beginning with the source code and extending through each step in the transformation of the
source code into a running process was established to provide a check equivalent to that used by
more traditional object based validations.
The chain of checks works backwards from the software as resident in memory for a process to the
executable program file from which the process was created (the existing precedent), then to the
FIPS Object Module used to link the program file, and finally to the original source files used to
create the FIPS Object Module. Each of those stages can be thought of as antecedents of the
Module, and the integrity of each needs to be verified to assure the integrity of the Module.
Presumably because the transformations of the disk resident file contents performed by the runtime loader are
considered to be well understood and sufficiently minimal.
6
The definition of what constitutes extraneous is not formally specified and subject to interpretation.
Page 14 of 207
CCM
CDH
CAVP
CMAC
CMVP
CTR
DH
DLL
DRBG
DSA
DSA2
EC
ECC
ECDH
ECDSA
ECDSA2
ELF
ENGINE
EVP
FIPS
FIPS 140-2
Page 15 of 207
FIPS Object Module the special monolithic object module built from the
special source distribution7 identified in the Security
Policy
GCM
Galois/Counter Mode, a mode of operation for
symmetric key cryptographic block ciphers
GPG
See PGP
GUI
Graphical User Interface
HMAC
Hash Message Authentication Code, a mechanism for
message authentication using cryptographic hash
functions
IA
Information Assurance
IDEA
A cryptographic algorithm not allowed in FIPS mode
IKE
Internet Key Exchange, a protocol for exchanging
information required for secure communication.
IP
Internet Protocol, a network communications protocol
IPsec
Internet Protocol Security, a protocol suite for securing
IP communications by authenticating and encrypting
each IP packet
IT
Information Technology
IUT
Implementation Under Test
KAT
Known Answer Test
MASM
The Microsoft assembler, no longer supported by
OpenSSL
MD2
A cryptographic algorithm not allowed in FIPS mode
NEON
an architecture extension for ARM Cortex-A series
processors,
NASM
the open source Netwide ASseMbler, see
http://www.nasm.us/
NID
Name IDentifier for extracting information from a
certificate Distinguished Name.
NIST
National Institute of Science and Technology, see
http://www.nist.gov/
OE
See Operational Environment
Operational Environment
The FIPS 140-2 term for "platform"
OS
Operating System
OSF
The OpenSSL Software Foundation
PCLMULQDQ
an instruction for x86 processors which performs
carry-less multiplication of two 64-bit operands
PGP
Pretty Good Privacy, an encrypted E-mail program
7
Roughly speaking, this special source distribution was created from the OpenSSLfips2_0stable branch in
the CVS source code repository with the command makeVERSION=fips2.0TARFILE=opensslfips
2.0.tarfMakefile.fipsdist.
Page 16 of 207
PKCS#1
PKCS#3
POST
PRNG
RNG
PSS
RSA
SHA
SSE2
SSH
SSL
SSSE3
Suite B
TLS
VMS
x86
XTS
XTS-AES
2.2
The FIPS Object Module is generated in binary file format, with an embedded pre-calculated
HMAC-SHA-1 digest covering the module8 as it is loaded into application address space. The
Module integrity check consists of recalculating that digest from the memory areas and comparing
it to the embedded value which resides in an area not included in the calculated digest9. This incore hashing integrity test is designed to be both executable format independent and fail-safe.
8
Specifically, the text and read-only data segments which constitute the initialized components of the module.
If the digest value resided in the data area included in the calculation of that digest, the calculated value of the digest
would itself be an input into that calculation.
9
Page 17 of 207
For this scenario the Module is the text and data segments as mapped into memory for the running
application.
The term Module is also used, less accurately, to designate the antecedent of that memory mapped
code and data, the FIPS Object Module file residing on disk.
The FIPS Object Module is generated from source code, so the integrity of that source must also be
verified. The single runtime digest check typical of pre-built binary files is replaced by a chain of
digest checks in order to validate that the running code was in fact generated from the original
source code. As before the term Module properly designates the text and data segments mapped
into memory, but is also more loosely used to reference several levels of antecedents. These levels
are discussed below.
2.3
The FIPS 140-2 standard requires an integrity test of the Module to verify its integrity at
initialization. In addition to the requirement that the integrity test validate that the FIPS Object
Module code and data have not changed, two additional implicit requirements for the integrity test
were identified during the validation process.
This assurance was given by showing during testing that corruption of code or data outside of the memory area
containing the FIPS Object Module did not result in an integrity test failure.
11
The definition of what constitutes "extraneous" is not formally specified and thus subject to interpretation.
Page 18 of 207
and
gccorunfilebeta.oalpha.ogamma.o
produce functionally identical executable files. Likewise, the order of object modules in a static
link library is irrelevant:
arrlibxxx.aalpha.obeta.ogamma.o
and
arrlibxxx.abeta.oalpha.ogamma.o
produce interchangeable link libraries, and a given application may not incorporate all of the object
modules contained with the link library when resolving references. For the FIPS Object Module it
was required that any such omission or rearrangement of the Module object modules during the
application creation process not occur. This requirement is satisfied by simply compiling all the
source code into a single monolithic object module:
ldrofipscanister.ofips_start.o...fips_end.o
with all the object modules between the fips_start.o and fips_end.o modules that define the
low and high boundaries of a monolithic object module. All subsequent reference to this
monolithic object module will preserve the relative order, and presence, of the original object code
components.
2.4
Most validated products consisting of a pre-built binary executable implement the module integrity
check as a digest check over portions of that executable file or the corresponding memory mapped
image. For the FIPS Object Module the module integrity check instead takes the form of a chain of
digest checks beginning with the source files used for the CMVP validation testing. Note that
while this chain of checks is more complex, it provides much more visibility for independent
verification compared to the case of validated pre-built binary executables. With the FIPS Object
Module the prospective user can independently verify that the runtime executable does indeed
directly derive from the same source that was the basis of the validation.
Page 19 of 207
Note that a means to calculate the HMAC-SHA-1 digest is required in order to perform this
integrity check. A bootstrap standalone HMAC-SHA-1 utility, fips_standalone_sha1, is
included in the distribution. This utility is generated first before the sequestered files are compiled
in order to perform the integrity check. Appendix C gives an example of an equivalent utility.
2.5
The FIPS Object Module is designed for indirect use via the OpenSSL API. Applications linked
with the "FIPS capable" OpenSSL libraries can use both the FIPS validated cryptographic functions
of the FIPS Object Module and the high level functions of OpenSSL. The FIPS Object Module
should not be confused with OpenSSL library and toolkit or any specific official OpenSSL
distribution release.
Page 20 of 207
A version of the OpenSSL product that is suitable for use with the FIPS Object Module is a FIPS
Compatible OpenSSL.
When the FIPS Object Module and a FIPS compatible OpenSSL are separately built and installed
on a system, with the FIPS Object Module embedded within the OpenSSL library as part of the
OpenSSL build process, the combination is referred to as a FIPS capable OpenSSL.
Summary of definitions
The FIPS Object Module is the FIPS 140-2 validated module described in the Security Policy
A FIPS compatible OpenSSL is a version of the OpenSSL product that is designed for compatibility with
the FIPS Object Module API
A FIPS capable OpenSSL is the combination of the separately installed FIPS Object Module along with a
FIPS compatible OpenSSL.
Table 2.5
The OpenSSL libraries, when built from a standard OpenSSL distribution with the fips
configuration option for use with the FIPS Object Module, will contain the usual non-FIPS
algorithms and non-cryptographic supporting functions, and the non-FIPS algorithm disabling
restrictions.
Note that use of individual object modules comprising the monolithic FIPS Object Module is
specifically forbidden by FIPS 140-2 and the CMVP12. In the absence of that restriction the
individual object modules would just be incorporated directly in the OpenSSL libcrypto.a
library. The monolithic FIPS Object Module must be used in its entirely and cannot be edited to
accommodate size constraints.
Various non-FIPS algorithms such as Blowfish, IDEA, CAST, MD2, etc. are included in the
OpenSSL libraries (depending on the ./config options specified in addition to fips). For
applications that do not utilize FIPS 140-2 cryptography, the resulting libraries are drop-in
compatible with the libraries generated without the fips option (a deliberate design decision to
encourage wider availability and use of FIPS 140-2 validated algorithms). The converse is not true:
12
Actually, to encourage use of fipscanister.o even in non-FIPS mode applications, a copy is incorporated into
libcrypto.a, but special care is taken to preclude its usage in FIPS enabled applications. The fipsld utility
provided in the FIPS compatible OpenSSL distributions prevents that usage as follows. In static link context that is
achieved by referencing the official fipscanister.o first on the command line., and in dynamic link context by
temporarily removing it from libcrypto.a. This removal is necessary because dynamic linking is commonly
accompanied by wholearchive, which would force both copies of fipscanister.o into the shared library.
Note the integrity check is designed as a failsafe precaution in the event of link errors -- even if two copies are
included into the application in error, the integrity check will prevent the use of one copy for the integrity test and the
other for the actual implementation of cryptography. In other words, if both the official fipscanister.o and the
unvalidated version that is embedded in libcrypto.a both end up in an executable binary, and if
FIPS_mode_set() returns success, the unvalidated copy will not be used for cryptography.
Page 21 of 207
a non-FIPS OpenSSL library cannot be substituted for the FIPS Compatible library because the
FIPS specific function calls will not be present (such as FIPS_mode_set()).
2.6
Applications that utilize FIPS mode must call the FIPS_mode_set() function. After successful
FIPS mode initialization, the non-FIPS algorithms will be disabled by default.
The FIPS Object Module together with a compatible version of the OpenSSL product can be used
in the generation of both FIPS mode and conventional applications. In this sense, the combination
of the FIPS Object Module and the usual OpenSSL libraries constitutes a FIPS capable API, and
provide both FIP approved algorithms and non-FIPS algorithms.
Page 22 of 207
disabling is intended as an aid to the developer in preventing the accidental use of non-FIPS
algorithms in FIPS mode, and not as an absolute guarantee. It is the responsibility of the application
developer to ensure that only FIPS algorithms are used when in FIPS mode.
OpenSSL provides mechanisms for interfacing with external cryptographic devices, such as
accelerator cards, via ENGINES. This mechanism is not disabled in FIPS mode. In general, if a
FIPS validated cryptographic device is used with OpenSSL in FIPS mode so that all cryptographic
operations are performed either by the device or the FIPS Object Module, then the result is still
FIPS validated cryptography.
However, if any cryptographic operations are performed by a non-FIPS validated device, the result
is use of non-validated cryptography. It is the responsibility of the application developer to ensure
that ENGINES used during FIPS mode of operation are also FIPS validated.
2.7
Existing FIPS 140-2 validations can be retroactively modified, within defined limits, via the
"maintenance letter" or "change letter" process. Change letter modifications are typically done to
correct minor "non-cryptographically significant" bugs or, most commonly, to add support for new
platforms. Change letter actions are usually less expensive and faster than a full validation; and are
an attractive option to the software vendor desiring to use the FIPS module for a platform not
currently covered by the validation.
Several change letter modifications were in process prior to the formal award of the initial
OpenSSL FIPS Object Module v2.0 validation. More change letters are anticipated over the
lifetime of the validation. For all past validations we have always been careful to introduce any
changes in a way that will not impact any previously tested platforms, so that the most recent
revision of the module can be used for new deployments on any platform.
The history of new revisions include:
2.0.1
2.0.1
2.0.1
2.0.1
2.0.1
2.0.1
2.0.2
2.0.2
2.0.3
2.0.3
2.0.3
2.0.3
Page 23 of 207
2.0.3
2.0.3
2.0.3
2.0.3
2.0.3
2.0.4
2.0.5
2.0.5
2.0.5
2.0.5
2.0.5
2.0.5
2.0.5
2.0.5
2.0.5
2.0.5
2.0.6
2.0.7
2.0.7
2.0.7
2.0.7
2.0.7
2.0.7
2.0.7
2.0.7
2.0.7
2.0.7
2.0.8
2.0.8
2.0.8
2.0.8
2.0.8
2.0.9
2.0.9
2.0.9
2.0.9
Page 24 of 207
2.0.10 Addition of iOS 8.1 64-bit on Apple A7 (ARMv8) with/without NEON and Crypto
Extensions
2.0.10 Addition of VxWorks 6.9 on Freescale P2020 (PPC)
2.0.10 Addition of iOS 8.1 32-bit on Apple A7 (ARMv8) with/without NEON
2.0.10 Addition of Android 5.0 32-bit on Qualcomm APQ8084 (ARMv7) with/without
NEON
2.0.10 Addition of Android 5.0 64-bit on SAMSUNG Exynos7420 (ARMv8) with/without
NEON and Crypto Extensions
Revisions 2.0.6 and 2.0.7 constitute an unfortunate perversity. The 2.0.6 revision removed the Dual
EC DRBG implementation which at the time of submission of the official paperwork (Maintenance
Letter) on January 20, 2014 had already been officially repudiated by NIST. However, approval of
the 2.0.6 revision languished for more than six months. In the meantime eleven13 new platforms
were tested using the most recent officially approved revision, 2.0.5, plus platform specific
modifications, resulting in revision 2.0.7 which still included the Dual EC DRBG revision14. The
official paperwork for the 2.0.7 revision was submitted months after 2.0.6 but both revisions were
approved with the span of a single week, with the preverse result that the 2.0.7 revision of the
OpenSSL FIPS Object Module still contained the deprecated and disgraced Dual EC DRBG. It was
again (and permanently) removed with revision 2.0.8.
Note that 2.0.10 will be the last revision for the #1747 validation, due to the risk of a new "hostage"
situation (see http://openssl.com/fips/aftermath.html).
2.8
The 2.0 version of the FIPS Object Module is the latest in a series of open source based validated
modules derived from the OpenSSL product. As with those prior modules this version is delivered
in source code form and results in a statically linked object module.
There are some differences with respect to the previous version 1.2.x series of modules which have
been widely used, both directly as validated for certificate #1051, and indirectly as models for
separate "private label" validation. Some of the key differences are:
1. The source code distribution for the 1.2.x FIPS modules was a modified OpenSSL
distribution that contained a considerable amount of code superfluous to the generation of
the FIPS module. The 2.0 FIPS module is provided in a separate dedicated source
distribution containing far less extraneous code.
13
Only ten new platforms acually appeared with the 2.0.7 revision due to an unexplained "paperwork error" at the
CAVP which required repeating some of the algorithm tests for the eleventh platform which was thus omitted from the
2.0.7 revision. The eleventh platform will be included in a future revision.
14
Approval of the removal of Dual EC DRBG implementation was far from certain; several interested parties including
one accredited test lab were absolutely certain it would not be permitted. While that issue was pending we did not want
to put the eleven new platforms at risk by testing on a revision that omitted Dual EC DRBG. As it was the unfortunate
sponsors of those new platforms had to wait up to six months for final official approval.
Page 25 of 207
2. The 1.2.x FIPS modules were compatible only with the "FIPS capable" 0.9.8 baseline. The
2.0 FIPS module is compatible with the "FIPS capable" 1.0.1 baseline, and will probably
remain usable with future OpenSSL versions (1.1.0 and later).
3. The 2.0 FIPS module has a significantly faster POST performance. The slow POST for the
1.2.x modules was a significant impediment to use on some low-powered processors.
4. The 2.0 FIPS module contains several additional cryptographic algorithms, including all of
Suite B.
5. The 2.0 FIPS module more directly accommodates cross-compilation, as both native and
cross-compilation now use the same technique for determining the module integrity digest
at build time.
2.9
The open source based OpenSSL FIPS Object Module validations are difficult and expensive, and
as a result have been done infrequently. The long intervals between validations compound the
difficulty of obtaining each new validation:
1. The companion OpenSSL product changes significantly, requiring significant rework to
both that product and the new FIPS module for the "FIPS capable" functionality;
2. A number of new and relatively untried algorithm tests are introduced by the CAVP;
3. New validation requirements are introduced by the CMVP.
The result is a vicious cycle: the new validation takes much more effort and time, during which
these factors continue to mount (the CMVP can and does introduce new requirements in the course
of an ongoing validation). That cost and difficulty becomes an intimidating factor for planning, and
soliciting funding and/or collaboration for, the next validation.
In order to try and bypass this cycle the OSF would like to perform open source based validations
more frequently, ideally as often as the interval required to obtain a validation which is about a
year. That would mean that at any point in time there will be a relatively current completed
validation and a new validation in process. New features or modifications that would adversely
impact the ongoing validation can then be deferred to the next upcoming one. New requirements
and algorithm tests can be addressed a few at a time instead of all at once in a huge onslaught.
Potential sponsors of such an effort are welcome, and are invited to contact OSF to express their
interest.
Page 26 of 207
3.
Compatible Platforms
The FIPS Object Module is designed to run on a wide range of hardware and software platforms.
Any computing platform that meets the conditions in the Security Policy can be used to host a FIPS
140-2 validated FIPS Object Module provided that module is generated in accordance with the
Security Policy.
At the time the OpenSSL FIPS Object Module v2.0 was developed, all Unix15-like environments
supported by the full OpenSSL distribution were also supported by the FIPS validated source files
included in the FIPS Object Module. However, successful compilation of the FIPS Object Module
for all such platforms was not verified. If any platform specific compilation errors occur that can
only be corrected by modification of the FIPS distribution files (see Appendix B of the Security
Policy), then the FIPS Object Module will not be validated for that platform.
It is also noted that a platform which is currently supported (but untested) may not be supported in
the future as revisions are made to the FIPS validated sources. For example, a change made for one
platform may adversely affect another, untested platform.
By default, the FIPS Object Module software utilizes assembly language optimizations for some
supported platforms. Currently assembler language code residing within the cryptographic module
boundary is used for the x86/Intel 16 ELF and ARM17 machine architectures. The FIPS Object
Module build process will automatically select and include these assembly routines by default
when building on a x86 platform. The assembly language code was included in the validation
testing, so a FIPS Object Module built using the x86/Intel assembly language routines will result
in a FIPS 140-2 validated Object Module. Assembly Language and Optimizations are discussed in
detail in Section 3.2.3 Assembler Optimizations.
3.1
The platform portability of the FIPS Object Module source code is contingent on several basic
assumptions about the build environment:
1. The environment is either a) Unix-like with a make command and a ld command with
a r (or i) option, or Microsoft Windows.
Creation of the monolithic FIPS Object Module fipscanister.o requires a linker
capable of merging several object modules into one. This requirement is known to be a
problem with VMS and some older versions of LD.EXE under Windows.
15
Page 27 of 207
2. The compiler is required to place variables declared with the const qualifier in a read-only
segment. This behavior is true of almost all modern compilers. If the compiler fails to do
so the condition will be detected at run-time and the in-core hashing integrity check will
fail.
3. The platform supports execution of compiled code on the build system (i.e. build host and
target are binary compatible); or an appropriate "incore" utility is available to calculate the
digest from the on-disk resident object code. See further discussion of cross-compilation in
3.4.
4. Cross-compilation uses a technique for determining the integrity check digest that may not
work for all cross-compilation environments, so each such new environment must be
analyzed for suitability. See further discussion of cross-compilation in 3.4.
3.2
The generation of a monolithic object module and the in-core hashing integrity test have been
verified to work with both static and shared builds on the following platforms (note the ./config
shared option is forbidden by the terms of the validation when building a FIPS validated
module, but the fipscanister.o object module can be used in a shared library18). Note a
successful build of the FIPS module may be possible on other platforms; only the following were
explicitly tested as of the date this document was last updated:
18
Page 28 of 207
uClinux26 on ARMv4
VxWorks27 on MIPS28
DSP Media Framework 1.4 on TI29 C64x+
Apple30 iOS on ARMv7
Windows CE on ARMv7
NetBSD31 on PowerPC
NetBSD on x86-64
Among the platforms known to not be supported are Windows on x86-64 with AES-NI, VMS32,
Mac OS X33.
Platform Cross Reference
Operating System
Processor
ARMv4
ARMv6
26
Page 29 of 207
ARMv7
ARMv7 NEON
IA64 32 bit
IA64 64 bit
MIPS
PowerPC
SPARCv9 32 bit
SPARCv9 64 bit
x86-64 32 bit
x86-64 64 bit
Table 3.2
A commonly asked question is "does this validation extend to my specific platform X"? For
instance: is use of the Module validated on CentOS x86-64 when CentOS was not formally tested
but Fedora was? Or is use with Linux kernel 2.6.35 validated when only 2.6.33 was formally
tested? Unfortunately there is no hard and fast answer to such questions.
Based on extensive discussions over the years we have developed some informal rules of thumb to
determine when a given target platform corresponds with a formally tested platform (Operational
Environment)
Important Disclaimer
Only the CMVP can provide authoritative answers to questions
about FIPS 140-2. The following discussion represents the unenlightened and non-authoritative opinions of persons and
institutions lacking any official standing to interpret the meaning or
intent of FIPS 140-2 or the validation process. CMVP guidance
always takes precedence over any statements in this document.
Rules of thumb:
Page 30 of 207
1. Does the target system "code path" (see following section) correspond with that of a
formally tested platform?
2. Do any run-time selectable optimizations (see section 3.2.3) correspond with those of a
formally tested platform?
3. Will a binary module that builds and runs on one of the formally tested platforms (or was
built on the build-time system for a formally tested cross-compiled platform) run as-is on
the target system?
4. Does the processor "core" (ARMv6 versus ARMv7, for instance) correspond to that of a
formally tested platform? Here the consideration is ABI compatibility -- two processors
which can interchangeably execute the same set of machine instructions are effectively
equivalent.
5. Does the "major" OS version (e.g. Solaris 10 versus Solaris 11) correspond to that of a
formally tested platform? The "major" version is generally taken to be the full revision
label for OS's using only one or two "dot" levels (e.g., Android 2.2 or Solaris 10, 11), and
the first two "dot" levels for OS's using more than two "dot" levels (e.g., Linux 2.6.37,
uCLinux 0.9.29)34.
If the answer to all of these questions is "yes" then -- in general -- the prospective target platform
can in general be reasonably considered as equivalent to a formally tested platform.
Arguments based on apparent "common sense" considerations should be used cautiously where
FIPS 140-2 is concerned, but where general purpose validated software modules are concerned a
little thought shows that strict insistence on an exact match between target platforms and formally
tested Operational Environments would make it effectively impossible to widely deploy validated
software through most enterprises. For instance, one of the formally tested platforms was "Android
2.2.20.A995" on an "ARMv7 rev 2 v71" processor. If a formally tested platform had to correspond
at that level of detail then provision of validated modules would be very difficult, as the extensive
amount of time required to obtain a FIPS 140-2 validation means that the specific platform used for
testing will be updated or obsolete by the time the validation is completed.
The role of the compiler used for building the validated Module has never been fully delineated.
The general and unofficial consensus of the FIPS 140-2 user and test lab communities appears
to be that the precise version of the compiler need not correspond exactly with that used for the
generation of the formally tested Module (for instance, gcc 4.4.1 versus 4.4.7).
If a review determines that no formally tested platform corresponds to the target platform of
interest, there are several options:
34
Note this rule of thumb has implications for the recent and more or less arbitrary jump of the Linux kernel version
number from 2.6.x to 3.0.x.
Page 31 of 207
1. Vendor or user "affirmation" per section G.5 of the Implementation Guidance document
(Reference 3). This topic is discussed in more detail in 5.5.
2. A "change letter" modification to extend an existing validation to include the platform of
interest. The change letter process can often be performed in a few weeks with a price tag
in the low five figures, as opposed to the many months and high five figure to low six figure
price tag of a conventional full validation.
3. A full validation leveraging the source code and documentation from the OpenSSL FIPS
Object Module validation. Such a "private label" validation will still take many months but
is typically much less expensive than an unrelated validation. An advantage of the "private
label" validation is that upon formally engaging an accredited test lab the vendor becomes
eligible35 to have the prospective module listed on the "Modules In Process" list36
(http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140InProcess.pdf). The presence
of a vendor module on that list is a sufficient condition for completion of many procurement
actions in the U.S. Department of Defense and federal government.
Command Set
Representative Platform
Linux/Unix
Windows
Linux/Unix
Windows
U1
W1
u1
w1
35
Strictly speaking the test lab must also be in possession of drafts of all required documentation. In the case of private
label validations closely modeled on an OpenSSL FIPS Object Module validation that is readily accomplished, usually
before the formal contract with the test lab is executed.
36
The "Module in Process" list is often referred to as the "pre-val" list.
Page 32 of 207
Code Path
Command Set
Representative Platform
Linux/Unix
Windows
Linux/Unix
Windows
pure C 64 bit
U2
W2
u1
w2
x86 assembler
U3
W3
u2
w3
U4
W4
u2
Table 3.2.1a - Code Paths and Command Sets
w4
x86-64 assembler
Build Commands
U1 Linux/Unix, pure C
./confignoasm
make
makeinstall
./config
make
makeinstall
W1 Windows, pure C
ms\do_fipsnoasm
ms\do_fips
Actual System
OS - Processor - Optimization
NEON
NEON
None
None
uCLinux on ARMv4
uClinux 0.9.29
None
Page 33 of 207
Generic System
Actual System
OS - Processor - Optimization
None
None
Ubuntu 10.04
None
Android 2.2
(Motorola Xoom)
10
Linux 2.6.27
11
12
AES-NI
13
None
16
Android 2.2
NEON
17
C64x+ DSP
DSP Media
Framework 1.4
TI C64x+
None
19
VxWorks 6.8
TI TNETV1050 (MIPS)
None
20
Linux 2.6
None
21
Linux 2.6
TI TMS320DM6446 (ARMv4)
None
22
Linux 2.6.32
TI AM3703CBP (ARMv7)
None
23
Solaris 10 32bit
SPARC-T3 (SPARCv9)
None
24
Solaris 10 64bit
SPARC-T3 (SPARCv9)
None
25
Solaris 11 32bit
None
26
Solaris 11 64bit
None
27
Solaris 11 32bit
AES-NI
Page 34 of 207
AES-NI
None
None
Generic System
Actual System
OS - Processor - Optimization
28
Solaris 11 64bit
29
30
CascadeOS 6.1 3 on x86 32 bit CascadeOS 6.1 32bit Intel Pentium T4200 (x86)
None
31
CascadeOS 6.1 3 on x86 64 bit CascadeOS 6.1 64bit Intel Pentium T4200 (x86)
None
32
None
33
None
34
AES-NI
35
Oracle Linux 6
None
36
AES-NI
37
Solaris 11 32bit
SPARC-T3 (SPARCv9)
None
38
Solaris 11 64bit
SPARC-T3 (SPARCv9)
None
39
Android 4.0
(Motorola Xoom)
None
40
Linux 2.6
Freescale PowerPC-e500
None
41
ARMv7
None
42
WinCE 6.0
ARMv5TEJ
None
43
WinCE 5.0
ARMv7
None
44
Android 4.0
OMAP 3
NEON
45
NetBSD 5.1
PowerPC-e500
None
46
NetBSD 5.1
None
47
Windows 2008
None
48
Windows 2008
None
49
RHEL 6
None
50
RHEL 6
None
Page 35 of 207
AES-NI
None
Generic System
Actual System
OS - Processor - Optimization
51
Windows 7
AES-NI
52
Android 4.1
TI DM3730 (ARMv7)
None
53
Android 4.1
TI DM3730 (ARMv7)
NEON
54
Android 4.2
None
55
Android 4.2
NEON
56
Windows Embedded
Compact 7
NEON
57
Windows Embedded
Compact 7
NEON
58
Android 4.0
59
VMware Horizon
Mobile 1.3 under
VMware under
Android 4.0
NEON
60
Apple OS X 10.7
None
61
NEON
62
OpenWRT 2.6
MIPS 24Kc
None
63
QNX 6.4
None
64
None
65
eCos 3 on ARMv5TEJ
eCos 3
None
66
VMware Horizon
Intel Xeon E3-1220 (x86)
Workspace 1.5 under
vSphere
None
67
VMware Horizon
Intel Xeon E3-1220 (x86)
Workspace 1.5 under
vSphere
AES-NI
68
Ubuntu 13.04
None
(ARMv7)
Page 36 of 207
Generic System
Actual System
OS - Processor - Optimization
69
NEON
70
Linux 3.8
ARM926 (ARMv5TEJ)
None
71
None
72
AES-NI
73
None
74
AES-NI
75
None
76
AES-NI
77
None
(ARMv7)
78
NEON
79
None
80
AES-NI
81
Linux 2.6
None
82
AcanOS 1.0
None
83
AcanOS 1.0
AES-NI
84
AcanOS 1.0
None
85
FreeBSD 8.4
None
86
FreeBSD 9.1
None
Page 37 of 207
Generic System
Actual System
OS - Processor - Optimization
87
FreeBSD 9.1
AES-NI
88
ArbOS 5.3
None
89
ArbOS 5.3
AES-NI
90
Linux ORACLESP
2.6
None
91
Linux ORACLESP
2.6
None
92
FreeBSD 9.2
None
93
FreeBSD 9.2
AES-NI
94
FreeBSD 10.0
None
95
FreeBSD 10.0
AEs-NI
96
97
98
99
100
Table 3.2.1c - Representative Systems
Page 38 of 207
Since the command sets included in the validation testing do not permit the explicit specification of
the compile time options that would otherwise be used to specify the generation of 32 or 64 bit
code, it may be necessary for some platforms to build a 32 bit FIPS Object Module on a 32 bit
system, and conversely for 64 bit.
It is also possible on most 64-bit platforms to install a 32-bit build environment which would be
supported. Details as to how to configure such an environment are beyond the scope of this
document.
No optimization (plain C)
SSE2 optimization
AES-NI+PCLMULQDQ+SSSE3 optimization
Note that other theoretically possible combinations (e.g. AES-NI only, or SSE3 only) are not
addressed individually, so that a processor which does not support all three of AES-NI,
PCLMULQDQ, and SSSE3 will fall back to only SSE2 optimization.
The runtime environment variable OPENSSL_ia32cap=~0x200000200000000 disables use of
AES-NI, PCLMULQDQ, and SSSE3 optimizations for x86-64.
For ARM there are two possible optimization levels:
1.
2.
Without NEON
With NEON (ARM7 only)
The runtime variable OPENSSL_armcap=0 disables use of NEON optimizations for ARM.
Page 39 of 207
If all optimization levels have not been formally tested for a given platform, care must be taken to
verify that the optimizations enabled at run-time on any target systems correspond to a formally
tested platform. For instance, if "Windows on x86 32-bit" was formally tested but "Windows on
x86 with AES-NI 32-bit" was not37 then the Module would be validated when executed on a nonAES-NI capable target processor, but would not be validated when executed on an AES-NI capable
system. Note the processor optimization capabilities will often not be obvious to administrators or
end users installing software.
When the target platforms are not known to have capabilities corresponding to tested platforms
then the risk of inadvertently utilizing the unvalidated optimizations at run-time can can be avoided
by setting the appropriate environment variables at run-time38:
Disabling run-time selectable optimizations
Platform
3.3
Environment Variable
Value
x86/x86-64
OPENSSL_ia32cap
~0x200000200000000
ARM
OPENSSL_armcap
The FIPS Object Module is not directly usable as a shared library, but it can be linked into an
application that is a shared library. A FIPS compatible OpenSSL distribution will automatically
incorporate an available FIPS Object Module into the libcrypto shared library when built using
the fips option (see 4.2.3).
3.4
Cross-compilation
Compilers and linkers are separate programs which work together to generate object code for a
target system. They are also programs composed of object code that is executed on the build
system. When the build and target systems are the same we say the process is referred to as a
"native" build; when they are different it is referred to as a "cross-compilation" build.
Many compilers and linkers (or build environments containing compilers and linkers) are capable
of creating object code for multiple target platforms. For the case of the native build the
./configcommand39 automatically determines the target system from the characteristics of the
build system. This determination is made by setting a series of variables that are used to select an
37
This was the case as of the initial OpenSSL FIPS Object Module 2.0 validation, though such platforms may be added
by subsequent modifications.
38
An alternative is to sponsor the addition of the unsupported platform optimization to the validated Module
39
Microsoft Windows platforms are handled somewhat differently and are discussed elsewhere.
Page 40 of 207
Page 41 of 207
/usr/bin/perl./Configureandroidarmv7Wa,noexecstack
$
When building using cross-compilation a different technique must be used to determine the
embedded integrity check digest value. For native builds an interim executable is created and
executed to calculate this digest from live memory, in the same way that the digest is calculated at
runtime during the POST integrity test. When cross-compiling that technique cannot be used
because the cross-compiled executables cannot (in general) be run on the build host.
Instead of building and executing an interim executable, a special purpose utility is used to
calculate the digest by examining the cross-compiled object code as it resides on disk. One such
utility, incore, is provided to handle ELF formats. Even though this utility is effectively platform
neutral on most Linux-like operating systems , the process as a whole is not designed to work with
arbitrary ELF code and can be relied on only for explicitly verified cross-compile cases as reflected
in fips/fips_canister.c. Accommodation of new cross-compilation targets is likely to be trivial but
will still require separate validation.
Thus, although the incore utility is theoretically capable of handling arbitrary ELF binary code
(native or not), it is not used in non-cross-compile/native cases. Cross-compiled non-ELF
platforms would require different utilities and separate validation.
In general the C compiler is required to segregate constant data in a contiguous area (e.g. by placing
it in a dedicated segment) to compile the FIPS module. Some compilers were found to fail to meet
the const data segment requirement. In the cases where the errant behavior was observed, the
compiler was instructed to generate position-independent code40.
In such cases it might be possible to rectify the problem by defining the __fips_constseg macro in
fips/fipssyms.h and harmonizing that definition with declaration of FIPS_rodata_start and
FIPS_rodata_end in fips/fips_canister.c. Unfortunately, such an approach will require a separate
FIPS 140-2 validation, however.
40
The primary reason for compiling the FIPS 2.0 module with -fPIC is for versatility, so that the fipscanister object
module will be usable in either the context of a statically-linked application or dynamic library. Use of non-PIC code
is inappropriate in a dynamic library, but linking PIC statically was proven to work on all tested platforms. Thus,
where such versatility is not of interest then -fPIC could be dropped to target statically-linked applications only. A
separate validation will be required, of course.
Page 42 of 207
4.
This section describes the creation of a FIPS Object Module for subsequent use by an application.
The Security Policy provides procedures for acquiring, verifying, building, installing, protecting,
and initializing the FIPS Object Module. In case of discrepancies between the User Guide and the
Security Policy, the Security Policy should be used.
Finally, recall from Section 2.4.2, Object Module (Link Time) Integrity, that applications link
against libcrypto.so or libcrypto.a, and not directly to fipscanister.o.
4.1
The OpenSSL FIPS Object Module software is only available in source format. The specific source
code distributions can be found at http://www.openssl.org/source/41. as files with names of the form
openssl-fip-2.0.N.tar.gz where the revision number N reflects successive extensions of the FIPS
Object Module to support additional platforms:
http://www.openssl.org/source/openssl-fips-2.0.tar.gz
http://www.openssl.org/source/openssl-fips-2.0.1.tar.gz
http://www.openssl.org/source/openssl-fips-2.0.2.tar.gz
The latest revision will be suitable for all tested platforms, whereas earlier revisions will work only
for the platforms tested as of that revision.
The CMVP introduced significant new requirements for verification of the 2.0 source code
distribution. This requirement is discussed in more detail in 4.1.3; but in summary, it can no
longer be downloaded and used as before. A "trusted path" must be used for transfer of the source
code distribution.
At present the one method known to satisfy the trusted path requirement is
obtain the source code distribution from the vendor of record (OSF) on
physical media (CD). For instructions on requesting this CD see
http://openssl.com/fips/verify.html.
The OpenSSL FIPS Object Module software was delivered to the FIPS 140-2
testing laboratory in source form as this complete OpenSSL distribution, and was built by the
testing laboratory using the standard build procedure as described in the Security Policy document
and reproduced below and in Appendix B.
Closely related distributions lacking binary curve ECC, opensl-fips-ecp-2.0.N.tar.gz, are also available; see 6.5.
41
Page 43 of 207
Page 44 of 207
In this example the key id is 0x49A563D9. Next see if this key id belongs to one of the OpenSSL
core team members authorized to sign distributions. The authorized keys are listed in Appendix A.
Note that some older versions of gpg will not display the key id of an unknown public key; either
upgrade to a newer version or load all of the authorized keys.
If the hexadecimal key id matches one of the known valid OpenSSL core team keys then download
and import the key.
PGP keys can be downloaded interactively from a keyserver web interface or directly by the pgp or
gpg commands.
The hexadecimal key id of the team member key (for example, the search string "0x49A563D9"
can be used to download the OpenSSL PGP key from a public keyserver
(http://www.keyserver.net/, http://pgp.mit.edu, or others). Keys can be downloaded interactively to
an intermediate file or directly by the pgp or gpg program.
Once downloaded to an intermediate file, markcox.key in this example, the key can be imported
with the command:
$gpgimportmarkcox.key
gpg:key49A563D9:publickey"MarkCox<[email protected]>"imported
gpg:Totalnumberprocessed:1
gpg:imported:1(RSA:1)
$
verifycdExample 4.1.2b - Importing a Key from a Downloaded file
These examples assume the pgp or gpg software is installed. The key may also be imported
directly into your keyring:
$gpgkeyserverpgp.mit.edurecvkey49a563d9
gpg:key49A563D9:publickey"MarkCox<[email protected]>"imported
gpg:Totalnumberprocessed:1
gpg:imported:1(RSA:1)
Example 4.1.2c - PGP Key Import
Note that at this point we have not yet established that the key is authentic or that the distribution
was signed with that key; a key that might be authentic has been obtained in a form where it can be
utilized for further validation.
Page 45 of 207
To verify that the distribution file was signed by the imported key use the pgp or gpg command
with the signature file as the argument, with the distribution file also present in the same directory:
$gpg/work/build/openssl/openssl1.0.1.tar.gz.asc
gpg:SignaturemadeTueSep3009:00:372009usingRSAkeyID49A563D9
gpg:Goodsignaturefrom"MarkCox<[email protected]>"
gpg:aka"MarkCox<[email protected]>"
gpg:aka"MarkCox<[email protected]>"
gpg:aka"MarkCox<[email protected]>"
gpg:aka"MarkCox<[email protected]>"
gpg:aka"MarkCox<[email protected]>"
gpg:WARNING:Thiskeyisnotcertifiedwithatrustedsignature!
gpg:Thereisnoindicationthatthesignaturebelongstotheowner.
Primarykeyfingerprint:7B7919FA716B87250E7721E552D983BF
$
Example 4.1.2d - PGP File Signature Verification
In this example the validity of the file signature with respect to the key was verified. That is, the
target file opensslfips2.0.tar.gz was signed by the key with id 49A563D9. The
warning message in this example is alerting the key is not part of the "web of trust", a relational
ranking system based on manually assigned confidence levels. Instead of relying on the web of
trust which will differ from one user to another, the key should be matched directly to a list of
known valid keys.
The final step of verification is to establish that the signing key is authentic. To do so, confirm the
key fingerprint of the key which signed the distribution is one of the valid OpenSSL core team keys
listed in Appendix A, OpenSSL Distribution Signing Keys. In this example, 7B7919FA716B
87250E7721E552D983BF is in fact authentic according to Appendix A.
4.1.3 Verifying Integrity of the Full Distribution for the FIPS Object Module
IMPORTANT NOTE: This step has changed from prior validations, and is required
per the OpenSSL Security Policy!
The validation now includes a requirement for secure installation. In practice that means the
distribution file should be obtained directly from the vendor (OSF) on physical media. A more
complete discussion of this requirement including the elaborate steps needed when the distribution
is not obtained on physical media can be found in 6.6.
Physical media can be requested from OSF at:
OpenSSL Software Foundation, Inc.
1829 Mount Ephraim Road
Adamstown, MD 21710
Page 46 of 207
USA
+1 877-OPENSSL
(+1 877 673 6775)
[email protected]
An E-mail containing the full postal address is the preferred point of contact. It is our intention to
provide these CDs at no cost as long as we are able. We ask that you only request this CD if you
plan to use it for generation of FIPS 140-2 validated cryptography in a context that requires such
compliance. For any other purposes the downloaded files are bit-for-bit identical and will generate
exactly the same results.
The simpler verification requirement for prior OpenSSL FIPS Object Module validations, namely:
The HMAC-SHA-1 digest of the distribution file is published in Appendix B of the
Security Policy. The Security Policy can be found at NIST,
http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1051.pdf.
This digest should be calculated and compared against the published value, as in:
$ env OPENSSL_FIPS=1 openssl sha1 -hmac etaonrishdlcupfm openssl-fips-2.0.tar.gz
where the openssl command is from a recent version of OpenSSL that supports the
hmac option44. If you don't have the openssl command yet it will be generated by
the build process.
...is now specifically disallowed. With the new requirement use of the openssl command, even
from another version of the OpenSSL FIPS Object Module, is no longer permitted as in general it
will not have been obtained via a "secure installation".
4.2 Building and Installing the FIPS Object Module with OpenSSL
(Unix/Linux)
Due to significant differences in the two basic operating system families, Unix/Linux and
Microsoft Windows platforms are discussed separately. Instructions for Windows are given in
4.3. In addition, a Mac OS X example is offered at E.1 Apple OS X Support; and an iOS example
is given in Error: Reference source not found.
The OPENSSL_FIPS=1 environment variable will enable FIPS mode for an openssl command built from a FIPS
capable OpenSSL distribution.
Page 47 of 207
specified. Per the conditions of the FIPS 140-2 validation only two configuration commands may
be used:
./config
or
./confignoasm
where the specific option used depends on the platform (see 3.2.1). Note that fips canister is
implied, so there is no need for either ./configfipscanisterbuild or ./configfips.
The environment variable FIPSDIR, if present, points to the pathname of the location where the
validated module will be installed. This location defaults to /usr/local/ssl/fips2.0.
The specification of any other options on the command line, such as
./configshared
is not permitted. Note that in the case of the shared option position independent code is
generated by default so the generated FIPS Object Module can be included in a shared library45.
Note that as a condition of the FIPS 140-2 validation no other user specified configuration options
may be specified. This restriction means that an optional install prefix cannot be specified
however, there is no restriction on subsequent manual relocation of the generated files to the
desired final location.
Then:
make
to generate the FIPS Object Module file fipscanister.o, the digest for the FIPS Object
Module file, fipscanister.o.sha1, and the source file used to generate the embedded digest,
fips_premain.c. The fipscanister.o, fipscanister.o.sha1, and
fips_premain.c files are intermediate files (i.e., used in the generation of an application but
not referenced by that application at runtime). The object code in the fipscanister.o file is
incorporated into the runtime executable application at the time the binary executable is generated.
This should also be obvious, but modifications to any of the intermediate files generated by the
./config or make commands are not permitted. If the original distribution is modified, or
if anything other than those three specified commands are used, or if any intermediate files are
modified, the result is not FIPS validated.
45
If not for the FIPS validation prohibition, on most but not all platforms the shared option could safely be chosen
regardless of the intended use. See Appendix E for one known exception.
Page 48 of 207
Page 49 of 207
will build and install the new OpenSSL without overwriting the validated FIPS Object Module
files. The FIPSDIRenvironment variable or the --withfipsdircommand line option can
be used to explicitly reference the location of the FIPS Object Module (fipscanister.o).
The combination of the validated FIPS Object Module plus an OpenSSL distribution built in this
way is referred to as a FIPS capable OpenSSL, as it can be used either as a drop-in replacement for
a non-FIPS OpenSSL or for use in generating FIPS mode applications.
Note that a standard OpenSSL distribution built for use with the FIPS Object Module must have the
./configfips option specified. Other configuration options may be specified in addition to
fips, but omission of the fips option will cause errors when using the OpenSSL libraries with
the FIPS Object Module.
4.3 Building and Installing the FIPS Object Module with OpenSSL
(Windows)
The build procedure for Windows is similar to that for the regular OpenSSL product, using MSVC
and NASM for compilation. Note MASM is not supported.
The second stage uses VC++ to link OpenSSL 1.0.1 or later against the installed FIPS module, to
obtain the complete FIPS capable OpenSSL. Both static and shared libraries are supported.
Page 50 of 207
For Microsoft Windows based systems this protection can be provided by ACLs limiting write
access to the administrator group. When all system users are not authorized users the Everyone
(public) read and execute permissions should be removed from these files.
Page 51 of 207
Note that the developer can identify which DLLs are relocated with the Process Explorer utility
from http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/ProcessExplorer.mspx.
The resulting FIPS capable OpenSSL can be used for shared or static linking. The shared library
built (when ms\ntdll.mak is used as the Makefile) links fipscanister.lib into
libeay32.dll using fipslink.pl in accordance with the requirements of the Security
Policy.
Page 52 of 207
Appendix C contains a simple but complete sample application utilizing the FIPS Object Module
with OpenSSL as described in this section.
5.1
In order for the referencing application to claim FIPS 140-2 validation, all cryptographic functions
utilized by the application must be provided exclusively by the FIPS Object Module. The
OpenSSL API used in conjunction with the FIPS Object Module in FIPS mode is designed to
automatically disable all non-FIPS cryptographic algorithms.
5.2
Somewhere very early in the execution of the application FIPS mode must be enabled. This should
be done by invocation of the FIPS_mode_set() function call, either directly or indirectly as in
these following examples.
Note that it is permitted to not enable FIPS mode, in which case OpenSSL should function as it
always has. The application will not, of course, be operating in validated mode.
The FIPS_mode_set() function call when invoked with any positive argument will enable the FIPS
mode of operation. Depending on the argument it may also enable additional restrictions. For
example, an argument of 1 will enable the basic FIPS mode where all FIPS approved algorithms are
available. An argument of FIPS_SUITEB (2) will restrict the available algorithms to those
allowed by the Suite B specification.
Option 1: Direct call to FIPS_mode_set()
Page 53 of 207
#ifdefOPENSSL_FIPS
if(options.no_fips<=0)
{
if(!FIPS_mode_set(1))
{
ERR_load_crypto_strings();
ERR_print_errors_fp(stderr);
exit(1);
}
else
fprintf(stderr,"***INFIPSMODE***\n");
}
#endif
Example 5.2a Direct Invocation of FIPS_mode_set()
OPENSSL_config("XXXX_conf")
#ifdefOPENSSL_FIPS
if(FIPS_mode())
{
fprintf(stderr,"***INFIPSMODE***\n");
}
#endif
Example 5.2b Indirect Invocation of FIPS_mode_set()
Page 54 of 207
#Defaultsection
XXXX_conf=XXXX_options
...
[XXXX_options]
alg_section=algs
...
[algs]
fips_mode=yes
...
Example 5.2c Sample openssl.conf File
5.3
Note that applications interfacing with the FIPS Object Module are outside of the cryptographic
boundary.
When statically linking the application with the FIPS Object Module two steps are necessary:
1. The HMAC-SHA-1 digest of the FIPS Object Module file must be calculated and verified
against the installed digest to ensure the integrity of the FIPS Object Module.
2. A HMAC-SHA1 digest of the FIPS Object Module code and read-only data must be generated
and embedded in the application executable object for use by the FIPS_mode_set()
function at runtime initialization.
Note the application that statically links the Module can be a shared library (DLL for Microsoft
Windows).
When the FIPS Object Module has been incorporated in a shared library then subsequent dynamic
linking of an application to that shared library is done the usual way and these steps are irrelevant.
Page 55 of 207
For static linking the embedding of the runtime digest can be accomplished in one of two ways:
1. Two Step Linking with Interim Runtime Executable
Earlier versions of the FIPS Object Module supported only this technique, where an initial link
is performed to create an interim executable which is then executed in the target environment to
calculate and display the digest value. A second link is performed to create the final executable
with the embedded digest value. This two step process is typically performed by the fipslink.pl
utility.
This two step technique works well enough for native builds, where the build system and
runtime target system are the same, but is awkward at best for cross-compilation due to the need
to move the interim executable to the target system, execute it, and retrieve the calculated
digest.
This technique does have the advantage of working (at least in principle) for all platforms.
2. In-place Editing of the Object Code
In order to ease the task of cross-compiling the FIPS Object Module, a new technique was
developed. Instead of determining the runtime digest value by actual execution on the target
system, a utility is used to analyze the compiled object code on the build system and calculate
the digest. This utility is platform (or object code format) sensitive. For ELF binaries it is called
incore, for Microsoft Windows msincore, for OS X and iOS incore_macho.
Page 56 of 207
This type of command line macro overloading will work for many smaller software projects. The
makefile can also be modified to achieve the same macro substitutions. Depending on the form of
the Makefile this substitution may be as simple as defining FIPSLD_CC to reference the actual C
compiler and redefining the CC macro to reference fipsld:
FIPSLD_CC=$(CC)
CC=fipsld
.
.
.
<application>:$(OBJS)
$(CC)$($CFLAGS)o$@$(OBJS)$(LIBCRYPTO)...
Setting CC=fipsld is appropriate when the link rules rely on $(CC) instead of ld to produce the
executable images, but in some cases it may be desirable or necessary to not redefine the $(CC)
macro variable. A typical makefile rule referencing fipsld directly for the link step would look
something like46:
OPENSSLDIR=/usr/local/ssl/fips2.0
FIPSMODULE=$(OPENSSLDIR)/lib/fipscanister.o
.
.
.
<application>:$(OBJS)$(FIPSMODULE)
envFIPSLD_CC=$(CC)fipsld$(CFLAGS)o$@$(OBJS)\
$(LIBS)$(LIBCRYPTO)
Even though the fipsld command name implies use as a replacement for the ld command, it
also invokes the C compiler between the two link stages, hence fipsld can also replace $(CC)
in rules producing .o object files, replacing both compilation and linking steps for the entire
Makefile, i.e.:
<application>.o:<application>.c
$(CC)$(CFLAGS)c<application>.c...
<application>:$(OBJS)
ldo$@$(OBJS)$(LIBCRYPTO)...
becomes
46
The use of env is actually redundant in a Makefile context, but is specified here to give a command line also valid
for non-Bourne shells.
Page 57 of 207
<application>:<application>.c
envFIPSLD_CC=$(CC)fipsld$(CFLAGS)o$@[email protected]\
$(LIBCRYPTO)...
Larger software projects are likely to prefer to modify only the Makefile rule(s) linking the
application itself, leaving other Makefile rules intact. For these more complicated Makefiles the
individual rules can be modified to substitute fipsld for just the relevant compilation linking
steps.
The fipsld command is designed to locate fipscanister.o automatically. It will verify that
the HMAC-SHA-1 digest in file fipscanister.o.sha1matches the digest generated from
fipscanister.o, and will then create the file <application> containing the object code
from fipscanister.o, and embedded within that the digest calculated from the object code
and data in fipscanister.o .
At runtime the FIPS_mode_set() function compares the embedded HMAC-SHA-1 digest with
a digest generated from the text and data areas. This digest is the final link in the chain of validation
from the original source to the application executable object file.
Page 58 of 207
FIPSLIB_D is the path to the directory containing the installed FIPS module
When these variables are specified fipslink.pl can be called in the same way as the standard
linker. It will automatically check the hashes, link the target, generate the target in-core hash, and
link a second time to embed the hash in the target file.
The static library Makefile ms\nt.mak in the OpenSSL distribution gives an example of the
usage of fipslink.pl.
5.4
This section describes additional steps not strictly required for FIPS 140-2 validation but
recommended as good practice.
Provide an Indication of FIPS Mode
Security and risk assessment auditors will want to verify that an application utilizing cryptography
is using FIPS 140-2 validated software in a FIPS compliant mode. Many such applications will
superficially appear to function the same whether built with a non-FIPS OpenSSL, when built with
the FIPS Object Module and running in non-FIPS mode, and when built with the FIPS Object
Module and running in FIPS mode.
As an aid to such reviews the application designer should provide a readily visible indication that
the application has initialized the FIPS Object Module to FIPS mode, after a successful return from
the FIPS_mode_set() API call. The indication can take the form of a tty or stdout
message, a syslog entry, or an addition to a protocol greeting banner. For example a SSH server
could print a protocol banner of the form:
SSH2.0OpenSSH_3.7.1p2FIPS
to provide an easily referenced indication that the server was properly initialized to FIPS mode.
Graceful Avoidance of Non-FIPS Algorithms
Many applications allow end user and/or system administrator configurable specification of
cryptographic algorithms. The OpenSSL API used with the FIPS Object Module in FIPS mode is
designed to return error conditions when an attempt is made to use a non-FIPS algorithm via the
OpenSSL API. These errors may result in unexpected failure of the application, including fatal
assert errors for algorithm function calls lacking a testable return code. However, there is no
guarantee that the OpenSSL API will always return an error condition in every possible permutation
or sequence of API calls that might invoke code relating to non-FIPS algorithms. In any case, it is
the responsibility of the application programmer to avoid the use of non-FIPS algorithms.
Unexpected run-time errors can be avoided if the cipher suites or other algorithm selection options
Page 59 of 207
are defaulted to FIPS approved algorithms, and if warning or error messages are generated for any
end user selection of non-FIPS algorithms.
5.5
The supplier or developer of a product based on the FIPS Object Module cannot claim that the
product itself is FIPS 140-2 validated under certificate #1747. Instead a statement similar to the
following is recommended:
Product XXXX uses an embedded FIPS 140-2-validated cryptographic module (Certificate
#1747) running on a YYYY platform per FIPS 140-2 Implementation Guidance section G.5
guidelines.
where XXXX is the product name (Cryptomagical Enfabulator v3.1) and YYYY is the host
operating system (Solaris 10).
This statement asserts "user affirmation" of the validation per Section G.5 of the Implementation
Guidance document.
While not strictly required by the Security Policy or FIPS 140-2, a written record documenting
compliance with the Security Policy would be a prudent precaution for any party generating and
using or distributing an application that will be subject to FIPS 140-2 compliance requirements.
This record should document the following:
For the FIPS Object Module generation:
1. Where the opensslfips2.0.tar.gz distribution file was obtained from, and how
the HMAC SHA-1 digest of that file was verified per Appendix B of the Security Policy.
2. The host platform on which the fipscanister.o, fipscanister.o.sha1,
fips_premain.c, and fips_premain.c.sha1 files were generated. This platform
identification at a minimum should note the processor architecture (x86, PA-RISC,...),
the operating system (Solaris 10, Windows XP,...), and the compiler (gcc 3.4.3,...).
3. An assertion that the fipscanister.o module was generated with the three commands
./config[noasm]
make
makeinstall
and specifically that no other build-time options were specified.
4. A record of the HMAC SHA-1 digest of the fipscanister.o (the contents of the
fipscanister.o.sha1 file). That digest identifies this specific FIPS Object Module;
Page 60 of 207
if you immediately build another module it will have a different digest and is a different
FIPS Object Module.
5. An assertion that the contents of the distribution file were not manually modified in any
way at any time during the build process.
For the application in which the FIPS Object Module is embedded:
1. A record of the HMAC SHA-1 digest of the fipscanister.o that was embedded in the
application.
2. An assertion that the application does not utilize any cryptographic implementations other
that those provided by the FIPS Object Module or contained in the FIPS capable OpenSSL
1.0.1 libraries (where non-FIPS algorithms are disabled in FIPS mode).
3. A description of how the application clearly indicates when FIPS mode is enabled
(assuming that FIPS mode is a runtime selectable option). Note that the application must
call FIPS_mode_set(), whether that call is triggered by runtime options or not.
5.6
When a decision is made on whether a particular IT solution is FIPS 140-2 compliant, multiple
factors need to be taken into account, including the FIPS Pub 140-2 standard, FIPS 140-2 Derived
Test Requirements, CMVP FAQ and Implementation Guidance. The ultimate authority in this
process belongs to the CMVP. The CMVP provides its current interpretations and guidelines as to
the interpretation of the FIPS 140-2 standard and the conformance testing/validation process on its
public web site http://csrc.nist.gov/cryptval/.
In particular, the only official document known to us which discusses use of embedded
cryptographic modules is the CMVP FAQ available at
http://csrc.nist.gov/groups/STM/cmvp/documents/CMVPFAQ.pdf. This FAQ (Frequently Asked
Questions document) discusses incorporation of another vendor's cryptographic modules in a
subsection of Section 2.2.1 entitled "Can I incorporate another vendor's validated cryptographic
module". In particular, the following is specified:
"Yes. A cryptographic module that has already been issued a FIPS 140-1 or FIPS 140-2
validation certificate may be incorporated or embedded into another product. The new
product may reference the FIPS 140-1 or FIPS 140-2 validated cryptographic module so
long as the new product does not alter the original validated cryptographic module. A
product which uses an embedded validated cryptographic module cannot claim itself to be
validated; only that it utilizes an embedded validated cryptographic module. There is no
assurance that a product is correctly utilizing an embedded validated cryptographic module
- this is outside the scope of the FIPS 140-1 or FIPS 140-2 validation."
Page 61 of 207
Note that the CMVP FAQ does specify that a FIPS 140-1/2 validated module may be incorporated
into another product. It then specifies that making a decision on whether a product is correctly
utilizing an embedded module is outside of the scope of the FIPS 140-1 or FIPS 140-2 validation.
A subsection of Section 2.1 of the CMVP FAQ entitled "A vendor is selling me a crypto solution what should I ask?" states:
"Verify with the vendor that the application or product that is being offered is either a
validated cryptographic module itself (e.g. VPN, SmartCard, etc) or the application or
product uses an embedded validated cryptographic module (toolkit, etc). Ask the vendor to
supply a signed letter stating their application, product or module is a validated module or
incorporates a validated module, the module provides all the cryptographic services in the
solution, and reference the modules validation certificate number."
It is specified that the module provides "all the cryptographic services in the solution". It is not
specified that the module provides "all the security-relevant services in the solution". A typical IT
product may provide a variety of services, both cryptographic and non-cryptographic. A network
protocol such as SSH or TLS provides both cryptographic services such as encryption and network
services such as transmission of data packets, packet fragmentation, etc.
The FIPS 140-2 standard is focused on the cryptography. There are many generic security relevant
functionalities such as anti-virus protection, firewalling, IPS/IDS and others which are not currently
covered by the FIPS 140-2 standard. An anti-virus solution which uses a cryptographic module for
its operations can satisfy requirements of the FIPS 140-2 by delegating its cryptographic functions
to an embedded FIPS 140-2 validated module. Including the entire anti-virus solution in the FIPS
140-2 validation would hardly improve the overall security since FIPS 140-2 does not currently
have requirements in the field of anti-virus protection. In a similar fashion, the FIPS 140-2
standard does not currently have requirements related to network vulnerabilities or denial of service
attacks.
Validated modules typically provide algorithm implementations only, no network functionality such
as IPSec, SSH, TLS etc. This does not, for example, prevent Microsoft Windows from providing
IPSec/IKE and TLS/SSL functionality. Therefore, for example, an OpenSSH based product
properly using the OpenSSL FIPS Object Module would not differ from Microsoft using its
Microsoft Kernel Mode Crypto Provider in Microsoft IPSec/IKE client which is shipped with every
copy of Windows. If an application product delegates all cryptographic services to a validated
module the entire product will be FIPS compliant.
Since the CMVP does not have a formal program for validation of IT solutions with embedded
FIPS 140-2 modules, the question is one of how the actual compliance/non-compliance is
determined. In practice the compliance is determined by the federal agency/buyer selecting the
solution. During the process the customer may contact the CMVP, testing labs or security experts
for an opinion. In many cases, though, the buyers make such decisions independently. Here it
Page 62 of 207
should be noted that FIPS 140-2 is only a baseline and each federal agency may establish its own
requirements exceeding the requirements of FIPS 140-2. In the particular example of network
protocols federal agencies generally do accept networking products (IPSec/TLS/SSH etc.) with
embedded FIPS 140-2 validated cryptographic software modules or hardware cards as FIPS 140-2
compliant.
For those vendors desiring a sanity check of the compliance status of their OpenSSL FIPS Object
Module based product, the OpenSSL Software Foundation (OSF) can perform a review and provide
an opinion letter stating whether, based on information provided by the vendor, that product
appears to OSF to satisfy the requirements of the OpenSSL FIPS Object Module Security Policy.
This opinion letter can include a review by one or more CMVP test labs and/or a OpenSSL team
member as appropriate. This opinion letter clearly states that only the CMVP can provide an
authoritative ruling on FIPS 140-2 compliance.
5.7
In the years since the first versions of the OpenSSL FIPS Object Module were validated we've seen
new users of the FIPS module struggle with some of the same issues over and over again. Here we
attempt to offer some possibly useful advice:
Page 63 of 207
structured build-from-source process), and per the recommendations in 5.5 each distinct binary
FIPS module should be separately tracked.
In lieu of trying to jam the mandated FIPS module build process into an existing elaborate in-house
configuration management process, we recommend that the binary FIPS module be generated by
hand one time only (per distinct platform) in a solemn documented ceremony, and that the resulting
binary files be managed through the formal source/version/configuration control process.
6.
Technical Notes
This section has technical details of primary interest to the FIPS module developers and more
advanced users. The typical application developer will not need to reference this material.
6.1
DRBGs
With very rare exceptions the internal functioning of the DRBGs is irrelevant to the end user and
application software. In FIPS mode DRBGs are transparently used by the OpenSSL RAND API
and applications will automatically use them.
Random numbers are critical for the proper operation of cryptographic software and hardware. The
DRBG or Deterministic Random Bit Generator is intended as a higher quality replacement for the
earlier PRNGs or Pseudo-Random Number Generators and is defined by SP 800-90A.
6.1.1 Overview
The way entropy is gathered and used for the DRBG is part of the FIPS capable OpenSSL so it can
be modified outside the context of the FIPS 140-2 validation. The current version is in
crypto/rand/rand_lib.c.
There is a "default DRBG" whose context is accessed using FIPS_get_default_drbg().
This default DRBG is mapped to the RAND_*() calls. By default, the FIPS Object Module will
use the AES/CTR generator from SP800-90A, Section 10.2, DRBG Mechanisms Based on Block
Ciphers. The default generator can be overridden by the calling application at runtime via the
function RAND_set_fips_drbg_type(). The default is equivalent to CTR_DRBG using
AES with a 256 bit key and a derivation function.
The actual default DRBG type can also be specified via a preprocessor macro when the "FIPS
capable" OpenSSL is built:
#ifndef OPENSSL_DRBG_DEFAULT_TYPE
#define OPENSSL_DRBG_DEFAULT_TYPE
#endif
#ifndef OPENSSL_DRBG_DEFAULT_FLAGS
Page 64 of 207
NID_aes_256_ctr
#define OPENSSL_DRBG_DEFAULT_FLAGS
#endif
DRBG_FLAG_CTR_USE_DF
This might be useful in environments where some DRBG type is mandated by local
policy. For example, to use the HMAC DRBG with sha256 by default:
./config -DOPENSSL_DRBG_DEFAULT_TYPE=NID_hmacWithSHA256 \
-DOPENSSL_DRBG_DEFAULT_FLAGS=0 (other options)
The RAND_add() function just seeds the OpenSSL non-standard PRNG and does not feed into
the DRBG directly. However that function would be used if the DRBG was reseeded. The reason it
does this is that the DRBG design does not permit the addition of "out of band" entropy; the
addition of entropy needs to be combined with a generate operation (additional input) or a full
reseed/reinstantiate (which would require the minimum entropy). Environments with a better
source of entropy (e.g. fast hardware RNG) could do far better.
The entropy callbacks are completely under application control so the calling application can
override the ones provided by default. They can be set by supplying a callback function to
FIPS_drbg_set_callbacks()after calling OPENSSL_init(). This callback function is
invoked whenever the DRBG requires additional entropy:
size_t(*get_entropy)(DRBG_CTX*ctx,unsignedchar**pout,
intentropy,size_tmin_len,size_tmax_len)
A call to this function requests entropybits of entropy in a buffer of between min_len and
max_len size bytes inclusive. The values of these are mechanism specific and taken from
SP800-90 tables. This callback should then return the amount of data in the buffer *pout and the
length in the return value, or zero in case of being unable to retrieve sufficient entropy.
Few applications provide external entropy callbacks, but due to a bug in the callback code those
that do define a (*get_entropy)() callback should have that return at least two full "blocks" of
entropy. This is because the FIPS 140-2 mandated continuous PRNG test has to be applied to the
entropy source. It has to compare consecutive blocks (discarding the first) which means the entropy
source needs to supply a multiple of the block size. The solution isn't obvious so a detailed
discusson follows.
FIPS_drbg_get_strength() returns the strength of the DRBG context which is the number of bits of
entropy needed to seed the DRBG without the continuous PRNG test. When an application adds its
own entropy callbacks it has to tell the FIPS module what the block length of the entropy source is.
So arguably the entropy parameter with the continuous PRNG test is:
FIPS_drbg_get_strength(dctx) + block_length * 8
Page 65 of 207
But, that calculation determines a maximum value and an entropy source could conceivably supply
less. For instance, suppose we want 256 bits of entropy and the callback supplies it as high grade
entropy uniformly in a 32 byte buffer (the absolute minimum) and has a 16 byte block length. An
extra block is needed for the PRNG test so we should supply a 48 byte buffer (three blocks) and
effectively 384 bits of entropy.
Now suppose we have a low grade entropy source which provides just 1 bit of entropy per byte.
Again assume it is uniform (e.g. we don't get 8 bits of entropy in byte 1 and nothing in the next 7).
Again lets have a block size of 16 bytes. This time to get 256 bits of entropy the source must
provides it in a 256 byte buffer. An extra block is required which makes 272 bytes but because we
only have 1 bit of entropy per byte it just needs to supply 272 bits of entropy.
Once this call completes successfully the DRBG is instantiated at the appropriate (maximum)
security strength again taking values from SP800-90 and SP800-57.
We request random data from the caller of sufficient entropy for the security level of the DRBG.
When asymmetric algorithms are used (key generation, parameter generation and indeed signing
for DSA/ECDSA) we check that the RNG has sufficient security strength (as dictated by the
relevant standards) to perform the operation. Insufficient security strength is an error and the
operation cannot be performed.
There is a mechanism, "entropy draining", which causes the DRBG to automatically reseed after a
certain number of uses. See SP800-90 for details of how this operates. The function
FIPS_drbg_set_reseed_interval() can be used to modify the number of calls before
auto reseeding.
The function FIPS_rand_strength() returns the security strength of the default RNG (the
one used for key generation et. al.).
Individual operations (for example key generation) then check the security strength of the RNG and
return a fatal error if there is insufficient security strength to complete the operation. The values
used are from SP800-57.
This check is performed by the following functions:
fips_check_dsa_prng()
fips_check_rsa_prng()
fips_check_ec_prng()
Currently there is no equivalent for DH. One could be added if required but it isn't clear how the
strengths should be compared when PKCS#3 DH is used.
Page 66 of 207
There is no version for ECDH either but the only operation performed by that code (shared secret
computation) does not make use of the RNG.
By default the health checks are automatically performed every 224 generate operations; this count
can be modified (up or down) by the calling application via the
FIPS_drbg_set_check_interval() function. If a DRBG health check fails then
the DRBG is placed in an error state that can be cleared by uninstantiating and reinstantiating the
DRBG.
For the CTR DRBG a flag allows the optional use of a derivation function. Note the DRBG is
always instantiated at maximum security.
Page 67 of 207
Page 68 of 207
return value -2 is used to indicate an invalid or unsupported type value. The type value cannot be 0.
This function is otherwise identical to FIPS_drbg_new().
FIPS_drbg_free
The function
voidFIPS_drbg_free(DRBG_CTX*dctx);
frees up a DRBG_CTX. After this call the DRBG_CTX pointer is no longer valid. The underlying
DRBG is first uninstantiated.
FIPS_drbg_set_callbacks
The function
intFIPS_drbg_set_callbacks(DRBG_CTX*dctx,
size_t(*get_entropy)(DRBG_CTX*ctx,unsigned
char**pout,intentropy,size_tmin_len,size_t
max_len),
void(*cleanup_entropy)(DRBG_CTX*ctx,unsignedchar
*out,size_tolen),size_tentropy_blocklen,
size_t(*get_nonce)(DRBG_CTX*ctx,unsignedchar
**pout,intentropy,size_tmin_len,size_t
max_len),
void(*cleanup_nonce)(DRBG_CTX*ctx,unsignedchar*out,
size_tolen)
);
sets entropy and nonce callbacks for a DRBG_CTX. The DRBG_CTX must be in an uninstantiated
state to set the callbacks: i.e. the callbacks cannot be set on an instantiated DRBG. This function is
typically called immediately following FIPS_drbg_new(). This function returns 1 for success
and 0 if an error occurred: the only way an error can occur is if an attempt is made to set the
callbacks of an instantiated DRBG.
Whenever the DRBG requires entropy or a nonce the corresponding callbacks will be called.
The callbacks get_entropy and get_noncerequest "entropy" bits of entropy in a
buffer of between min_len and max_len bytes. The function should set *pout to the buffer
containing the entropy and return the length in bytes of the buffer.
Page 69 of 207
If the source of entropy or nonce is unable to satisfy the request it MUST return zero. This will
place the DRBG in an error condition due to the source failure.
The callbacks cleanup_entropy and cleanup_nonce are called after the entropy or nonce
buffers have been used and can be utilized to zeroize the buffers. The "out" and "olen"
parameters contains the same value returned by the get function.
The "entropy_blocklen" is used to specify the block length of the underlying entropy source.
This is used for the continuous RNG test on the entropy source.
FIPS_drbg_instantiate
The function
intFIPS_drbg_instantiate(DRBG_CTX*dctx,
constunsignedchar*pers,size_tperslen);
instantiates a DRBG with the supplied personalization string pers. This function returns 1 for
success and 0 for failure.
If the personalization string is of an invalid length for the DRBG mechanism a non-fatal error is
returned.
Internally this function instantiates the DRBG. This will request entropy and a nonce using the
supplied get_entropy and get_nonce callbacks.
There are no security strength and prediction resistance arguments to this function. The DRBG is
always instantiated at the maximum strength for its type and prediction resistance requests are
always supported.
This function returns 1 for success and 0 for failure.
FIPS_drbg_reseed
The function
intFIPS_drbg_reseed(DRBG_CTX*dctx,constunsignedchar
*adin,size_tadinlen);
reseeds the DRBG using optional additional input "adin" of length "adinlen".
If the additional input is of an invalid length for the DRBG mechanism a non-fatal error is returned.
Page 70 of 207
Page 71 of 207
get and retrieve an application defined pointer value. The meaning of this pointer is application
defined and might for example contain a pointer to a handle representing the entropy source and the
get_entropy function could retrieve and make use of that pointer.
FIPS_drbg_get_blocklength
The function
size_tFIPS_drbg_get_blocklength(DRBG_CTX*dctx);
returns the block length of the DRBG.
FIPS_drbg_get_strength
The function
intFIPS_drbg_get_strength(DRBG_CTX*dctx);
returns the security strength of the DRBG in bits.
FIPS_drbg_set_reseed_interval
The function
voidFIPS_drbg_set_reseed_interval(DRBG_CTX*dctx,int
interval);
modifies the reseed interval value. The default is 224 blocks for the Dual EC DRBG and 224
generate operations for all other types. These values are lower than the maximums specified in
SP800-90.
RAND interface
Cryptographic operations make use of the OpenSSL RAND PRNG API to request random data. A
brief description of this is given below:
intRAND_bytes(unsignedchar*buf,intnum);
Generate num random bytes and write to buf.
intRAND_pseudo_bytes(unsignedchar*buf,intnum);
Page 72 of 207
Generate num random bytes and write to buf. The random data does not have to be
cryptographically strong.
voidRAND_seed(constvoid*buf,intnum);
This function is used at various points to add data which may be useful for adding entropy to the
PRNG. The buffer buf contains num bytes which can be used.
voidRAND_add(constvoid*buf,intnum,doubleentropy);
This is similar to RAND_seed() except that the data supplied has entropy "entropy".
Default DRBG
A special DRBG instance called the "default DRBG" is used to map the DRBG to the RAND
interface.
The function
intFIPS_drbg_set_rand_callbacks(DRBG_CTX*dctx,
size_t(*get_adin)(DRBG_CTX*ctx,unsignedchar
**pout),
void(*cleanup_adin)(DRBG_CTX*ctx,unsignedchar
*out,size_tolen),
int(*rand_seed_cb)(DRBG_CTX*ctx,constvoid*buf,
intnum),
int(*rand_add_cb)(DRBG_CTX*ctx,
constvoid*buf,intnum,doubleentropy)
);
defines various callbacks which control how RAND calls are mapped to DRBG calls.
The get_adin callback is used to retrieve optional additional data used whenever a request for
random data is made using RAND_bytes() or RAND_pseudo_bytes(). When this operation
is complete cleanup_adin is called to release the buffer.
Note that RAND_bytes() and RAND_pseudo_bytes() are equivalent operations for the
RAND mapping to the DRBG; they both call FIPS_drbg_generate(). The
FIPS_drbg_generate() function can be called multiple times to satisfy a single request if
the num value exceeds the amount of data that can be handled in a single DRBG request.
Page 73 of 207
The callbacks rand_seed_cb and rand_add_cb are called directly whenever RAND_seed()
or RAND_add() are called. These are entirely application defined and could be used for example
to add seed information to the entropy source.
The function
DRBG_CTX*FIPS_get_default_drbg(void);
retrieves the default DRBG context. This can then be manipulated using the standard DRBG
functions such as FIPS_drbg_init().
The function
intFIPS_rand_strength(void);
returns the security strength in bits of the default PRNG.
DRBG Health Checks
The function
intFIPS_drbg_health_check(DRBG_CTX*dctx);
initiates a health check on the DRBG. In addition health checks are also performed when a DRBG
is first initiated (using FIPS_drbg_new() or FIPS_drbg_set()) when a DRBG is reseeded
explicitly using FIPS_drbg_reseed() and every health_check_interval calls to the
generate function. This interval is by default 224 but can be modified by:
voidFIPS_drbg_set_check_interval(DRBG_CTX*dctx,int
interval);
If any health check fails the DRBG is placed in an error state and no further operations can be
performed on the DRBG instance until it has been reinitialized (uninstanstiated and initialized).
Extended KAT of all DRBG Functions
The function fips_drbg_single_kat() performs an extended Known Answer Test (KAT) of
all functions:
1. Instantiate DRBG with known data (entropy, nonce, personalization string).
2. Perform generate operation without prediction resistance and check output matches
expected value.
3. Reseed with known data (entropy, additional input).
Page 74 of 207
4. Perform second generate operation without prediction resistance and check output matches
expected value.
5. Uninstantiate DRBG.
6. Instantiate DRBG in test mode with known data (entropy, nonce, personalization string).
7. Perform generate operation with prediction resistance and check output matches expected
value set known entropy and additional input during this step.
8. Perform second generate operation with prediction resistance and check output matches
expected value.
9. Uninstantiate DRBG.
It is asserted that checking the output of the generate function in steps 2, 4, 7 and 8 ensures the
previous operations completed successfully: i.e. set the DRBG internal state to the expected values.
Extended Error DRBG Checking
Extended error checking is performed by function fips_drbg_error_check():
Invalid parameters are fed into all DRBG functions in sequence as follows. Note that some tests
(e.g. entropy source failure) leave the test DRBG in an error state and it has to be uninstantiated and
instantiated again to clear the error condition.
1. Instantiate with invalid personalization string length.
2. Instantiate DRBG with entropy source failure (returning zero entropy).
3. Attempt to generate DRBG output from DRBG from step 2.
4. Instantiate DRBG with too short an entropy string.
5. Instantiate DRBG with too long an entropy string.
6. Instantiate DRBG with too small a nonce (if nonce used in mechanism).
7. Instantiate DRBG with too large nonce (if nonce used in mechanism).
8. Instantiate DRBG with good data and generate output, check calls succeed.
9. Attempt to generate too much output for a single request.
10. Attempt to generate with too large additional input.
11. Attempt to generate with prediction resistance and entropy source failure.
12. Set reseed counter to reseed interval, generate output and check reseed has been performed.
13. Test explicit reseed operation with too large additional input.
14. Test explicit reseed with entropy failure.
15. Test explicit reseed with too large entropy string.
16. Test explicit reseed with too small entropy string.
17. Uninstantiate DRBG: check internal state is zeroed.
Health Checking Performance
The health checks are performed:
Page 75 of 207
1. When a DRBG is first initialized (i.e. before instantiation) a health check is performed on a test
instantiation using the same mechanism and parameters.
2. When a reseed operation is performed (other than for a prediction resistance request) a health
check is performed on a test instantiation. This effectively performs a superset of the requirements
for testing the reseed function i.e. it tests all functions including the reseed function.
3. An internal counter determines the number of generate operations since the last health check.
When this reaches a preset limit a health check is performed. This limit is set by default to 224
operations but it can be set to an alternative value by an application.
4. When an application explicitly requests a health check with the call
FIPS_drbg_health_check().
Abbreviated POST
During a Power On Self Test (POST) an abbreviated KAT only is performed for one instance of
each supported DRBG mechanism. This simply performs an instantiate and generate operation and
checks that the output matches an expected value.
6.2
Summary
A role based authentication mechanism is implemented for the purpose of satisfying a U.S. Army
procurement policy. The implementation is transparent to end users if the relevant default build
options are left undisturbed, as should generally be the case.
IMPORTANT NOTE:
After the role based authentication mechanism described in this section was implemented, we
learned that the original Army policy that motivated this implementation is no longer in
effect, as confirmed in correspondence dated 2011-10-28 with CIO/G6 that yielded this
statement:
AsaresultoftheArmy'stransitiontotheDoDUnifiedCapabilities
ApprovedProductsList(UCAPL),boththeArmy'sIAApprovedProductsList
processandtheMay21,2009"LettertoIndustrywererescinded.(CIO/G6
memorandumdatedMay2011).Theabovereferenceddocumentinits
entirety,includingparagraph5a,nolongerapplies.
Formoredetailspleasesendinquiresto:[email protected],703
5451677or7035451672.
Background
Page 76 of 207
The FIPS module is a software library so the concept of authentication to the module doesn't make
any sense. For a Level 1 validation the CMVP does not require any module authentication, and
there is no circumstance that we can envision for which such authentication would have any
practical value for vendors or users. A little thought shows that authentication of a general purpose
cryptographic library itself must necessarily be a pointless nuisance; consider for instance the
vendor of a Linux distribution (Ubuntu, Red Hat, etc.) that elected to utilize authentication with the
OpenSSL libraries. Such an OS distribution will typically default to dozens of individual
applications utilizing those libraries, with dozens to hundreds more available as optional packages.
Each and every one of those applications would have to contain the correct authentication
credentials at all times. Application vendors would either have to be informed of those credentials,
widely and publicly, or would be forced to ship their product with unauthenticated OpenSSL
libraries (or libraries authenticated with different known credentials) to avoid the failures that
would be caused by mismatched credentials. The result would be a mess that would provide more
opportunities than obstacles to Evil Hackers.
However, in 2009 the U.S. Army specified a set of acquisition requirements, in the form of a memo
with a subject line of "Letter to Industry Concerning the Approval and Acquisition of Information
Assurance (IA) Tools and Products in the United States Army" (see
https://chess.army.mil/ascp/commerce/scp/downloads/standardspolicy_files/letter_to_industry.pdf).
This mandate imposes additional requirements for FIPS 140-2 validated products, beyond those
mandated by the CMVP. In particular, for Level 1 validations such as ours, it requires:
5. Federal Information Processing Standards (FIPS):
a. FIPS 140-2, Level 1: This applies to cryptographic modules that are software only
solutions (the software cannot be bundled or sold as a hardware-software solution)
that are unable to achieve FIPS 140-2 Security Level 2. Overall FIPS 140-2 Level 1
solutions must incorporate the following Cryptographic Modules Specifications to a
higher security level: Roles, Services, and Authentication (Security Level 2) and
Design Assurance (Security Level 3).
The OpenSSL FIPS Object Module 2.0 validation cannot be at overall Level 2 because such a
validation would necessarily tie the module to specific hardware. This Army policy was evidently
directed at turnkey appliances (firewalls, mobile devices, etc.) and failed to consider the case of
general purpose cryptographic libraries.
The earlier v1.2.3 FIPS module (certificate #1051) predated the release of the Letter to Industry,
and since then we've heard from quite a few software vendors who have experienced difficulty in
selling to the Army because the v1.2.3 module didn't meet the 5a requirement. It turns out that
satisfying this requirement is easily handled at modest cost as a pure documentation effort in some
contexts, such as when the test platforms have Common Criteria (CC) certified operating systems
or the module itself actually implements authentication.
Page 77 of 207
However, the CMVP takes the not unreasonable position that validation at Roles, Services, and
Authentication at Level 2 is not appropriate unless authentication actually takes place (note that in
this context a non-CC certified operating system is considered to provide no authentication
services). CC certified platforms are few and far between, and it makes no sense to implement
authentication to a general purpose cryptographic library.
So, that left us with a bit of a dilemma. The CMVP and Army policies are in direct conflict, and if
we knew of any easy way to get two government bureaucracies to reconcile conflicting policies
we'd tackle some easier challenges like brokering a permanent peace in the Middle East.
After some deliberation and consultation with the test lab we concluded that the best resolution to
this dilemma was to implement role-based authentication in a way that would satisfy both the
CMVP and Army requirements without significantly impacting the end users. This goal was
accomplished by requiring role based authentication for use of the module in FIPS mode, and then
automatically and transparently performing that authentication in the "FIPS capable" OpenSSL.
The end result is that the FIPS module plus "FIPS capable" OpenSSL combination -- by far the
most common use of the FIPS module -- will behave for the calling application as if the role based
authentication were not required.
Note we already have a well established precedent for publishing secret credentials in the context of
an open source based validation. The integrity test mandated by FIPS 140-2, which is accorded
great significance, requires a HMAC-SHA1 digest of the module contents (object code, roughly
speaking). The HMAC digest is calculated from a secret HMAC key plus the data of interest, the
purpose being to allow both authentication and confirmation of data integrity (only the entity
knowing the secret key can generate the correct digest). For the very first validation we were faced
with the challenge of where to store the secret HMAC key, as in open source code there is no
suitable hiding place. After some deliberation the CMVP instructed us to just code the
HMAC-SHA1 digest as mandated and leave the secret key exposed in the source code. That same
"secret" key has been in every validation since and is published in the corresponding Security
Policy documents (Appendix B, it is 6574616f6e72697368646c637570
666d, equivalent to the ASCII string "etaonrishdlcupfm").
Implementation
The FIPS_mode_set() function familiar to users of past versions of the OpenSSL FIPS Object
Module is now defined in the "FIPS capable" OpenSSL, i.e. externally to the FIPS module. The
corresponding function in the FIPS module that enables the FIPS mode of operation requires role
based authentication in the form of a password argument. Note that FIPS 140-2 requires at least
two roles; we defined two roles but both perform identically in all respects.
The build process for the FIPS module references three environment variables, with defaults if not
explicitly set:
Page 78 of 207
FIPS_AUTH_KEY
FIPS_AUTH_CRYPTO_OFFICER
FIPS_AUTH_CRYPTO_USER
These environment variables define the HMAC key and the HMACs of the passwords respectively.
This are utilized during the standard:
./config
make
The FIPS_AUTH_KEY defines the HMAC key which defaults to "etaonrishdlcupfm".
The two passwords default to "DefaultFIPSCryptoOfficerPassword" and
"DefaultFIPSCryptoUserPassword" respectively and appear in
fips/fips_utl.h.
There are several ways to get the right format for the password HMACs, such as:
echon<password>|opensslsha1hmac<hmac_key>
At runtime the calling application invokes FIPS_module_mode_set(1,password).
Internally this function generates the digest HMAC(FIPS_AUTH_KEY,password)and checks
to see if that value matches either of FIPS_AUTH_CRYPTO_OFFICER or
FIPS_AUTH_CRYPTO_USER. If the password does not match the error is treated the same as a
fatal POST error.
Validation Testing
For use by the test lab in testing the role based authentication the following command line options
are defined for the fips_test_suite utility, to specify the password value to be passed to
FIPS_module_mode_set():
none
bad
user
officer
Null password
Invalid password of sufficient length
The FIPS_AUTH_CRYPTO_USER password
The FIPS_AUTH_CRYPTO_OFFICER password
If none of those command line options are given the FIPS_AUTH_CRYPTO_USER password is
used.
Support in the "FIPS capable" OpenSSL
Page 79 of 207
A means is provided in the "FIPS capable" OpenSSL (which is just another application from the
perspective of the FIPS module) to specify non-default passwords:
./config<...options...>DFIPS_AUTH_USER_PASS="\"...password...\""
Please note this is not something likely to be of value in any real-world context, and a FIPS module
built with non-default passwords is a likely source of problems.
6.3
Self Tests
As required by FSIP 140-2 the FIPS module implements numerous self tests. Typically at least one
self test is required for each cryptographic algorithm.
Each test as it is performed can be examined through an optional callback:
int(*fips_post_cb)(intop,intid,intsubid,void*ex);
Unless otherwise stated below the callback should always return 1. The "op" parameter indicates
the operation being performed and can be one of:
FIPS_POST_BEGIN: indicates that testing has begun but no tests have been performed
yet.
FIPS_POST_END: indicates all tests have been completed. The "id" parameter indicates
the overall status of tests. It is 1 if all tests completed successfully and 0 if at least one test
failed.
For the remaining "op" values the "id", "subid" and "exstr" parameters indicate details of the
specific test being performed. See complete descriptions of each test type for the meaning of these
parameters.
FIPS_POST_STARTED: indicates an individual test has started.
FIPS_POST_SUCCESS: individual self test was successful.
FIPS_POST_FAIL: individual self test failed.
FIPS_POST_CORRUPT: a query as to whether self test failure mode should be set.
If the callback returns 0 a failure is simulated for the referenced self test. The method used to
simulate failure is documented against each test.
Page 80 of 207
6.3.1.1
Integrity Test
The id field is set to FIPS_TEST_INTEGRITY. The remaining parameters are not used. This is
indicated while incore integrity testing of the module itself is being performed. This operation
performs an HMAC over sections of incore data and checks the value against an expected value set
when the application is compiled [see 2.2 for a more comprehensive description of this operation].
If failure is being simulated an additional byte is HMACed in addition to the incore data to produce
an HMAC value which will differ from the stored value.
Triggered by the integrity option to fips_test_suite.
6.3.1.2
The id field is set to FIPS_TEST_DRBG. The subid field is set to the NID of the DRBG being
tested and the "exstr" field is of type (int*) which points to the DRBG flags being tested.
An abbreviated KAT only test (not a full health check) is performed on each supported DRBG
mechanism. Specifically, it is initialized in test mode, instantiated using known parameters, output
is generated and the result compared with known good values.
If failure is being simulated the "additional input" parameter to the generate operation is perturbed
by setting it to a shorter length than the KAT value. This will result in data being generated which
does not match the expected value.
Currently the following DRBG mechanisms and primitives are tested as part of the POST:
a)
b)
c)
d)
e)
The id field is set to FIPS_TEST_X931. The subid field is set to the key length of the PRNG
in bytes.
For the test the PRNG is set up in test mode. A known key, V (seed) and DT (date time vector) is
supplied and the generated output (R) compared to an expected value.
Page 81 of 207
If failure is being simulated the known V value is corrupted by incrementing the first byte. This
will result in generated data which does not match the expected value.
Currently the POST tests the X9.31 PRNG using 128, 192 and 256 bit key lengths.
Triggered by the rng option to fips_test_suite.
6.3.1.4
Digest Test
The id field is set to FIPS_TEST_DIGEST. The subid field is set to the digest NID being
tested. The "ex" argument is not used. Currently only SHA1 is tested in this way. Known data is
digested and the resulting hash compared to a known good value.
If failure is being simulated an extra byte is digested in addition to the known data which will result
in a digest which does not match the expected value.
Triggered by the sha1 option to fips_test_suite.
6.3.1.5
HMAC Test
The id field is set to FIPS_TEST_HMAC. The subid field is set to the associate digest NID
being tested. The "ex" argument is not used.
Known data is HMACed and the resulting hash compared to a known good value.
If failure is being simulated an extra byte is HMACed in addition to the known data which will
result in an HMAC which does not match the expected value.
The digests SHA1, SHA224, SHA256, SHA384 and SHA512 are tested in this way.
Triggered by the hmac option to fips_test_suite.
6.3.1.6
CMAC Test
The id field is set to FIPS_TEST_CMAC. The subid field is set to the associated cipher NID
being tested. The "ex" argument is not used.
Known data is CMACed and the resulting CMAC compared to a known good value.
If failure is being simulated an extra byte is CMACed in addition to the known data which will
result in an HMAC which does not match the expected value.
Page 82 of 207
The triple DES cipher and AES using 128, 192 and 256 bytes is tested for CMAC.
Triggered by the cmac option to fips_test_suite.
6.3.1.7
The id field is set to FIPS_TEST_CIPHER. The subid field is set to the NID of the cipher
being tested, "ex" is not used.
A known key, IV and plaintext is encrypted and the output ciphertext compared to a known good
value.
The ciphertext is then decrypted using the same key and IV and the result compared to the original
plaintext.
If a failure is being simulated the ciphertext is corrupted (first byte XORed with 0x1) before the
decryption test.
AES in ECB mode with a 128 bit key and triple DES in ECB mode are tested.
Triggered by the aes,des options to fips_test_suite.
6.3.1.8
The id is field is set to FIPS_TEST_GCM. The subid field is set to the NID of the cipher being
tested, "ex" is not used.
A known key, IV, AAD and plaintext is encrypted and the output ciphertext and tag compared to
known good values.
The ciphertext and take is then decrypted using the same key, IV, AAD and expected tag and the
result compared to the original plaintext.
If a failure is being simulated the tag is corrupted (first byte XORed with 0x1) before the
decryption test.
AES in GCM mode with a 256 key is tested.
Triggered by the aesgcm option to fips_test_suite.
6.3.1.9
Page 83 of 207
The id field is set to FIPS_TEST_CCM. The subid field is set to the NID of the cipher being
tested, "ex" is not used. The test is otherwise identical to the CCM test.
AES in CCM mode with a 192 bit key is tested.
Triggered by the aesccm option to fips_test_suite.
6.3.1.10
The id field is set to FIPS_TEST_XTS. The test is otherwise identical to the cipher tests.
AES in XTS mode with a 128 and a 256 bit key is tested.
Triggered by the aesxts option to fips_test_suite.
6.3.1.11
The id field is set to FIPS_TEST_SIGNATURE. The subid field is set to the NID of the
associated digest. The "ex" field is set to the EVP_PKEY structure of the key being used in the
KAT. By examining exstr the type of key being tested can be determined.
A signature is calculated using a known private key and data to be signed.
For deterministic signature algorithms (i.e. RSA in some padding modes) the signature is compared
to a known good value.
The signature is then verified using the same data used to create the signature.
If failure is being simulated an extra byte is digested in addition to the known data for signature
creation only. This will result in a signature which does not match the expected value (if this test is
being performed) or the verification will fail.
The following algorithms are tested:
a)
b)
c)
d)
RSA using PSS padding and SHA256 with a 2048 bit key.
ECDSA using P-224 and SHA512.
ECDSA using K-233 and SHA512 if binary fields are supported.
DSA using SHA384 and a 2048 bit key.
Page 84 of 207
The id field is set to FIPS_TEST_ECDH. The subid field is set to the NID of the curve used. The
"ex" field is not used.
Known private and public ECDH keys are used to compute a shared secret (Z) value. This is
compared to a known good value.
If failure is being simulated the computed shared secret is corrupted after generation. This will
result in a mismatch with the expected value.
Triggered by the ecdh option to fips_test_suite.
When an asymmetric signature key is generated a signature test identical to the POST signature
tests is performed on the generated key. The only difference is the id field is set to
FIPS_TEST_PAIRWISE.
In the case of RSA keys a consistency test is also performed using an RSA PKCS#1 padding
encryption and decryption operation: this operation is not registered with the callback. Specifically:
known data is encrypted, the ciphertext checked it does not match the plaintext and then decrypted.
The decrypted value is checked against the original plaintext.
For RSA keys the SHA256 digest is used and three tests performed PKCS#1, X931 and PSS
padding.
For DSA and ECDSA keys one test using SHA256 is performed.
Triggered by the dsakeygen and rsakeygen options to fips_test_suite.
6.3.2.2
When not in test mode (i.e. an operational "live" PRNG) the output of the PRNG is put through the
continuous PRNG test for FIPS 140-2.
The callback is not used for this operation.
If the function FIPS_x931_stick() is called then the X9.31 PRNG output is copied to the
stored last block to ensure the test will fail on the next generate operation.
If the function FIPS_drbg_stick() is called then the X9.31 PRNG output is copied to the
stored last block to ensure the test will fail on the next generate operation.
Page 85 of 207
The continuous PRNG test for the PRNG itself is triggered by the drbgstickandrngstick
options to fips_test_suite. The continuous PRNG test for the entropy source is triggered by
the drbgentstick option to fips_test_suite.
6.4
ECDH
The CAVP defines a test for ECDH in the form of "ECC CDH Primitive" tests:
http://csrc.nist.gov/groups/STM/cavp/#09
When this ECDH testing was introduced for FIPS 140-2 we initially assumed that with the growing
use of ECDH in TLS the intent was to ensure that usage was covered by an approved algorithm.
That turns out not to be the case. The algorithm now available for testing is "cofactor ECDH"
(formally known as ECC CDH) which is NOT the same as regular ECDH (formally known as as
the ECKAS-DH1 scheme) used with TLS -- it is a variant of ECDH that is not the same as that
commonly used in actual applications.
The differences between the two algorithms are small but enough to make the two incompatible in
subtle ways.
For regular ECDH the shared secret Z is the x component of the value dQ where d is one sides
private key (an integer) and Q the other sides public key (an elliptic curve point).
For cofactor ECDH the shared secret Z is the x component of the value hdQ where the new value h
is something called the cofactor (another integer) which is a property of the curve. For most
primes47 curves h=1 whereas for many binary curves h1. So for many prime curves (but
not all) the two algorithms yield the same result. For binary curves they do not.
Note that the addition of a few lines to the ECDH algorithm implementation changes it to cofactor
ECDH at which point it passes the CAVP ECC CDH Primitive test. However, if we change our
ECDH implementation to unconditionally use cofactor ECDH then it will not be interoperable with
TLS using binary curves.
Even though the use of cofactor ECDH is rare at present, there could conceivably be a need at some
point. In order to accommodate that possibility while preserving compatibility with existing
applications we added a flag to the EC_KEY structure to enable cofactor ECDH for use with the
FIPS 140-2 algorithm tests. This flag is set with the EC_KEY_set_flags() function:
47
The standard tested prime curves all use h = 1 excepting one non standard prime curve with h != 1; that is a 128 bit
curve and so forbidden in approved mode. Effectively this means that for an implementation only checking prime
curves (as many do) then the discrepancy would never be apparent. FIPS 140-2 does allow non-standard curves so two
"tested" algorithms could yield the different results.
Page 86 of 207
EC_KEY_set_flags(key,EC_FLAG_COFACTOR_ECDH);
If this flag it is not explicitly set then the ECKAS-DH1 (TLS compatible) scheme is used.
6.5
Why are there two versions of the OpenSSL FIPS Object Module 2.0?
At least some implementations of Elliptic Curve Cryptography (ECC) are perceived to be
encumbered in the United States by a complex set of patents. Concern about the possible risks of
patent infringement have been a significant disincentive to more widespread use of ECC.
In order to counter such concerns for the ECC necessary to implement the Suite B algorithms, the
NSA established a process for sub-licensing the patents for that subset of ECC (see
http://www.nsa.gov/ia/programs/suiteb_cryptography/index.shtml). The OSF has obtained such a
sublicense (http://openssl.com/testing/docs/NSA-PLA.pdf).
However, that sublicense only covers the specific patents presumed relevant to the prime curve
ECC used for Suite B. It does not cover other possible types of ECC such as binary curves which
are implemented in OpenSSL.
Judging the risks of a patent infringement lawsuit is difficult, and not only because the patents
themselves are usually incomprehensible to the software developer. The mere threat of a patent
lawsuit can be crippling to even a medium sided enterprise, regardless of the legitimacy of the
accusation of infringement.
It is the belief of the OpenSSL team that the implementation of ECC in OpenSSL, both primary and
binary curve, does not infringe any patents48. However, we aren't lawyers and patent law is
notoriously perverse. Some potential users are still concerned about the risk of patent litigation,
understandably so given the extent to which such litigation has been used as an offensive
commercial tactic in recent years. For the OpenSSL software such users can use build-time options
to omit specific algorithms of concern from the resulting binary code.
However, the restrictions of FIPS 140-2 prevent the use of such build-time options or modification
of the source code. One of the validation sponsors was concerned about patent risks and so a
separate "patent troll" source distribution of the OpenSSL FIPS Object Module 2.0 was created
which entirely omits the binary curve ECC. That distribution, opensslfipsecp2.0.tar.gz, is
functionally identical to the full distribution except for the omission of those algorithms, and all
discussion of the full distribution elsewhere in this document applies.
48
Also note that the bulk of the binary curve ECC implementation to the OpenSSL project was contributed by a
corporation, the former Sun Microsystems, with the legal resources to analyze such risks.
Page 87 of 207
Note that when using the "ecp" distributions the corresponding "FIPS capable" OpenSSL must be
built with the noec2m option.
6.6
This latest of the OpenSSL FIPS Object Module ("FIPS module") FIPS 140-2 validations saw the
introduction of a new requirement by the CMVP:
The distribution tar file, shall be verified using an independently acquired FIPS 140-2
validated cryptographic module...
We're told that this distribution tar file verification requirement comes directly from the assertions
AS10.03 and AS14.02 of the Derived Test Requirements document:
AS10.03: (Levels 1, 2, 3, and 4) Documentation shall specify the procedures for secure
installation, initialization, and startup of the cryptographic module.
AS14.02: (Levels 1, 2, 3, and 4) The cryptographic module security policy shall consist
of: a specification of the security rules, under which the cryptographic module shall
operate, including the security rules derived from the requirements of the standard and
the additional security rules imposed by the vendor.
Subsequent discussions mediated by the test lab elaborated this "secure installation" requirement to
mean that one of the following conditions must be true:
1) The distribution file is obtained via a "trusted path", which is one of:
a) Transfer via physical media (e.g. CD-ROM disk) sent by postal or delivery service
(USPS, UPS, FedEx);
b) Electronic transfer using cryptography (e.g. SSH, HTTPS, IPsec) implemented by FIPS
140-2 validated products. That requirement was further elaborated to state that those
products must themselves be a result of "secure installation".
2) The distribution file is verified (HMAC-SHA-1 digest checked) using a pre-existing FIPS
140-2 validated product that is itself the result of a "secure installation".
Note the recursive nature of the "secure installation" requirement represents a non-trivial challenge;
in order to transfer or verify a new validated product an existing securely installed validated
product must already be present. We're still struggling to understand the scope and implications of
this requirement. The FIPS 140-2 scripture (The FIPS 140-2 standard [Reference 1], the DTR
[Reference 4], and the IG [Reference 3] documents) doesn't shed a lot of light -- the term "trusted
path" for instance is only referenced in the context of Level 3 validations. Note those "secure
installation" and "trusted path" requirements as explained to us say that validated software cannot
be distributed by traditional methods, which leads to some interesting questions about the use of
other validated modules (puzzlement over why all other modules aren't similarly impacted is a large
part of our confusion). Those questions aside, prospective users of this FIPS module need to
Page 88 of 207
determine at least one known valid way to satisfy the requirement for this specific validation -- a
way not at risk of being ruled invalid by the CMVP after software has been shipped or deployed.
So far the CMVP has declined to answer specific questions about options for satisfying this
requirement; they quote the formal documentation (as noted above) and refer us to the test labs. We
have actively discussed this issue with several accredited test labs and selected members of the
FIPS validation community. Unfortunately the test labs are not in close agreement. So far we have
collected a lot of opinions but not much certainty. If you have experience or insights directly
relevant to this issue we'd love to hear from you49.
Very Important Note:
The conclusions presented here are still tentative as they have neither been confirmed nor
refuted by the CMVP; they simply represent our best understanding of the situation at this
point in time. These conclusions could change dramatically based on relevant feedback from
the CMVP, or more slowly in response to an accumulated consensus of opinion from the test
labs and FIPS 140-2 community of interest.
No delegation: one entity (OSF for instance) can't perform the verification of the source
tarball and then post that verified tarball on a website for download by everyone else unless
the download qualifies as a "trusted path", which in practice will mean the user performing
the download will need to obtain and install FIPS 140-2 validated client software (also
through a trusted path ... which is a circular problem for many users).
The new module itself (what is built from the source distribution) cannot be used to perform
the verification of the source distribution it was built from.
Earlier FIPS modules (such as the 1.2.3 FIPS module, validation certificate number #1051)
apparently cannot be used to perform the verification. Apparently the new tarball
verification requirement will be retroactively applied to the older OpenSSL FIPS Object
Module validations. We do not know if that will mean that all deployed instances of these
older modules will be declared invalid (that would have a huge impact), but the consensus
of our discussions is that the older modules can't be leveraged to verify the new module.
Use of an earlier binary module validation (certificate #1111) was suggested by the CMVP.
There are two problems with that suggestion; first, that particular validation took so long
(with a 13 month wait for CMVP action) that it had no economic value by the time it was
finally completed, and as a result it was abandoned and we no longer have the
corresponding binary module; and second, per our understanding that binary module would
need to be executed on some very obsolete platforms (OpenSuSE 10.2, no longer
downloadable from the maintainer, or Microsoft Windows XP SP2, no longer sold by the
49
http://openssl.com/contact.html
Page 89 of 207
vendor). Also in many environments (such as DoD) use of such unsupported operating
systems is forbidden by security policy.
One of our first thoughts was to create (by some means) an executable binary utility
program to perform the verification, that could be run on one or more common platforms
(e.g. Linux, Windows), and that we could provide publicly for everyone. However, it seems
we can't just post that utility for download on a typical web site as the downloaded file
would not have been obtained through a "trusted path". Our understanding is that a trusted
path over a network would require formally FIPS 140-2 validated software at both the client
and server which fails to address the issue of how to get validated cryptography in the first
place.
Another clever idea that was suggested was for us to provide a utility based on a known
common commercial validated cryptographic implementation, such as CryptoAPI in
Microsoft Windows. The utility could be freely downloaded because it would not contain
the actual cryptography. However, many prospective users will have obtained that validated
cryptography (the Microsoft Windows OS itself) by non-trusted means (the MSDN
download of ISO images does not use FIPS validated cryptography, nor does the usual
Internet based update process). Likewise an NSS based utility for Red Hat Enterprise Linux
would have the same problem (non-trusted installation and update). Even if the initial OS
installation was done with a trusted path, the subsequent routine updates are not50; so one
would have to install the OS using a vendor supplied CD/DVD and then not subsequently
update it over the Internet.
Note this last point is downright mind-boggling: it amounts to an assertion that essentially
all installations of validated software modules are illegitimate.
Many other options have been considered as well, without a clear consensus from those in the test
labs and the community of interest who we have consulted.
Use of a commercial proprietary product using FIPS 140-2 validated cryptography, obtained
via a trusted path (e.g. snail-mailed CD or DVD), to display the HMAC-SHA-1 digest of the
source tarball. That product should be capable of performing the equivalent of:
openssl sha1 -hmac etaonrishdlcupfm openssl-fips-2.0.tar.gz
As noted above, for reasons we don't understand the earlier OpenSSL FIPS Object Module
validations (e.g. #1051) are apparently not eligible for this role. At this point we are not
aware of any specific commercial products that perform this operation on a file, nor how
50
We were able to connect to both Microsoft and Red Hat distribution servers with non-allowed cryptographic
algorithms (e.g. RC4); hence we can deduce that those servers are not utilizing FIPS 140-2 validated cryptography.
Page 90 of 207
much they cost or how to purchase them. However, such products must exist. If you know
of or find a suitable product please let us know51 the details.
Use of a source code distribution that can be obtained from OSF on physical media (a CDROM disk) via snail-mail (USPS).
Note this option is specifically documented52 as acceptable in the Security Policy itself -- a
huge comfort factor for those concerned about the lack of clear guidance in this area. Also
note that some experienced and respected commentators in the FIPS 140-2 community of
interest that we consulted felt strongly that physical media should not constitute a trusted
path. However, a direct statement as placed in the Security Policy and approved by the
CMVP trumps any such concerns.
Until and if the postage costs get out of hand we will send those CDs on request at no cost.
Please send your request including a full postal address to [email protected]. Note that
the files you will receive on these CDs will be identical in every respect (except for FIPS
140-2 compliance) with the files you can download from the openssl.org web site, so we ask
that you only request this CD if you plan to use it for generation of FIPS 140-2 validated
cryptography in a context that requires such compliance. The downloaded files are bit-forbit identical and for any other purposes will generate exactly the same results.
Remember that the CMVP have a very different perspective on computers and software than
the average information technology practitioner. They do not have a software development
background.
Note that they are not the enemy; if it was their intent to consciously block or sabotage the
OpenSSL FIPS Object Module validations they could have done so easily long ago using a
wide range of bureaucratic tactics.
Note that if you disagree with what you are told by the Director of NIST CMVP you have
no recourse to appeal to any higher authority; his word is definitive and final (technically
51
http://openssl.com/contact.html
The discussions leading to this statement in the Security Policy were responsible for several weeks of delay in
obtaining the validation. We felt the issue of having one specific affirmatively approved process for satisfying this new
requirement was so critical as to warrant any necessary delay; placement of that statement in the Securitiy Policy itself
was essentially our only opportunity to obtain a definitive response on the topic from the CMVP.
53
http://csrc.nist.gov/groups/STM/cmvp/contacts.html
52
Page 91 of 207
the CMVP is a joint U.S.-Canadian program with the CSE54 as the Canadian equivalent of
NIST, but for U.S. users at least the NIST CMVP opinion is what matters. Canadian users
may want to consult the CSE).
6.7
If you learn anything of interest please share it with us55 and/or one of the OpenSSL mailing
lists56.
GMAC
The FIPS module was originally tested with, and awarded an algorithm validation for, AES GCM
including GMAC. The CAVP subsequently revised the algorithm and retroactively designated a
number of validations, including ours, as "GMAC not supported".
Many test devices had already been returned to the platform sponsors. Some of those were
one-off prototype or evaluation units and arranging with the sponsors to re-ship that
equipment to the OSF test lab would have taken a substantial amount of time and effort.
Even shipping costs themselves were non-trivial, as OSF pays return shipping for customer
supplied equipment. Those costs alone were several thousand dollars for the initial 2.0 FIPS
module testing.
54
http://www.cse-cst.gc.ca/index-eng.html
http://openssl.com:/contact.html
56
http://openssl.org/support/community.html
55
Page 92 of 207
Many man-weeks of effort would have been required to repeat the process of installing and
configuring each test device and then running the software build and execution process.
We would have to pay the test lab for the testing, a very substantial cost. Even with
negotiations to take into account the fact that the testing process was already fully
documented and tested for each device, that cost would probably have been at least
US$50,000.
All told we estimated the cost of retesting every platform would exceed US$70,000 even with OSF
personnel working for minimum wage.
Fortunately the practical impact of removing GMAC from the 2.0 module validation appears to be
minimal, as discussed in the following section.
This incident does illustrate the risk of unpredictable and unilateral CAVP/CMVP action. Passing
all the formal testing and receiving a validation award is no guarantee that the validation will not
disappear overnight57. That perceived risk is a large part of the appeal of the "private label"
validations for risk-adverse clients.
57
That has happened before, for instance the earlier OpenSSL FIPS Object Module validation #733 which was
effectively revoked by the CMVP. See http://veridicalsystems.com/blog/index.html?p=55.html for a discussion of that
incident.
Page 93 of 207
The bug in the FIPS module GCM implementation is triggered when GMAC is used, i.e. there is no
ciphertext/plaintext and only AAD. Also the bug is not manifested unless the AAD is not a multiple
of 16 bytes.
So if the AAD is a multiple of 16 bytes and/or there is any ciphertext/plaintext then the FIPS
module implementation works just fine.
During normal operation of the TLS protocol GMAC is not used because there is always some data
to encrypt or decrypt. The degenerate case of a zero length fragment we think could trigger this but
OpenSSL never produces such a thing and there is no reason for a non-OpenSSL TLS stack to do so
either. Further review may be needed to determine if a TLS 1.2 zero length fragment case is even
theoretically possible.
So to summarize: under any normal use cases the OpenSSL TLS implementation works in FIPS
mode just fine without GMAC.
6.8
DH
The version of DH used by TLS is a variant on PKCS#3 and not the X9.42 specification, and hence
is not compliant with SP800-56A. For example, the requirement:
Each private key shall be unpredictable and shall be generated in the range [1,
q-1] using an Approved random bit generator.
For TLS clients that requirement cannot be satisfied as stated because the parameter "q" is not sent
from server to client, only the parameter "p". Clients generate a private key in the range [1, p-1]
instead.
6.9
DSA
6.10 CCM
CCM is "Counter with Cipher Block Chaining-Message Authentication Code" per SP800-38C.
The opensslciphers command does not show anything for CCM as that command only lists
the cipher suites for SSL/TLS. For OpenSSL 1.0.2 and earlier CCM mode is not supported for TLS
in OpenSSL: such support was not requested by any validation sponsors and it wasn't even a
finalised standard at the time. Newer versions of OpenSSL do support CCM but the cipher string is
AESCCM because CCM can apply to other ciphers.
Page 94 of 207
Page 95 of 207
7.
REFERENCES
1.
OpenSSL FIPS 140-2 Security Policy, Version 2.0, Open Source Software Institute. This
document is available at http://csrc.nist.gov/groups/STM/cmvp/documents/1401/140sp/140spNNNN.pdf and http://www.openssl.org/docs/fips/.
2.
FIPS PUB 140-2, Security Requirements for Cryptographic Modules, May 2001, National
Institute of Standards and Technology, available at
http://csrc.nist.gov/publications/fips/fips140-2/fips1402.pdf.
3.
Implementation Guidance for FIPS PUB 140-2 and the Cryptographic Module Validation
Program, January 26, 2007, National Institute of Standards and Technology, available at
http://csrc.nist.gov/cryptval/140-1/FIPS1402IG.pdf.
4.
Derived Test Requirements [DTR] for FIPS PUB 140-2, Security Requirements for
Cryptographic Modules, January 4, 2011, National Institute of Standards and Technology,
available at http://csrc.nist.gov/groups/STM/cmvp/documents/fips1402/FIPS1402DTR.pdf.
5.
Network Security with OpenSSL, John Viega et. al., 15 June 2002, O'Reilly & Associates
6.
7.
8.
DRAFT Recommendation for the Transitioning of Cryptographic Algorithms and Key Sizes
http://csrc.nist.gov/publications/drafts/800-131/draft-sp800-131_spd-june2010.pdf
9.
10.
11.
Page 96 of 207
12.
13.
14.
15.
16.
Implementation Guidance for FIPS PUB 140-2 and the Cryptographic Module Validation
Program,
http://csrc.nist.gov/groups/STM/cmvp/documents/fips140-2/FIPS1402IG.pdf
17.
18.
19.
20.
Page 97 of 207
Appendix A
In order to be considered FIPS 140-2 validated the FIPS Object Module must be derived from an
OpenSSL distribution signed by one of these authorized keys, as shown by the value in the
Fingerprint row. These keys are subject to change and the list at https://openssl.org/about/ will
generally be more current.
The procedure for verifying that a source distribution was signed by one of these keys is described
in detail in 4.1.2.
Note the fingerprint formats are slightly different for the two different types of keys (RSA and
DSA).
Key Id
Page 98 of 207
Page 99 of 207
Appendix B
Instructions for building OpenSSL and performing the FIPS 140-2 and related algorithm tests on
Linux/Unix Microsoft Windows based platforms are given here. These instructions are
primarily of interest to the CMVP testing laboratory performing the validation testing, or anyone
wishing to verify that the executable library generates generates the same output for the algorithm
tests performed by the testing laboratory.
Note there is no requirement for end users or application developers to run these tests; this
discussion is included for reference purposes to illustrate the algorithm testing performed by the
CMVP test lab. Note this step requires a large directory tree of input test data files produced by the
testing lab using a NIST provided tool (CAVS); several sets of input and response values can be
found http://openssl.com/testing/validation-2.0/testvectors/. The file
http://openssl.com/testing/validation-2.0/testvectors/tv.tar.gz
contains a complete set of 259 test vector files with correct responses that can be used for a single
comprehensive test. Note the number and format of these test vector files changes over time, so this
set may not correspond exactly to what the CAVS tool currently produces.
to generate the standalone additional programs to support the testing process. To generate a
single program that contains the functionality of fips_test_suite and the individual standalone
algorithm test programs, run
makebuild_algvs
to build the fips_algvs program. This program is necessary for some platforms that do not
provide a suitable command shell and for which the execution of many separate programs is
awkward or difficult, and may be convenient in other circumstances.
The fips_algvs program can be used to execute specific tests, for instance
fips_algvfips_test_suitepost
fips_algvfips_dssvspqg"tv/req/PQGGen.req"
"tv/resp/PQGGen.rsp"
or if given no command line options it will process the subcommands in a minimal shell script
as generated by
perlfipsalgtest.pldir=<testvectors>minimalscript
generatescript=fipstests.shperltprefix=
which will produce a file fipstests.sh with the subcommands corresponding to each
request file, e.g.:
fips_dssvspqg"tv/req/PQGGen.req""tv/resp/PQGGen.rsp"
The fips_algvs program supports the following command line options:
quiet
verbose
script<filename>
In absence of any options it assumes a script file fipstests.sh should be read from the
current directory. If the first argument doesn't begin with a '-' it is taken as the name of a sub
program to run:
fips_aesavs
fips_algvs
fips_cmactest
fips_desmovs
fips_dhvs
fips_drbgvs
fips_dsatest
fips_dssvs
fips_ecdhvs
fips_ecdsavs
fips_gcmtest
fips_hmactest
fips_randtest
fips_rngvs
fips_rsagtest
fips_rsastest
fips_rsavtest
fips_shatest
fips_test_suite
Note that for future validations the fips_algvs program will probably entirely replace the
separate fips_test_suite and algorithm test driver programs.
Due to the nature of the cryptographic operations involved the following responses files will always be different:
KeyPair.rsp
DSA
PQGGen.rsp
DSA
SigGen.rsp
DSA
SigGen15.rsp
RSA
SigGenPSS.rsp
RSA
SigGenRSA.rsp
RSA
SigGenPSS.rsp
RSA
The special case cryptographic operations are listed in the associative array %verify_specials tin the fipsalgvs.pl
perl script.
6. To generate and preserve new response files use the generate option:
perlfipsalgtest.pldir=testvectorsgenerate
Many (approximately 259) generated *.rsp files will be found in the ./testvectors/
directory tree under ./fips/:
findtestvectors/name'*.rsp'
7. The tree of *.rsp files can also be extracted for comparison with another tree:
findtestvectorsname'*.rsp'|cpiooc>rsp1.cpio
.
.
.
cd/tmp
mkdirrsp1rsp2
cdrsp1;cpioic<rsp1.cpio
cd../rsp2;cpioic<rsp2.cpio
diffr.../rsp1
If the only other differences are the commented date-time labels then the trees match:
diffr./testvectors/aes/resp/CBCGFSbox128.rsp\
../rsp1/testvectors/aes/resp/CBCGFSbox128.rsp
6c6
<#ThuMar411:05:362004
>#FriFeb2012:21:242004
diffr./testvectors/aes/resp/CBCGFSbox192.rsp\
../rsp1/testvectors/aes/resp/CBCGFSbox192.rsp
6c6
<#ThuMar411:05:362004
>#FriFeb2012:21:242004
.
.
.
IntegritytestOK
DRBGAES256CTRDFteststarted
DRBGAES256CTRDFtestOK
DRBGAES256CTRteststarted
DRBGAES256CTRtestOK
DRBGSHA256teststarted
DRBGSHA256testOK
DRBGHMACSHA256teststarted
DRBGHMACSHA256testOK
DRBGP256SHA256teststarted
DRBGP256SHA256testOK
X9.31PRNGkeylen=16teststarted
X9.31PRNGkeylen=16testOK
X9.31PRNGkeylen=24teststarted
X9.31PRNGkeylen=24testOK
X9.31PRNGkeylen=32teststarted
X9.31PRNGkeylen=32testOK
DigestSHA1teststarted
DigestSHA1testOK
DigestSHA1teststarted
DigestSHA1testOK
DigestSHA1teststarted
DigestSHA1testOK
HMACSHA1teststarted
HMACSHA1testOK
HMACSHA224teststarted
HMACSHA224testOK
HMACSHA256teststarted
HMACSHA256testOK
HMACSHA384teststarted
HMACSHA384testOK
HMACSHA512teststarted
HMACSHA512testOK
CMACAES128CBCteststarted
CMACAES128CBCtestOK
CMACAES192CBCteststarted
CMACAES192CBCtestOK
CMACAES256CBCteststarted
CMACAES256CBCtestOK
CMACDESEDE3CBCteststarted
CMACDESEDE3CBCtestOK
CipherAES128ECBteststarted
CipherAES128ECBtestOK
CCMteststarted
CCMtestOK
GCMteststarted
GCMtestOK
XTSAES128XTSteststarted
XTSAES128XTStestOK
XTSAES256XTSteststarted
XTSAES256XTStestOK
CipherDESEDE3ECBteststarted
CipherDESEDE3ECBtestOK
CipherDESEDE3ECBteststarted
CipherDESEDE3ECBtestOK
SignatureRSAteststarted
SignatureRSAtestOK
SignatureECDSAP224teststarted
SignatureECDSAP224testOK
SignatureECDSAK233teststarted
SignatureECDSAK233testOK
SignatureDSAteststarted
SignatureDSAtestOK
ECDHP224teststarted
ECDHP224testOK
POSTSuccess
2.Automaticpowerupselftest...successful
3a.AESencryption/decryption...successful
3b.AESGCMencryption/decryption...successful
PairwiseConsistencyRSAteststarted
PairwiseConsistencyRSAtestOK
PairwiseConsistencyRSAteststarted
PairwiseConsistencyRSAtestOK
PairwiseConsistencyRSAteststarted
PairwiseConsistencyRSAtestOK
4.RSAkeygenerationandencryption/decryption...successful
5.DESECBencryption/decryption...successful
PairwiseConsistencyDSAteststarted
PairwiseConsistencyDSAtestOK
6.DSAkeygenerationandsignaturevalidation...successful
7a.SHA1hash...successful
7b.SHA256hash...successful
7c.SHA512hash...successful
7d.HMACSHA1hash...successful
7e.HMACSHA224hash...successful
7f.HMACSHA256hash...successful
7g.HMACSHA384hash...successful
7h.HMACSHA512hash...successful
8a.CMACAES128hash...successful
8b.CMACAES192hash...successful
8c.CMACAES256hash...successful
8e.CMACTDEA3hash...successful
9.NonApprovedcryptographicoperationtest...
a.Includedalgorithm(DH)...successfulasexpected
PairwiseConsistencyRSAteststarted
PairwiseConsistencyRSAtestOK
PairwiseConsistencyRSAteststarted
PairwiseConsistencyRSAtestOK
PairwiseConsistencyRSAteststarted
PairwiseConsistencyRSAtestOK
Generated128byteRSAprivatekey
BNkeybeforeoverwriting:
400e460169e1e37d8f415fe50c40fab493185c17e99b76e123bc0f3d7d0c8b1f42881ff7396b
3ee388c3b973cece2d7d231109a7202016daf1e26caca9e704b9bffd9bd6151d61ab3050a82e
78510abf2e450a6c57e9fb7db8a837f81fc93db0c6c95d090ac6752b8ac4ee51623ffcbd270b
0ed281ebbe2e6a3a9d0a4012a991 BNkeyafteroverwriting:
668d6314da4f25ca496a6f98e2f6986437be60f2d34880e8d08060263dd10a3bde7345ef99ed
00e2edeedf43a1bda7053c58b6474051bbaf9c9e5bf70a488a7b94d88c67fc9e16fc9e4bb231
8836dc47282c8e41d3c35bc400949cd2d2b5e0ee0bd84ce8dffdb02dfc6c9528d0be43b0d95f
ce6e979c561070e6da5a05b9e53e charbufferkeybeforeoverwriting:
4850f0a33aedd3af6e477f8302b10968
charbufferkeyafteroverwriting:
788fadb58c8163405e883a63550fd732
10.Zeroization...
successfulasexpected
11.CompleteDRBGhealthcheck...
DRBGAES128CTRDFteststarted
DRBGAES128CTRDFtestOK
DRBGAES192CTRDFteststarted
DRBGAES192CTRDFtestOK
.
.
.
(verylonglistofDRBGtests)
.
.
.
DRBGP521SHA384teststarted
DRBGP521SHA384testOK
DRBGP521SHA512teststarted
DRBGP521SHA512testOK
successfulasexpected
12.DRBGgenerationcheck...
DRBGSHA1teststarted
DRBGSHA1testOK
DRBGSHA1teststarted
DRBGSHA1testOK
.
.
.
(verylonglistofDRBGtests)
.
.
DRBGP521SHA512testOK
DRBGP521SHA512teststarted
DRBGP521SHA512testOK
successfulasexpected
Alltestscompletedwith0errors
The nodh option skips the glacial and largely pointless DH test.
The nodrbg option skips the slow full DRBG test
The fullpostoption gives a complete POST listing instead of induced failure and
unexpected errors. The output is then much more verbose as it contains every successful test
too.
The fullerr option is useful for code tracing. Normally during the induced failure test
library errors are not printed out. With this option the error codes corresponding to each
operation are displayed showing the exact line and error code output.
2. When executed with the post command line option only module initialization will be
performed:
$test/fips_test_suitepost
FIPSmodetestapplication
FIPS2.0devunvalidatedtestmodulexxXXXxxxx
DRBGAES256CTRDFteststarted
DRBGAES256CTRDFtestOK
POSTstarted
Integrityteststarted
IntegritytestOK
DRBGAES256CTRDFteststarted
DRBGAES256CTRDFtestOK
DRBGAES256CTRteststarted
DRBGAES256CTRtestOK
DRBGSHA256teststarted
DRBGSHA256testOK
DRBGHMACSHA256teststarted
DRBGHMACSHA256testOK
DRBGP256SHA256teststarted
DRBGP256SHA256testOK
X9.31PRNGkeylen=16teststarted
X9.31PRNGkeylen=16testOK
X9.31PRNGkeylen=24teststarted
X9.31PRNGkeylen=24testOK
X9.31PRNGkeylen=32teststarted
X9.31PRNGkeylen=32testOK
DigestSHA1teststarted
DigestSHA1testOK
DigestSHA1teststarted
DigestSHA1testOK
DigestSHA1teststarted
DigestSHA1testOK
HMACSHA1teststarted
HMACSHA1testOK
HMACSHA224teststarted
HMACSHA224testOK
HMACSHA256teststarted
HMACSHA256testOK
HMACSHA384teststarted
HMACSHA384testOK
HMACSHA512teststarted
HMACSHA512testOK
CMACAES128CBCteststarted
CMACAES128CBCtestOK
CMACAES192CBCteststarted
CMACAES192CBCtestOK
CMACAES256CBCteststarted
CMACAES256CBCtestOK
CMACDESEDE3CBCteststarted
CMACDESEDE3CBCtestOK
CipherAES128ECBteststarted
CipherAES128ECBtestOK
CCMteststarted
CCMtestOK
GCMteststarted
GCMtestOK
XTSAES128XTSteststarted
XTSAES128XTStestOK
XTSAES256XTSteststarted
XTSAES256XTStestOK
CipherDESEDE3ECBteststarted
CipherDESEDE3ECBtestOK
CipherDESEDE3ECBteststarted
CipherDESEDE3ECBtestOK
SignatureRSAteststarted
SignatureRSAtestOK
SignatureECDSAP224teststarted
SignatureECDSAP224testOK
SignatureECDSAK233teststarted
SignatureECDSAK233testOK
SignatureDSAteststarted
SignatureDSAtestOK
ECDHP224teststarted
ECDHP224testOK
POSTSuccess
Powerupselftestsuccessful
$
Note this invocation is useful for a quick estimation of the performance impact of module
initialization.
3. To demonstrate the correct functioning of the integrity and KAT test failures a set of corruption
tests are run automatically when the unqualified fips_test_suite option is specified. In
the implementation of the fips_algvs utility these tests are specified in the
fail_list_flist structure and a series of in-line tests which are traversed by the static
function do_fail_all() at the point where the line
13.Inducedtestfailurecheck...
is printed. Each specific test is preceded by one of the lines
TestinginducedfailureofXXXX
TestingoperationfailurewithXXXX
and the conclusion of all the corruption tests should end with the lines
Inducedfailuretestcompletedwith0errors
successfulasexpected
Note the use of three static variables by the function do_fail_all() to specify the specific
corruption tests to be performed.
The individual tests in the order performed are:
Integrity
AES
DES3
AESGCM
AESCCM
AESXTS
Digest
HMAC
CMAC
DRBG
X9.31PRNG
RSA
DSA
ECDSA
ECDH
RSAkeygen
DSAkeygen
ECDSAkeygen
DRBGCPRNG
DRBGentropyCPRNG
X9.31CPRNG
DRBGentropyfailure
This full set of corruption tests should appear as follows:
13.Inducedtestfailurecheck...
TestinginducedfailureofIntegritytest
POSTstarted
Integritytestfailureinduced
Integritytestfailedasexpected
POSTFailed
TestinginducedfailureofAEStest
POSTstarted
CipherAES128ECBtestfailureinduced
CipherAES128ECBtestfailedasexpected
POSTFailed
TestinginducedfailureofDES3test
POSTstarted
CipherDESEDE3ECBtestfailureinduced
CipherDESEDE3ECBtestfailedasexpected
POSTFailed
TestinginducedfailureofAESGCMtest
POSTstarted
GCMtestfailureinduced
GCMtestfailedasexpected
POSTFailed
TestinginducedfailureofAESCCMtest
POSTstarted
CCMtestfailureinduced
CCMtestfailedasexpected
POSTFailed
TestinginducedfailureofAESXTStest
POSTstarted
XTSAES128XTStestfailureinduced
XTSAES128XTStestfailedasexpected
XTSAES256XTStestfailureinduced
XTSAES256XTStestfailedasexpected
POSTFailed
TestinginducedfailureofDigesttest
POSTstarted
DigestSHA1testfailureinduced
DigestSHA1testfailedasexpected
DigestSHA1testfailureinduced
DigestSHA1testfailedasexpected
DigestSHA1testfailureinduced
DigestSHA1testfailedasexpected
POSTFailed
TestinginducedfailureofHMACtest
POSTstarted
HMACSHA1testfailureinduced
HMACSHA1testfailedasexpected
HMACSHA224testfailureinduced
HMACSHA224testfailedasexpected
HMACSHA256testfailureinduced
HMACSHA256testfailedasexpected
HMACSHA384testfailureinduced
HMACSHA384testfailedasexpected
HMACSHA512testfailureinduced
HMACSHA512testfailedasexpected
POSTFailed
TestinginducedfailureofCMACtest
POSTstarted
CMACAES128CBCtestfailureinduced
CMACAES128CBCtestfailedasexpected
CMACAES192CBCtestfailureinduced
CMACAES192CBCtestfailedasexpected
CMACAES256CBCtestfailureinduced
CMACAES256CBCtestfailedasexpected
CMACDESEDE3CBCtestfailureinduced
CMACDESEDE3CBCtestfailedasexpected
POSTFailed
TestinginducedfailureofDRBGtest
POSTstarted
DRBGAES256CTRtestfailureinduced
DRBGAES256CTRDFtestfailedasexpected
DRBGAES256CTRtestfailureinduced
DRBGAES256CTRtestfailedasexpected
DRBGSHA256testfailureinduced
DRBGSHA256testfailedasexpected
DRBGHMACSHA256testfailureinduced
DRBGHMACSHA256testfailedasexpected
DRBGP256SHA256testfailureinduced
DRBGP256SHA256testfailedasexpected
POSTFailed
TestinginducedfailureofX9.31PRNGtest
POSTstarted
X9.31PRNGkeylen=16testfailureinduced
X9.31PRNGkeylen=16testfailedasexpected
X9.31PRNGkeylen=24testfailureinduced
X9.31PRNGkeylen=24testfailedasexpected
X9.31PRNGkeylen=32testfailureinduced
X9.31PRNGkeylen=32testfailedasexpected
POSTFailed
TestinginducedfailureofRSAtest
POSTstarted
SignatureRSAtestfailureinduced
SignatureRSAtestfailedasexpected
POSTFailed
TestinginducedfailureofDSAtest
POSTstarted
SignatureDSAtestfailureinduced
SignatureDSAtestfailedasexpected
POSTFailed
TestinginducedfailureofECDSAtest
POSTstarted
SignatureECDSAP224testfailureinduced
SignatureECDSAP224testfailedasexpected
POSTFailed
TestinginducedfailureofECDHtest
POSTstarted
ECDHP224testfailureinduced
ECDHP224testfailedasexpected
POSTFailed
TestinginducedfailureofRSAkeygentest
POSTstarted
POSTSuccess
PairwiseConsistencyRSAtestfailureinduced
PairwiseConsistencyRSAtestfailedasexpected
RSAkeygenerationfailedasexpected.
TestinginducedfailureofDSAkeygentest
POSTstarted
POSTSuccess
PairwiseConsistencyDSAtestfailureinduced
PairwiseConsistencyDSAtestfailedasexpected
DSAkeygenerationfailedasexpected.
POSTstarted
POSTSuccess
TestinginducedfailureofECDSAkeygentest
PairwiseConsistencyECDSAtestfailureinduced
PairwiseConsistencyECDSAtestfailedasexpected
ECDSAkeygenerationfailedasexpected.
POSTstarted
POSTSuccess
TestinginducedfailureofDRBGCPRNGtest
DRBGcontinuousPRNGfailedasexpected
POSTstarted
POSTSuccess
TestinginducedfailureofDRBGentropyCPRNGtest
DRBGcontinuousPRNGentropyfailedasexpected
POSTstarted
POSTSuccess
POSTstarted
POSTSuccess
TestinginducedfailureofX9.31CPRNGtest
X9.31continuousPRNGfailedasexpected
POSTstarted
POSTSuccess
TestingoperationfailurewithDRBGentropyfailure
DSAkeygeneratedOKasexpected.
DRBGentropyfailfailedasexpected
DSAsigningfailedasexpected
ECDSAkeygenerationfailedasexpected.
Inducedfailuretestcompletedwith0errors
successfulasexpected
So, the presence of the line
Inducedfailuretestcompletedwith0errors
for the block of tests beginning with the line
13.Inducedtestfailurecheck...
is a readily observed indication that all corruption tests performed as expected.
4. To demonstrate the module authentication one of four command line options may be given to
specify the password value to be passed to FIPS_module_mode_set():
nopass
Null password
badpass
user
officer
If none of those command line options are given the FIPS_AUTH_CRYPTO_USER password
is used. Invocation with none or badpass will fail:
$test/fips_test_suitebadpass
FIPSmodetestapplication
FIPS2.0devunvalidatedtestmodulexxXXXxxxx
DRBGAES256CTRDFteststarted
DRBGAES256CTRDFtestOK
ERROR:2D078097:lib=45,func=120,reason=151:file=fips.c:line=
300
Powerupselftestfailed
$
and invocation with user or officerwill successfully perform the POST test.
AES
108
Algorithm
AES_GCM
CCM
15
CMAC
DES
DRBG
DSA
DSA2
ECDSA
ECDSA2
HMAC
KAS
RNG
RSA
SHA
15
TDES
66
XTS
Total
259
In order to facilitate the processing of test vector data a series of utilities were developed,
culminating in the fipsalgtest.pl program. This program searches a target directory for the
known *.rsp files and generates a script referencing the actual pathnames for those files. That
script can then be executed to perform the algorithm tests that generate the *.rsp result files. The
fipsalgtest.pl program reports unrecognized duplicate *.rsp files and any files that were
expected but not found.
Testvector data sets are generally received as *.zip files, more rarely as *.tgz. A typical
pathname structure (for this validation) is as follows:
./OSF_2464_Template
./OSF_2464_Template/AES
./OSF_2464_Template/AES/resp
./OSF_2464_Template/AES/req
./OSF_2464_Template/AES/req/CBCGFSbox128.req
./OSF_2464_Template/AES/req/CFB128MMT192.req
./OSF_2464_Template/AES/req/CBCVarKey192.req
./OSF_2464_Template/AES/req/CFB1VarTxt256.req
./OSF_2464_Template/AES/req/CBCMMT128.req
./OSF_2464_Template/AES/req/CBCKeySbox256.req
./OSF_2464_Template/AES/req/ECBVarTxt192.req
./OSF_2464_Template/AES/req/CFB128VarKey256.req
./OSF_2464_Template/AES/req/OFBVarTxt128.req
./OSF_2464_Template/AES/req/CFB1MCT192.req
./OSF_2464_Template/AES/req/CBCVarKey128.req
./OSF_2464_Template/AES/req/CFB8VarTxt128.req
./OSF_2464_Template/AES/req/ECBMMT128.req
./OSF_2464_Template/AES/req/CBCGFSbox192.req
./OSF_2464_Template/AES/req/CFB128MCT192.req
./OSF_2464_Template/AES/req/OFBMCT128.req
./OSF_2464_Template/AES/req/CFB1GFSbox256.req
.
.
.
Note directory names may contain embedded spaces. The data files will generally (though not
necessarily) be carriage return-line feed delimited.
If multiple platforms are involved in a validation the test vector files for several platforms may be
interspersed in the same directory tree. We have also received test vector files for a single platform
in multiple different *.zip files, so the fipsalgtest.pl program must be able to filter the
relevant *.rsp files out of multiple subdirectories.
The following fipsalgtest.pl options can be used to accommodate various representations of
test vector files:
fipsalgtest.pl:generaterunCAVPalgorithmtests
debugEnabledebugoutput
dir=<dirname>Optionalrootfor*.reqfilesearch
filter=<regexp>Regexforinputfilesofinterest
onedir<dirname>Assumeallcomponentsincurrentdirectory
rspdir=<dirname>Nameofsubdirectoriescontaining*.rsp
files,default"resp"
tprefix=<prefix>Pathnameprefixfordirectorycontainingtest
programs
ignorebogusIgnoreduplicateorbogusfiles
ignoremissingIgnoremissingtestfiles
quietShhh....
quietbogusSkipunrecognizedfilewarnings
quietmissingSkipmissingrequestfilewarnings
generateGeneratealgorithmtestoutput
generatescript=<filename>Generatescripttocallalgorithmprograms
minimalscriptSimplestpossibleoutputfor
generatescript
win32Win32environment
compareallVerifyunconditionallyforalltests
listtestsShowindividualtests
mkdir=<cmd>Specify"mkdir"command
notestExitbeforerunningtests
rm=<cmd>Specify"rm"command
scripttprefixPathnameprefixforgeneratescriptoutput
enable<alg>Enablealgorithmset<alg>.
disable<alg>
Disablealgorithmset<alg>.
Where<alg>canbeoneof:
aesccm(disabledbydefault)
randaes(enabledbydefault)
ecdsa(disabledbydefault)
hmac(enabledbydefault)
dh(disabledbydefault)
aescfb1(disabledbydefault)
ecdh(disabledbydefault)
des3cfb1(disabledbydefault)
drbg(disabledbydefault)
des3(enabledbydefault)
dsa(enabledbydefault)
dsapqgver(disabledbydefault)
rsapss0(disabledbydefault)
sha(enabledbydefault)
aes(enabledbydefault)
dsa2(disabledbydefault)
aesgcm(disabledbydefault)
rsapss62(enabledbydefault)
cmac(disabledbydefault)
aesxts(disabledbydefault)
rsa(enabledbydefault)
v2(enabledbydefault)
randdes2(disabledbydefault)
Simply run
perlfipsalgtest.pldir=testvectorsgenerate
to generate the *.rsp files for submission to the test lab.
Subsequently running fipsalgtest.pl without the --generate option will compare the
generated output with the previously existing *.rsp files, and thus provides a comprehensive
(though unofficial) check of the algorithm tests.
Individual algorithm tests can be selectively specified with options of the form --enablexxx or
disablexxx where xxx is one of the <alg> algorithm specifications
The ignorebogus and ignoremissing options suppress the error exit if the target
test vector directory contains more or fewer *.rsp files than expected (a not uncommon
occurrence in validation testing.
For target platforms that do not support a perl interpreter, but which do provide a basic command
line shell, a simple shell script can be generated, for instance:
perl./fips/fipsalgtest.plgeneratescript=fipstest.shtprefix=./test/
will create a file fipstest.sh script file that successively invokes each of the algorithm test driver
programs with the appropriate input and output file names:
#!/bin/sh
#Testvectorrunscript
#Autogeneratedbyfipsalgtest.plscript
#Donotedit
echoRunningAlgorithmTests
RM="rmrf";
MKDIR="mkdir";
TPREFIX=./test/
echo"RunningDSAtests"
$RM"./testvectors/tv/OSF_2464_Template/DSA/resp"
$MKDIR"./testvectors/tv/OSF_2464_Template/DSA/resp"
echo"runningPQGGentest"
${TPREFIX}fips_dssvspqg
"./testvectors/tv/OSF_2464_Template/DSA/req/PQGGen.req"
"./testvectors/tv/OSF_2464_Template/DSA/resp/PQGGen.rsp"
echo"runningKeyPairtest"
${TPREFIX}fips_dssvskeypair
"./testvectors/tv/OSF_2464_Template/DSA/req/KeyPair.req"
"./testvectors/tv/OSF_2464_Template/DSA/resp/KeyPair.rsp"
echo"runningSigGentest"
${TPREFIX}fips_dssvssiggen
"./testvectors/tv/OSF_2464_Template/DSA/req/SigGen.req"
"./testvectors/tv/OSF_2464_Template/DSA/resp/SigGen.rsp"
echo"runningSigVertest"
${TPREFIX}fips_dssvssigver
"./testvectors/tv/OSF_2464_Template/DSA/req/SigVer.req"
"./testvectors/tv/OSF_2464_Template/DSA/resp/SigVer.rsp"
echo"runningPQGVertest"
${TPREFIX}fips_dssvspqgver
"./testvectors/tv/OSF_2464_Template/DSA/req/PQGVer.req"
"./testvectors/tv/OSF_2464_Template/DSA/resp/PQGVer.rsp"
.
.
.
For very simple shells the -minimalscript option will omit use of the rm and mkdir
commands to manage the output directories, in which case the empty req subdirectories will need
to be created beforehand.
To process only a subset of the test vectors file, use the filter=XXX option to recognize only
certain pathnames and the disableallenablexxx options to enable processing of
only the algorithm(s) in that selected set for files. For instance:
perl./fips/fipsalgtest.plgeneratescript=fipstestsha.shtprefix=./test/
disableallenableshadir=testvectorsfilter=SHA
B.6 Documentation
This section discussed the major components of the documentation set for a FIPS 140-2 validation.
Finite State Model
FIPS 140-2 validation requires a Finite State Module (FSM), something that doesn't make much
sense for a general purpose cryptographic library. This cosmetic requirement is satisfied by an
arbitrary generic diagram and possibly an associated listing or spreadsheet of the states and
transitions. Each test lab will typically have a generic template or sample that can be used. The
FSM used for this validation can be found in the two files:
http://openssl.com/testing/validation-2.0/docs/FSM.pdf
http://openssl.com/testing/validation-2.0/docs/FSM_main.pdf
The FSM does not contain any information of actual technical value.
Vendor Evidence Document
The test lab must answer the assertions in the Derived Test Requirements (DTR) document
(Reference 4). Some labs chose to do so by directly listing all of the assertions with corresponding
responses in the order those assertions appear in the DTR. Others respond to the assertions in
analysis document structured along more functional lines with many of the redundant an
overlapping assertions grouped together with a consolidated response. As with the formal test
report (see following section) the test lab will typically want to claim this document as proprietary.
The relevant content of the analysis document for this validation has been extracted as Appendix E.
Formal Test Report
The test lab submits a formal test report document to the CMVP. Test labs are uniformly adverse to
releasing this document but can usually be persuaded to do so under a non-disclosure agreement
(such release should be negotiated prior to executing a contract). OSF has seen some test reports
but cannot publish them due to the non-disclosure restrictions. Note that those test reports would be
of limited value as different test labs can take significantly different approaches to presenting the
same module to the CMVP. FIPS 140-2 validation is a highly subjective process and each test lab,
and even different reviewers at the CMVP, have distinctive styles. Mixing components from
multiple submissions, even of exactly the same software, would result in significant discrepancies
and conflicts.
Appendix C
This example shows a simple application using OpenSSL cryptography which will qualify as FIPS
140-2 validated when built and installed in accordance with the procedures in 5. In this
application all cryptography is provided through the FIPS Object Module and the FIPS mode
initialization is performed via the FIPS_mode_set() call. The command generates a HMACSHA-1 digest of an input stream or a file, using the same arbitrary key as the OpenSSL FIPS
Module file integrity check:
$./fips_hmacvfips_hmac.c
FIPSmodeenabled
8f2c8e4f60607613471c11287423f8429b068eb2
$
$./hmac<hmac.c
8f2c8e4f60607613471c11287423f8429b068eb2
$
or
openssldgstfipsfingerprintfilename.tar.gz
for an openssl command built from a FIPS capable OpenSSL distribution. The OPENSSL_FIPS=1
environment variable enables FIPS mode for a openssl command generated from a FIPS capable
OpenSSL distribution.
clean:
rm$(OBJS)
uses the fipsld command from the distribution source tree to perform the function of verifying
the fipscanister.o digest and generating the new embedded digest in the application
executable object.
Source File
/*
SampleapplicationusingFIPSmodeOpenSSL.
ThisapplicationwillqualifyasFIPS1402validatedwhenbuilt,
installed,andutilizedasdescribedinthe"OpenSSLFIPS1402
SecurityPolicy"manual.
ThiscommandcalculatesaHMACSHA1digestofafileorinputdata
streamusingthesamearbitraryhardcodedkeyastheFIPS1402
sourcefilebuildtimeintegritychecksandruntimeexecutable
fileintegritycheck.
*/
#include<stdio.h>
#include<string.h>
#include<openssl/hmac.h>
staticcharlabel[]="@(#)FIPSapprovedSHA1HMAC";
staticvoiddofile(FILE*fp)
{
HMAC_CTXctx;
unsignedcharhmac_value[EVP_MAX_MD_SIZE];
inthmac_len,i;
charkey[]="etaonrishdlcupfm";
charbuf[256];
/*Initialisecontext*/
HMAC_CTX_init(&ctx);
/*Setdigesttypeandkeyincontext*/
HMAC_Init_ex(&ctx,key,strlen(key),EVP_sha1(),NULL);
/*Processinputstream*/
while(i=fread(buf,sizeof(char),sizeof(buf),fp)){
if(!HMAC_Update(&ctx,buf,i))exit(3);
}
/*Generatedigest*/
if(!HMAC_Final(&ctx,hmac_value,&hmac_len))exit(4);
HMAC_CTX_cleanup(&ctx);
/*Displaydigestinhex*/
for(i=0;i<hmac_len;i++)printf("%02x",hmac_value[i]);
printf("\n");
return;
}
main(intargc,char*argv[])
{
char*opt=NULL;
intverbose=0;
intfipsmode=1;
FILE*fp=stdin;
inti;
/*Processcommandlinearguments*/
i=0;
while(++i<argc){
opt=argv[i];
if(!strcmp(opt,"v"))verbose=1;
elseif(!strcmp(opt,"c"))fipsmode=0;
elseif(''==opt[0]){
printf("Usage:%s<filename>\n",argv[0]);
puts("Options:");
puts("\tc\tUsenonFIPSmode");
puts("\tv\tVerboseoutput");
exit(1);
}
elsebreak;
}
/*EnterFIPSmodebydefault*/
if(fipsmode){
if(FIPS_mode_set(1)){
verbose&&fputs("FIPSmodeenabled\n",stderr);
}
else{
ERR_load_crypto_strings();
ERR_print_errors_fp(stderr);
exit(1);
}
}
if(i>=argc){
dofile(fp);
}
else{
while(i<argc){
opt=argv[i];
if((fp=fopen(opt,"rb"))==NULL){
fprintf(stderr,"Unabletoopenfile\"%s\"\n",opt);
exit(1);
}
dofile(fp);
fclose(fp);
i++;
}
}
exit(0);
}
#Buildthe"FIPScapable"OpenSSL
gunzipcopenssl1.0.1c.tar.gz|tarxf
cdopenssl1.0.1c/
./configfipssharedwithfipsdir=$PWD/../fips
makedepend
make
#Buildtheexampleprogram
armlinuxandroideabigccofips_hmacfips_hmac.c\
Iopenssl1.0.1c/include/Lopenssl1.0.1c/lcryptoIopenssl1.0.1c\
Iandroidndkr7c/platforms/android14/archarm/usr/include\
Bandroidndkr7c/platforms/android14/archarm/usr/lib
#CopytheprogramandsharedlibrarytotheAndroiddevice
./androidsdklinux/platformtools/adbpushfips_hmac/data/local/tmp/
./androidsdklinux/platformtools/adbpushopenssl
1.0.1c/libcrypto.so.1.0.0/data/local/tmp/
#ExecutetheprogramontheAndroiddevice
./androidsdklinux/platformtools/adbpushfips_hmacshell
cd/data/local/tmp
LD_LIBRARY_PATH=openssl1.0.1c./fips_hmacvfips_hmac.c
Appendix D
D.3 FIPS_mode()
NAME
FIPS_mode returns the current FIPS mode of operation.
SYNOPSIS
#include <openssl/crypto.h>
int FIPS_mode()
DESCRIPTION
FIPS_mode() is used to determine the FIPS mode of operation of the running program.
FIPS_mode() currently returns 1 to indicate FIPS mode. Future return values might include 2
to indicate exclusive use of the NSA's Suite B algorithms.
RETURN VALUES
A return code of non-zero indicates FIPS mode, 0 indicates non-FIPS mode.
SEE ALSO
FIPS_mode_set(3)
NOTES
FIPS_mode() was formerly included with <openssl/fips/fips.h>.
HISTORY
FIPS support was introduced in version 0.9 of OpenSSL.
The FIPS_mode_set()call or other function calls in FIPS mode can return any of the following
errors:
Return Code
CRYPTO_R_FIPS_MODE_NOT_SUPPORTED
FIPS_R_CANNOT_READ_EXE
FIPS_R_CANNOT_READ_EXE_DIGEST
FIPS_R_CONTRADICTING_EVIDENCE
"contradicting evidence"
FIPS_R_EXE_DIGEST_DOES_NOT_MATCH
FIPS_R_FINGERPRINT_DOES_NOT_MATCH
FIPS_R_FINGERPRINT_DOES_NOT_MATCH_NONPIC_RELOCATED
FIPS_R_FINGERPRINT_DOES_NOT_MATCH_SEGMENT_ALIASING
FIPS_R_FIPS_MODE_ALREADY_SET
FIPS_R_INVALID_KEY_LENGTH
FIPS_R_KEY_TOO_SHORT
FIPS_R_NON_FIPS_METHOD
FIPS_R_PAIRWISE_TEST_FAILED
FIPS_R_RSA_DECRYPT_ERROR
FIPS_R_RSA_ENCRYPT_ERROR
FIPS_R_SELFTEST_FAILED
"selftest failed"
One or more of the algorithm known answer tests has failed.
FIPS_R_TEST_FAILURE
"test failure"
FIPS_R_UNSUPPORTED_PLATFORM
"unsupported platform"
Indicates the validity of the digest test is unknown for the
current platform.
Appendix E
Note: the material present in this appendix for earlier versions of this document has been removed
and relocated to http://www.openssl.com/fips/tech/.
E.1
Apple OS X Support
<TBD>
E.2
openssl1.0.1c.tar.gz
opensslfips2.0.1.tar.gz
setenvreset.sh
setenvdarwini386.sh
setenvios11.sh
iosincore2.0.1.tar.gz
fipspi.tar.gz
After acquiring the files, perform the following in the working directory to remove quarantine bit
and ensure the execute bit is set:
$xattrrd"com.apple.quarantine"*.tar.gz*.sh
$chmod+x*.sh
The Incore utility is a native application used to embed the FIPS Object Module's fingerprint in the
ARM library. Building Incore is a two step process first, build a native version of
libcrypto.a, and then build Incore using the previously built native libcrypto.a.
To compile the incore_macho utility for the native platform, perform the following steps:
$rmrfopensslfips2.0.1/
(deleteoldartifacts)
$tarxzfopensslfips2.0.1.tar.gz
$tarxzfiosincore2.0.1.tar.gz
(unpackfreshfiles)
$../setenvreset.sh
$../setenvdarwini386.sh
(notetheleadingdot".")
(notetheleadingdot".")
$cdopensslfips2.0.1/
(perform`cd`aftersetenv)
$./config
$make
(severalscreensofoutput)
(buildlibcrypto.a,lotsofoutput)
$cdiOS/
$make
(switchtoincore'ssubdirectory)
(buildincore_macho,lotsofoutput)
Note: as of this writing (January, 2013), setenvdarwini386.sh could silently fail due to
PWD dependencies. Please execute the `env` command and verify the paths placed in the
environment by the script.
Confirm the utility works:
$./incore_macho
usage:
./incore_macho[debug][exe|dso]executable
If the utility does not work, delete the opensslfips2.0.1/ directory and start over.
Once the utility has been verified on the native platform, install the incore_macho utility in a
location on path, such as /usr/local/bin. The instructions below offer a second choice, and
place incore_macho in your home directory.
$mkdir"$HOME/bin"
$cpincore_macho"$HOME/bin"
$PATH="$HOME/bin":$PATH
Finally, delete the opensslfips2.0.1/ directory in preparation for the ARM build of the
FIPS Capable library. This is done to keep cross contamination to a minimum since openssl
fips2.0.1/ is essentially reused.
$cd..
$rmrfopensslfip2.0.1/
This instructions from this point assume the build environment has been prepared, including the
creation of the incore_macho utility, as documented in the previous section, and that
incore_macho is on path.
$cdopensslfips2.0.1/
(notetheleadingdot".")
(notetheleadingdot".")
$.../setenvreset.sh
$.../setenvios11.sh
$llvmgccv
(verifyexpectedcompiler)
Usingbuiltinspecs.
Target:i686appledarwin10
Configuredwith:/private/var/tmp/llvmgcc42_Embedded/
llvmgcc42_Embedded2377~4/src/configure
...
gccversion4.2.1(BasedonAppleInc.build5658)
(LLVMbuild2377.00)
Note: as of this writing (January, 2013), setenvios11.sh could silently fail due to
PWD dependencies. Please execute the `env` command and verify the paths placed in
the environment by the script.
The output of interest from llvmgccv are (1) llvmgcc is on path; (2) gcc version 4.2.1;
and (3) the compiler is for an embedded platform.
At this point you are ready to commence the standard FIPS canister build for the target platform.
Note that fips canister is implied, so there is no need for either ./config
fipscanisterbuild or ./configfips (nor is it allowed by the Security Policy).
(severalscreensofoutput)
(lotsofoutput)
$./config
$make
After confirming the target architecture, complete the installation procedure by performing an
install:
$sudomakeinstall
Recall from Section 2.4.2 Object Module (Link Time) Integrity that applications link against
libcrypto.a, and not directly to fipscanister.o. You will build libcrypto.a and
libssl.a next in Build the FIPS Capable Library59.
There is some hand waiving here, but the details are not important at the moment for these procedures.
FIPS_mode_set(), the library will still operate as expected; but it will not be using validated
cryptography.
Recall the FIPS Object Module is governed by the FIPS 140-2 program requirements, and you
could not deviate from the Security Policy. The FIPS Capable Library does not endure the same
requirements, and you are free to modify the environment and sources within reason.
To build the FIPS Capable library, you must issue ./configfips, but other options are up to
you. Some suggested options for configure include:
Option
Comment
--openssldir
--with-fipsdir
-no-sslv2
-no-sslv3
-no-comp
-no-shared
Disable shared library output. Apple only allows static linking, and dynamic
linking is not supported on iOS.
-no-dso
Disable the OpenSSL DSO API (the library offers a shared object abstraction
layer). iOS only uses static linking.
-no-hw
-no-engines
To begin, clean old artifacts and set the environment for cross compilation.
$rmrfopenssl1.0.1c/
$tarxzfopenssl1.0.1c.tar.gz
$cdopensslfips1.0.1c/
(deleteoldartifacts)
(unpackfreshfiles)
(perform`cd`first)
(notetheleadingdot".")
(notetheleadingdot".")
$.../setenvreset.sh
$.../setenvios11.sh
60
Bruce Schneier and David Wagner, Analysis of the SSL 3.0 Protocol, www.schneier.com/paper-ssl-revised.pdf
Loren Weith, Differences Between SSLv2, SSLv3, and TLS, http://www.yaksman.org/~lweith/ssl.pdf
62
Mozilla's NSS accidentally disabled compression long before CRIME attacks due to compile/link conflicts
(https://bugzilla.mozilla.org/show_bug.cgi?id=580679). Mozilla's Firefox did not support compression on clients. Many other
browsers, such as Android (com.android.browser), did not support compression.
61
Next, configure and make the FIPS Capable library, where you pick your favorite options. No
options are also acceptable:
(severalscreensofoutput)
(lotsofoutput)
$./configfips<options>
$make<options>
After confirming the target architecture, complete the installation procedure by performing an
install:
$sudomakeinstall
You might encounter issues due to the configuration options. The issues have been cleared in the
version control system, but the tarballs maybe dated. If so, the issues and the fixes are listed below.
Recall you have latitude in changing source files because the OpenSSL FIPS Capable Library is
outside the Cryptographic Module (CM) boundary.
Issue
Remedy
makedepend:warning:cannotopen
"armv7"
makedepend:error:...
MAKEDEPPROG=$(CC)M
Undefinedsymbolsforarchitecture
armv7:"_ERR_load_COMP_strings"
After creating an Xcode project, you must add fips_premain.c to the project. Copy
fips_premain.c from its location at /usr/local/ssl/Releaseiphoneos/lib/ into
your projects working directory. Since the file is outside the Cryptographic Module (CM)
boundary, you can check it in to revision control and even modify it if desired (within reason).
Illustration 3: fips_premain.c
The Xcode Build Settings to compile an OpenSSL dependent program are discussed below. The
Build Setting should be set on the Project, and not the Target (all targets inherit from the project).
The sample project has screen captures of the relevant changes under Xcode in the top level
settings/ directory.
Build Setting
Value
Architectures
(ARCHS)
/usr/local/ssl/Release-iphoneos/include/
Build Setting
Value
Valid Architectures
(VALID_ARCHS)
/usr/local/ssl/Release-iphoneos/include/
The final modification is a Build Phase Script on the Target (not the Project) to embed the
Module's expected signature using incore_macho. The full command to embed the signature is
/usr/local/bin/incore_machoexe"$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH".
@call"c:\ProgramFiles\MicrosoftVisualStudio
9.0\VC\"vcvarsall.bat
@setOSVERSION=WCE600
@setPLATFORM=MACKEREL
@setTARGETCPU=ARMV4I
@setWCECOMPAT=C:\wcecompat
@SETMACKERELSDK=C:\ProgramFiles\WindowsCE
Tools\wce600\MackerelSDK
@setPATH=%VSINSTALLDIR%\Common7\IDE;%VCINSTALLDIR
%\ce\bin\x86_arm;%VCINSTALLDIR%\bin;%NASMINSTALLDIR%;%PATH%
@setINCLUDE=%MACKERELSDK%\Include\Armv4i;%VCINSTALLDIR
%\ce\include;%INCLUDE%
@setLIB=%MACKERELSDK%\Lib\ARMV4I;%VCINSTALLDIR
%\ce\lib\armv4i;%LIB%
@setLIBPATH=%MACKERELSDK%\Lib\ARMV4I;%VCINSTALLDIR
%\ce\lib\armv4i;%LIBPATH%
@setFIPS_SHA1_PATH=perl/opensslfips
2.0/util/fips_standalone_sha1
@setFIPS_SIG=perl/opensslfips2.0/util/msincore
On the Windows build system, invoke a DOS Command Prompt and in that shell enter the
following:
X:\>setenvwince6
X:\>cl
Microsoft(R)C/C++OptimizingCompilerVersion15.00.20720
forARM
Copyright(C)MicrosoftCorporation.Allrightsreserved.
usage:cl[option...]filename...[/linklinkoption...]
X:\>
X:\>cdopensslfips2.0
X:\opensslfips2.0>ms\do_fips
X:\opensslfips2.0>nmakefms\cedll.makbuild_algvs
In either case a "Press any key to continue . . . " prompt will be seen.
At this point the FIPS Object Module and fips_algvs utility program have been created.
General Considerations
DLLs present on CE versions prior to 6.0 take away a portion of precious 32MB address space
from all processes63. This means that unlike "normal" Windows, where DLL load address
availability is a per-process attribute, it's a per-system attribute for CE pre-6.0. In more practical
terms the determination of the load address can be dependent on the order in which processes are
started. In general the static link method is preferred on CE, unless the DLL is ROM-based, and use
of ce[dll].mak instead of nt[dll].mak.
Note that the two-step link is not necessary for Windows, as use of the msincore utility after a
conventional link is sufficient. For the runtime integrity test (fingerprint verification) to succeed a
binary module, either .exe or .dll, must be loaded at a predefined address or not contain any
relocations. As there is virtually no control over the load address for CE, fingerprint verification in
a DLL will fail. The only solution is to statically link the FIPS Object Module into an .exe
executable and not as a DLL.
The build for the formally tested Win CE 5 platform used a ROM-based DLL and some flags set in
Platform Builder. A normal DLL would not work as it ignored the load address and setting /FIXED
stopped it loading altogether.
Note the fipslink.pl utility can handle even statically linked applications.
Note that Windows and Linux cannot be compared in this context, because Linux can generate
position-independent code which means we avoid any difficulties with base addresses, relocations,
etc. For Windows a consistent load address is needed for the DLL. If that DLL isn't ROM-based
then things like the load order can result in different addresses which will result in an invalid
signature.
So one (messy) solution is to set up platform builder to get that consistent load address: as long as
it doesn't change it doesn't matter what it is. The process viewer tool can be used to check the load
address. Then once a fixed address has been established it can be used to build the FIPS capable
OpenSSL to embed the signature; this is the withbaseaddr=<address> option to
Configure.
63
CE DLLs steal memory from all processes, so if only one application needs to operate in validated mode then a
statically linked module is preferable.
Appendix F
Government restrictions and regulations on the use, acquisition, and distribution of cryptographic
products are a matter of concern for some potential users.
F.1
In the United States the current export regulations appear to more or less leave open source
software in source code format alone, except for a reporting requirement to the Bureau of Industry
and Security (BIS) of the U.S. Department of Commerce; see
http://bxa.doc.gov/Encryption/pubavailencsourcecodenofify.html.
When in doubt consultation with legal experts would be appropriate. An example of an E-mail
message sent to comply with this reporting requirement is:
To:[email protected],[email protected],[email protected]
Subject:TSUNOTIFICATION
SUBMISSIONTYPE:TSU
SUBMITTEDBY:SteveMarquess
SUBMITTEDFOR:OpenSSLSoftwareFoundation,Inc.
POINTOFCONTACT:SteveMarquess
PHONEand/orFAX:8776736775
MANUFACTURER:N/A
PRODUCTNAME/MODEL#:OpenSSL
ECCN:5D002
NOTIFICATION:http://cvs.openssl.org/dir
Employee(s),subcontractor(s),and/oragent(s)oftheOpenSSLSoftware
Foundation,Inc.(OSF)areparticipatinginthedevelopmentofthefreely
availableopensourceOpenSSLproductbyprovidingfeedbackonnew
releases,byrequestingnewfeatures,bycorrespondenceeithertothe
developerandusermailinglistsordirectlywiththeproductdevelopers,
andbysubcontractingsoftwaredevelopmentservicestooneormoreof
theOpenSSLdevelopers.Thiscorrespondencemayincludesuggested
sourcecodefragmentsorpatches.Allversionsofanysuchcontributions
incorporated,orsoftwareimplemented,inanyoftheOpenSSLsoftware
willbepubliclyaccessibleathttp://cvs.openssl.org/dir.
SteveMarquess
OpenSSLSoftwareFoundation,Inc.
1829MountEphraimRoad
Adamstown,MD21710
USA
+18776736775
marquess@
[email protected]
F.2
For software exported in binary form the situation is far less certain. As incredible and
unbelievably opposed to common sense as it seems, current U.S. export controls appear to restrict
the export from the U.S. of software products that use the OpenSSL product, even if OpensSSL is
used exclusively for all cryptographic functionality.
From what has been relayed from several vendors affected by these export restrictions, export
approval for software utilizing OpenSSL is contingent on a number of factors including the type of
linking (static build-time linking or dynamic run-time linking). Static linking is more desirable,
apparently something to do with the concept of an open cryptographic interface. Evidently a
product where the end user can easily substitute a new cryptographic library (a newer version of
OpenSSL, say) is not permissible.
Needless to say the written regulations and expert commentary are varied, so advice of legal
counsel is recommended. The only other safe course of action would be to pay non-U.S. citizens to
develop the cryptographic software overseas and import it into the U.S., as imports are not
restricted. Foreigners who benefit financially from this situation refer to the U.S. export jobs, not
crypto policy.
Links of interest:
http://www.axsmith.com/Encryption_Law.htm
http://library.findlaw.com/2000/Jan/1/128443.html
http://cryptome.org/bxa-bernstein.htm
APPENDIX G
Table 2: The operating system for platform 9 is listed as "Android 2.2". That device was the
Motorola Xoom running Android 3.0, the earliest version of Android that device shipped
with. During the period the validation was in process that version of Android on that device
was superseded by Android 4.0 which was tested as platform 39, so platform 9 is of
academic interest only (note platform essentially 9 duplicates platform 2). The error was
reported to the test lab even prior to the formal validation award, but since correction of
errors in completed validations is difficult we elected not to press the issue.
Appendix H
DTR Analysis
[TBD]
Appendix I
The API entry points in the Module are listed here, organized by source file.
FIPS 140-2 requires that logical interfaces have to be identified as one of "data input", "data
output", "control input", or "status output". Functions with multiple arguments and the C language
argument passing mechanism do not naturally match these categories, especially where pointers to
structures are used. This table designates each function as primarily serving one of the four
purposes, with the individual arguments also designated as input, output, or both.
The function names are in bold. Input arguments are highlighted in Grey and listed with a right
pointing arrow (->). Output arguments are listed with a left pointing arrow (<-). Pointer arguments
referencing structures containing both input and output data elements are listed with a double arrow
(<->). The function return value is denoted in the list of arguments as "Return".
Note that many of these Module API functions calls are rarely if ever referenced directly by
applications, instead they are referenced from the separate OpenSSL product by a noncryptographic abstraction layer such as the EVP interface (see Reference 11). Some external
symbols defined in the Module but not intended for reference by calling applications are omitted.
Also note that the API as documented below may vary slightly by platform due to the use of
assembly language optimizations.
Some general notes:
The POST code is contained in the ./fips/ subdirectory, beginning with the
FIPS_module_mode_set() function in ./fips/fips.c and leading directly functions defined in
./fips/fips_post.c.
The best way to trace each of the algorithm implementations is from the respective algorithm test
drivers, as they start with the CAVS test vector request file data and make the appropriate API calls
to perform the algorithm processing. Those are found in the ./fips/XXX/ directories, for "XXX" the
algorithm, and are also symlinked from the ./test/ subdirectory:
test/fips_aesavs.c -> ../fips/aes/fips_aesavs.c
test/fips_cmactest.c -> ../fips/cmac/fips_cmactest.c
test/fips_desmovs.c -> ../fips/des/fips_desmovs.c
test/fips_dhvs.c -> ../fips/dh/fips_dhvs.c
test/fips_drbgvs.c -> ../fips/rand/fips_drbgvs.c
test/fips_dsatest.c -> ../fips/dsa/fips_dsatest.c
test/fips_dssvs.c -> ../fips/dsa/fips_dssvs.c
test/fips_ecdhvs.c -> ../fips/ecdh/fips_ecdhvs.c
test/fips_ecdsavs.c -> ../fips/ecdsa/fips_ecdsavs.c
This utility attempts to "direction of use" for each function parameter, i.e. whether that parameter is
referenced as input, as output, or both. That determination is far from clear in some cases, as for
some types of parameters there is no clear answer -- consider for instance a pointer to a structure
containing a callback to a function that is only called as an exception. In any event that information
is stored in the file declarations.datand can be manually corrected by replacing the value
for the key 'direction' where the value contains a question mark. Those values can be changed as
appropriate, to one of:
<output
>input
<>both
and the manually changed values will be preserved in the declarations.dat file. The
api_list.pl utility has no command line options and is invoked from the root of the source
code work area:
perlfips/tools/api_list.pl><outfile>
The HTML formatted contents of the output file can be lightly edited for inclusion in documents
such as this one.
This following list shows the functions in alphabetical order by the runtime symbol name.
->
<->
<-
rem
cb
Return
->
->
<-
top
bottom
Return
*Xp1, BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, BN_CTX *ctx, BN_GENCB
*cb)
<-> p
<-> p1
<-> p2
<-> Xp1
<-> Xp2
->
Xp
->
e
<ctx
<-> cb
<Return
FIPS_bn_x931_generate_xpq (renames BN_X931_generate_Xpq) in file ./crypto/bn/bn_x931p.[o|
c]
int FIPS_bn_x931_generate_xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx)
<-> Xp
<-> Xq
->
nbits
<ctx
<Return
FIPS_check_incore_fingerprint in file ./fips/fips.[o|c]
int FIPS_check_incore_fingerprint()
<Return
FIPS_cipher (reimplements EVP_Cipher) in file ./fips/utl/fips_enc.[o|c]
__owur int FIPS_cipher(EVP_CIPHER_CTX *c, unsigned char *out, const unsigned char *in,
unsigned int inl)
<c
<out
->
in
->
inl
<Return
<->
->
<-
ctx
data
dlen
Return
<->
<-
threadid_func
Return
->
<-
flags
Return
<->
<-
a
Return
<->
<<->
<-
dsa
ctx
s
Return
->
<-
nid
Return
<<-
ctx
Return
FIPS_ec_point_get_jprojective_coordinates_gfp (renames
EC_POINT_get_Jprojective_coordinates_GFp) in file ./crypto/ec/ec_lib.[o|c]
int FIPS_ec_point_get_jprojective_coordinates_gfp(const EC_GROUP *group, const
EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx)
->
group
->
p
<-> x
<-> y
<-> z
<ctx
<Return
FIPS_ec_point_is_at_infinity (renames EC_POINT_is_at_infinity) in file ./crypto/ec/ec_lib.[o|c]
int FIPS_ec_point_is_at_infinity(const EC_GROUP *group, const EC_POINT *p)
->
group
->
p
<Return
FIPS_ec_point_is_on_curve (renames EC_POINT_is_on_curve) in file ./crypto/ec/ec_lib.[o|c]
int FIPS_ec_point_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX
*ctx)
->
group
->
point
<ctx
<Return
FIPS_ec_point_make_affine (renames EC_POINT_make_affine) in file ./crypto/ec/ec_lib.[o|c]
int FIPS_ec_point_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
->
group
<-> point
<ctx
<Return
<->
<<-
points
ctx
Return
ECDSA_SIG * FIPS_ecdsa_sign(EC_KEY *key, const unsigned char *msg, size_t msglen, const
EVP_MD *mhash)
<-> key
->
msg
->
msglen
->
mhash
<Return
FIPS_ecdsa_sign_ctx in file ./fips/ecdsa/fips_ecdsa_sign.[o|c]
ECDSA_SIG * FIPS_ecdsa_sign_ctx(EC_KEY *key, EVP_MD_CTX *ctx)
<-> key
<ctx
<Return
FIPS_ecdsa_sign_digest in file ./crypto/ecdsa/ecs_ossl.[o|c]
ECDSA_SIG * FIPS_ecdsa_sign_digest(EC_KEY *key, const unsigned char *dig, int dlen)
<-> key
->
dig
->
dlen
<Return
FIPS_ecdsa_verify in file ./fips/ecdsa/fips_ecdsa_sign.[o|c]
int FIPS_ecdsa_verify(EC_KEY *key, const unsigned char *msg, size_t msglen, const EVP_MD
*mhash, ECDSA_SIG *s)
<-> key
->
msg
->
msglen
->
mhash
<-> s
<Return
FIPS_ecdsa_verify_ctx in file ./fips/ecdsa/fips_ecdsa_sign.[o|c]
int FIPS_ecdsa_verify_ctx(EC_KEY *key, EVP_MD_CTX *ctx, ECDSA_SIG *s)
<-> key
<ctx
<->
<-
s
Return
->
->
num
entropy
->
<-
meth
Return
->
<-
padding
Return
->
->
<-
key
keylen
Return