xref: /dpdk/doc/guides/sample_app_ug/fips_validation.rst (revision b455d261eb89951733c24cf75467b30441c232df)
13d0fad56SMarko Kovacevic..  SPDX-License-Identifier: BSD-3-Clause
23d0fad56SMarko Kovacevic    Copyright(c) 2018 Intel Corporation.
33d0fad56SMarko Kovacevic
43d0fad56SMarko KovacevicFederal Information Processing Standards (FIPS) CryptoDev Validation
53d0fad56SMarko Kovacevic====================================================================
63d0fad56SMarko Kovacevic
73d0fad56SMarko KovacevicOverview
83d0fad56SMarko Kovacevic--------
93d0fad56SMarko Kovacevic
103d0fad56SMarko KovacevicFederal Information Processing Standards (FIPS) are publicly announced standards
113d0fad56SMarko Kovacevicdeveloped by the United States federal government for use in computer systems by
123d0fad56SMarko Kovacevicnon-military government agencies and government contractors.
133d0fad56SMarko Kovacevic
143d0fad56SMarko KovacevicThis application is used to parse and perform symmetric cryptography
150a2a3c01SGowrishankar Muthukrishnancomputation to the NIST Cryptographic Algorithm Validation Program (CAVP) and
160a2a3c01SGowrishankar MuthukrishnanAutomated Crypto Validation Protocol (ACVP) test vectors.
173d0fad56SMarko Kovacevic
183d0fad56SMarko KovacevicFor an algorithm implementation to be listed on a cryptographic module
193d0fad56SMarko Kovacevicvalidation certificate as an Approved security function, the algorithm
200a2a3c01SGowrishankar Muthukrishnanimplementation must meet all the requirements of FIPS 140-2 (in case of CAVP)
210a2a3c01SGowrishankar Muthukrishnanand FIPS 140-3 (in case of ACVP) and must successfully complete the
220a2a3c01SGowrishankar Muthukrishnancryptographic algorithm validation process.
233d0fad56SMarko Kovacevic
243d0fad56SMarko KovacevicLimitations
253d0fad56SMarko Kovacevic-----------
263d0fad56SMarko Kovacevic
270a2a3c01SGowrishankar MuthukrishnanCAVP
280a2a3c01SGowrishankar Muthukrishnan----
290a2a3c01SGowrishankar Muthukrishnan
300a2a3c01SGowrishankar Muthukrishnan* The version of request file supported is ``CAVS 21.0``.
313d0fad56SMarko Kovacevic* If the header comment in a ``.req`` file does not contain a Algo tag
323d0fad56SMarko Kovacevic  i.e ``AES,TDES,GCM`` you need to manually add it into the header comment for
333d0fad56SMarko Kovacevic  example::
343d0fad56SMarko Kovacevic
353d0fad56SMarko Kovacevic      # VARIABLE KEY - KAT for CBC / # TDES VARIABLE KEY - KAT for CBC
363d0fad56SMarko Kovacevic
373d0fad56SMarko Kovacevic* The application does not supply the test vectors. The user is expected to
380a2a3c01SGowrishankar Muthukrishnan  obtain the test vector files from `CAVP
393d0fad56SMarko Kovacevic  <https://csrc.nist.gov/projects/cryptographic-algorithm-validation-
403d0fad56SMarko Kovacevic  program/block-ciphers>`_ website. To obtain the ``.req`` files you need to
413d0fad56SMarko Kovacevic  email a person from the NIST website and pay for the ``.req`` files.
423d0fad56SMarko Kovacevic  The ``.rsp`` files from the site can be used to validate and compare with
433d0fad56SMarko Kovacevic  the ``.rsp`` files created by the FIPS application.
443d0fad56SMarko Kovacevic
453d0fad56SMarko Kovacevic* Supported test vectors
46cd255ccfSMarko Kovacevic    * AES-CBC (128,192,256) - GFSbox, KeySbox, MCT, MMT
474aaad299SMarko Kovacevic    * AES-GCM (128,192,256) - EncryptExtIV, Decrypt
48305921f4SMarko Kovacevic    * AES-CCM (128) - VADT, VNT, VPT, VTT, DVPT
49ac026f46SMarko Kovacevic    * AES-CMAC (128) - Generate, Verify
50f64adb67SMarko Kovacevic    * HMAC (SHA1, SHA224, SHA256, SHA384, SHA512)
51527cbf3dSMarko Kovacevic    * TDES-CBC (1 Key, 2 Keys, 3 Keys) - MMT, Monte, Permop, Subkey, Varkey,
52527cbf3dSMarko Kovacevic      VarText
533d0fad56SMarko Kovacevic
540a2a3c01SGowrishankar MuthukrishnanACVP
550a2a3c01SGowrishankar Muthukrishnan----
560a2a3c01SGowrishankar Muthukrishnan
570a2a3c01SGowrishankar Muthukrishnan* The application does not supply the test vectors. The user is expected to
580a2a3c01SGowrishankar Muthukrishnan  obtain the test vector files from `ACVP  <https://pages.nist.gov/ACVP>`_
590a2a3c01SGowrishankar Muthukrishnan  website.
600a2a3c01SGowrishankar Muthukrishnan* Supported test vectors
610a2a3c01SGowrishankar Muthukrishnan    * AES-CBC (128,192,256) - AFT, MCT
620a2a3c01SGowrishankar Muthukrishnan    * AES-GCM (128,192,256) - AFT
630a2a3c01SGowrishankar Muthukrishnan    * AES-CMAC (128,192,256) - AFT
64c8956fd2SBrian Dooley    * AES-CTR (128,192,256) - AFT, CTR
65e27268bdSBrian Dooley    * AES-GMAC (128,192,256) - AFT
66f8e431edSGowrishankar Muthukrishnan    * AES-XTS (128,256) - AFT
670a2a3c01SGowrishankar Muthukrishnan    * HMAC (SHA1, SHA224, SHA256, SHA384, SHA512)
68d5c24714SGowrishankar Muthukrishnan    * SHA (1, 256, 384, 512) - AFT, MCT
6964569ffaSGowrishankar Muthukrishnan    * TDES-CBC - AFT, MCT
7064569ffaSGowrishankar Muthukrishnan    * TDES-ECB - AFT, MCT
7136128a67SGowrishankar Muthukrishnan    * RSA
72*b455d261SGowrishankar Muthukrishnan    * ECDSA
730a2a3c01SGowrishankar Muthukrishnan
740a2a3c01SGowrishankar Muthukrishnan
753d0fad56SMarko KovacevicApplication Information
763d0fad56SMarko Kovacevic-----------------------
773d0fad56SMarko Kovacevic
783d0fad56SMarko KovacevicIf a ``.req`` is used as the input file after the application is finished
793d0fad56SMarko Kovacevicrunning it will generate a response file or ``.rsp``. Differences between the
803d0fad56SMarko Kovacevictwo files are, the ``.req`` file has missing information for instance if doing
813d0fad56SMarko Kovacevicencryption you will not have the cipher text and that will be generated in the
823d0fad56SMarko Kovacevicresponse file. Also if doing decryption it will not have the plain text until it
833d0fad56SMarko Kovacevicfinished the work and in the response file it will be added onto the end of each
843d0fad56SMarko Kovacevicoperation.
853d0fad56SMarko Kovacevic
863d0fad56SMarko KovacevicThe application can be run with a ``.rsp`` file and what the outcome of that
873d0fad56SMarko Kovacevicwill be is it will add a extra line in the generated ``.rsp`` which should be
883d0fad56SMarko Kovacevicthe same as the ``.rsp`` used to run the application, this is useful for
893d0fad56SMarko Kovacevicvalidating if the application has done the operation correctly.
903d0fad56SMarko Kovacevic
913d0fad56SMarko Kovacevic
923d0fad56SMarko KovacevicCompiling the Application
933d0fad56SMarko Kovacevic-------------------------
943d0fad56SMarko Kovacevic
953d0fad56SMarko Kovacevic* Compile Application
963d0fad56SMarko Kovacevic
97e2a94f9aSCiara Power    To compile the sample application see :doc:`compiling`.
983d0fad56SMarko Kovacevic
993d0fad56SMarko Kovacevic*  Run ``dos2unix`` on the request files
1003d0fad56SMarko Kovacevic
1013d0fad56SMarko Kovacevic    .. code-block:: console
1023d0fad56SMarko Kovacevic
1033d0fad56SMarko Kovacevic         dos2unix AES/req/*
1041998071cSJakub Poczatek         dos2unix GCM/req/*
1053d0fad56SMarko Kovacevic         dos2unix CCM/req/*
1063d0fad56SMarko Kovacevic         dos2unix CMAC/req/*
1073d0fad56SMarko Kovacevic         dos2unix HMAC/req/*
1083d0fad56SMarko Kovacevic         dos2unix TDES/req/*
1091998071cSJakub Poczatek         dos2unix SHA/req/*
1103d0fad56SMarko Kovacevic
1113d0fad56SMarko KovacevicRunning the Application
1123d0fad56SMarko Kovacevic-----------------------
1133d0fad56SMarko Kovacevic
1143d0fad56SMarko KovacevicThe application requires a number of command line options:
1153d0fad56SMarko Kovacevic
1163d0fad56SMarko Kovacevic    .. code-block:: console
1173d0fad56SMarko Kovacevic
118e2a94f9aSCiara Power         ./dpdk-fips_validation [EAL options]
1193d0fad56SMarko Kovacevic         -- --req-file FILE_PATH/FOLDER_PATH
1203d0fad56SMarko Kovacevic         --rsp-file FILE_PATH/FOLDER_PATH
1213d0fad56SMarko Kovacevic         [--cryptodev DEVICE_NAME] [--cryptodev-id ID] [--path-is-folder]
122952e10cdSFan Zhang         --mbuf-dataroom DATAROOM_SIZE
1233d0fad56SMarko Kovacevic
1243d0fad56SMarko Kovacevicwhere,
1253d0fad56SMarko Kovacevic  * req-file: The path of the request file or folder, separated by
1263d0fad56SMarko Kovacevic    ``path-is-folder`` option.
1273d0fad56SMarko Kovacevic
1283d0fad56SMarko Kovacevic  * rsp-file: The path that the response file or folder is stored. separated by
1293d0fad56SMarko Kovacevic    ``path-is-folder`` option.
1303d0fad56SMarko Kovacevic
1313d0fad56SMarko Kovacevic  * cryptodev: The name of the target DPDK Crypto device to be validated.
1323d0fad56SMarko Kovacevic
1333d0fad56SMarko Kovacevic  * cryptodev-id: The id of the target DPDK Crypto device to be validated.
1343d0fad56SMarko Kovacevic
1353d0fad56SMarko Kovacevic  * path-is-folder: If presented the application expects req-file and rsp-file
1363d0fad56SMarko Kovacevic    are folder paths.
1373d0fad56SMarko Kovacevic
138952e10cdSFan Zhang  * mbuf-dataroom: By default the application creates mbuf pool with maximum
139952e10cdSFan Zhang    possible data room (65535 bytes). If the user wants to test scatter-gather
140952e10cdSFan Zhang    list feature of the PMD he or she may set this value to reduce the dataroom
1419c30a6f3SHenry Nadeau    size so that the input data may be divided into multiple chained mbufs.
142952e10cdSFan Zhang
1433d0fad56SMarko Kovacevic
144218c4e68SBruce RichardsonTo run the application in linux environment to test one AES FIPS test data
1453d0fad56SMarko Kovacevicfile for crypto_aesni_mb PMD, issue the command:
1463d0fad56SMarko Kovacevic
1473d0fad56SMarko Kovacevic.. code-block:: console
1483d0fad56SMarko Kovacevic
149e2a94f9aSCiara Power    $ ./dpdk-fips_validation --vdev crypto_aesni_mb --
1503d0fad56SMarko Kovacevic    --req-file /PATH/TO/REQUEST/FILE.req --rsp-file ./PATH/TO/RESPONSE/FILE.rsp
1513d0fad56SMarko Kovacevic    --cryptodev crypto_aesni_mb
1523d0fad56SMarko Kovacevic
153218c4e68SBruce RichardsonTo run the application in linux environment to test all AES-GCM FIPS test
1543d0fad56SMarko Kovacevicdata files in one folder for crypto_aesni_gcm PMD, issue the command:
1553d0fad56SMarko Kovacevic
1563d0fad56SMarko Kovacevic.. code-block:: console
1573d0fad56SMarko Kovacevic
158e2a94f9aSCiara Power    $ ./dpdk-fips_validation --vdev crypto_aesni_gcm0 --
1593d0fad56SMarko Kovacevic    --req-file /PATH/TO/REQUEST/FILE/FOLDER/
1603d0fad56SMarko Kovacevic    --rsp-file ./PATH/TO/RESPONSE/FILE/FOLDER/
1613d0fad56SMarko Kovacevic    --cryptodev-id 0 --path-is-folder
162