2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#!/bin/bash
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# fips-check.sh
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# This script checks the current revision of the code against the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# previous release of the FIPS code. While wolfSSL and wolfCrypt
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# may be advancing, they must work correctly with the last tested
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# copy of our FIPS approved code.
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# This should check out all the approved versions. The command line
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# option selects the version.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-16 11:10:12 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#     $ ./fips-check [version] [keep]
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#     - version: linux (default), ios, android, windows, freertos, linux-ecc, netbsd-selftest, linuxv2
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-16 11:10:12 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#     - keep: (default off) XXX-fips-test temp dir around for inspection
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Usage() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    cat <<usageText
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Usage: $0 [platform [keep]]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Platform is one of:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    linux (default)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ios
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    android
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    windows
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    freertos
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    openrtos-3.9.2
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    linux-ecc
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    netbsd-selftest
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    sgx
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    netos-7.6
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-11 15:19:38 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    linuxv2 (FIPSv2, use for Win10)
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Keep (default off) retains the XXX-fips-test temp dir for inspection.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Example:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    $0 windows keep
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								usageText
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								LINUX_FIPS_VERSION=v3.2.6
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								LINUX_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								LINUX_CRYPT_VERSION=v3.2.6
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								LINUX_CRYPT_REPO=git@github.com:cyassl/cyassl.git
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-17 14:49:18 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								LINUX_ECC_FIPS_VERSION=v3.10.3
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								LINUX_ECC_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								LINUX_ECC_CRYPT_VERSION=v3.2.6
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								LINUX_ECC_CRYPT_REPO=git@github.com:cyassl/cyassl.git
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								LINUXV2_FIPS_VERSION=WCv4-stable
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								LINUXV2_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								LINUXV2_CRYPT_VERSION=WCv4-stable
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-17 14:49:18 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								IOS_FIPS_VERSION=v3.4.8a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								IOS_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								IOS_CRYPT_VERSION=v3.4.8.fips
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								IOS_CRYPT_REPO=git@github.com:cyassl/cyassl.git
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ANDROID_FIPS_VERSION=v3.5.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ANDROID_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								ANDROID_CRYPT_VERSION=v3.5.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ANDROID_CRYPT_REPO=git@github.com:cyassl/cyassl.git
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-01 17:57:37 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								WINDOWS_FIPS_VERSION=v3.6.6
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								WINDOWS_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								WINDOWS_CRYPT_VERSION=v3.6.6
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WINDOWS_CRYPT_REPO=git@github.com:cyassl/cyassl.git
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-03 14:05:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								FREERTOS_FIPS_VERSION=v3.6.1-FreeRTOS
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								FREERTOS_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								FREERTOS_CRYPT_VERSION=v3.6.1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								FREERTOS_CRYPT_REPO=git@github.com:cyassl/cyassl.git
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-03 14:05:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-30 15:32:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								OPENRTOS_3_9_2_FIPS_VERSION=v3.9.2-OpenRTOS
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								OPENRTOS_3_9_2_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								OPENRTOS_3_9_2_CRYPT_VERSION=v3.6.1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								OPENRTOS_3_9_2_CRYPT_REPO=git@github.com:cyassl/cyassl.git
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-30 15:32:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 15:34:30 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#NOTE: Does not include the SGX examples yet, update version once fipsv2 is
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#      finished and merge conflicts can be resolved. This will be tagged as
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#      v3.12.4.sgx-examples
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-30 12:46:59 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#SGX_FIPS_VERSION=v3.12.4.sgx-examples
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 15:34:30 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								SGX_FIPS_VERSION=v3.6.6
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-30 12:46:59 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								SGX_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								SGX_CRYPT_VERSION=v3.12.4
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								SGX_CRYPT_REPO=git@github.com:cyassl/cyassl.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 15:34:30 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-30 12:46:59 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								NETOS_7_6_FIPS_VERSION=v3.12.6
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								NETOS_7_6_FIPS_REPO=git@github.com:wolfSSL/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								NETOS_7_6_CRYPT_VERSION=v3.12.4
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								NETOS_7_6_CRYPT_REPO=git@github.com:cyassl/cyassl.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# non-FIPS, CAVP only but pull in selftest
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# will reset above variables below in platform switch
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-26 14:37:39 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								NETBSD_FIPS_VERSION=v3.14.2a
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								NETBSD_FIPS_REPO=git@github.com:wolfssl/fips.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								NETBSD_CRYPT_VERSION=v3.14.2
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								NETBSD_CRYPT_REPO=git@github.com:wolfssl/wolfssl.git
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								FIPS_SRCS=( fips.c fips_test.c )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								WC_MODS=( aes des3 sha sha256 sha512 rsa hmac random )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								TEST_DIR=XXX-fips-test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CRYPT_INC_PATH=cyassl/ctaocrypt
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CRYPT_SRC_PATH=ctaocrypt/src
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								FIPS_OPTION=v1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CAVP_SELFTEST_ONLY="no"
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								GIT="git -c advice.detachedHead=false"
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [ "x$1" == "x" ]; then PLATFORM="linux"; else PLATFORM=$1; fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-16 11:10:12 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [ "x$2" == "xkeep" ]; then KEEP="yes"; else KEEP="no"; fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								case $PLATFORM in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ios)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$IOS_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$IOS_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$IOS_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$IOS_CRYPT_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								android)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$ANDROID_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$ANDROID_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$ANDROID_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$ANDROID_CRYPT_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								windows)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$WINDOWS_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$WINDOWS_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$WINDOWS_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$WINDOWS_CRYPT_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-03 14:05:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								freertos)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$FREERTOS_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$FREERTOS_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$FREERTOS_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$FREERTOS_CRYPT_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-03 14:05:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-30 15:32:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								openrtos-3.9.2)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$OPENRTOS_3_9_2_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$OPENRTOS_3_9_2_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$OPENRTOS_3_9_2_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$OPENRTOS_3_9_2_CRYPT_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-30 15:32:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  FIPS_CONFLICTS=( aes hmac random sha256 )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								linux)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$LINUX_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$LINUX_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$LINUX_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$LINUX_CRYPT_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-17 14:49:18 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								linux-ecc)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$LINUX_ECC_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$LINUX_ECC_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$LINUX_ECC_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$LINUX_ECC_CRYPT_REPO
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								linuxv2)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$LINUXV2_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$LINUXV2_FIPS_REPO
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$LINUXV2_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_INC_PATH=wolfssl/wolfcrypt
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_SRC_PATH=wolfcrypt/src
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-19 10:02:14 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  WC_MODS+=( cmac dh ecc )
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  FIPS_SRCS+=( wolfcrypt_first.c wolfcrypt_last.c )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_INCS=( fips.h )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_OPTION=v2
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-17 14:49:18 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								netbsd-selftest)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$NETBSD_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$NETBSD_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$NETBSD_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$NETBSD_CRYPT_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  FIPS_SRCS=( selftest.c )
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  WC_MODS=( dh ecc rsa dsa aes sha sha256 sha512 hmac random )
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_INC_PATH=wolfssl/wolfcrypt
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_SRC_PATH=wolfcrypt/src
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CAVP_SELFTEST_ONLY="yes"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 15:34:30 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								sgx)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$SGX_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$SGX_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$SGX_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$SGX_CRYPT_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 15:34:30 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								netos-7.6)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_VERSION=$NETOS_7_6_FIPS_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  FIPS_REPO=$NETOS_7_6_FIPS_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  CRYPT_VERSION=$NETOS_7_6_CRYPT_VERSION
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  CRYPT_REPO=$NETOS_7_6_CRYPT_REPO
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-16 15:34:30 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ;;
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								*)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  Usage
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								esac
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if ! $GIT clone . $TEST_DIR; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "fips-check: Couldn't duplicate current working directory."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								pushd $TEST_DIR || exit 2
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [ "x$FIPS_OPTION" == "xv1" ];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # make a clone of the last FIPS release tag
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if ! $GIT clone -b $CRYPT_VERSION $CRYPT_REPO old-tree; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        echo "fips-check: Couldn't checkout the FIPS release."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    for MOD in "${WC_MODS[@]}"
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    do
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        cp "old-tree/$CRYPT_SRC_PATH/${MOD}.c" $CRYPT_SRC_PATH
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cp "old-tree/$CRYPT_INC_PATH/${MOD}.h" $CRYPT_INC_PATH
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    done
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # The following is temporary. We are using random.c from a separate release
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # This is forcefully overwriting any other checkout of the cyassl sources.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    # Removing this as default behavior for SGX and netos projects.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if [ "x$CAVP_SELFTEST_ONLY" == "xno" ] && [ "x$PLATFORM" != "xsgx" ] && \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       [ "x$PLATFORM" != "xnetos-7.6" ];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    then
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        pushd old-tree || exit 2
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        $GIT checkout v3.6.0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        popd || exit 2
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cp "old-tree/$CRYPT_SRC_PATH/random.c" $CRYPT_SRC_PATH
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        cp "old-tree/$CRYPT_INC_PATH/random.h" $CRYPT_INC_PATH
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								else
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    $GIT branch --no-track "my$CRYPT_VERSION" $CRYPT_VERSION
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # Checkout the fips versions of the wolfCrypt files from the repo.
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    for MOD in "${WC_MODS[@]}"
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    do
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        $GIT checkout "my$CRYPT_VERSION" -- "$CRYPT_SRC_PATH/$MOD.c" "$CRYPT_INC_PATH/$MOD.h"
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    done
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-30 14:57:29 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-19 22:21:27 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# clone the FIPS repository
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if ! $GIT clone -b $FIPS_VERSION $FIPS_REPO fips; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "fips-check: Couldn't checkout the FIPS repository."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit 1
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								for SRC in "${FIPS_SRCS[@]}"
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								do
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    cp "fips/$SRC" $CRYPT_SRC_PATH
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								done
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								for INC in "${FIPS_INCS[@]}"
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								do
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    cp "fips/$INC" $CRYPT_INC_PATH
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								done
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# run the make test
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								./autogen.sh
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [ "x$CAVP_SELFTEST_ONLY" == "xyes" ];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ./configure --enable-selftest
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								else
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ./configure --enable-fips=$FIPS_OPTION
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if ! make; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "fips-check: Make failed. Debris left for analysis."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit 3
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [ "x$CAVP_SELFTEST_ONLY" == "xno" ];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								then
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if [ -n "$NEWHASH" ]; then
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-01 11:02:35 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        sed -i.bak "s/^\".*\";/\"${NEWHASH}\";/" $CRYPT_SRC_PATH/fips_test.c
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-22 16:17:08 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        make clean
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    fi
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-24 12:50:55 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if ! make test; then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "fips-check: Test failed. Debris left for analysis."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    exit 3
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-30 15:32:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [ ${#FIPS_CONFLICTS[@]} -ne 0 ];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "Due to the way this package is compiled by the customer duplicate"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "source file names are an issue, renaming:"
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    for FNAME in "${FIPS_CONFLICTS[@]}"
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-30 15:32:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    do
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        echo "wolfcrypt/src/$FNAME.c to wolfcrypt/src/wc_$FNAME.c"
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        mv "./wolfcrypt/src/$FNAME.c" "./wolfcrypt/src/wc_$FNAME.c"
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-30 15:32:59 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    done
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    echo "Confirming files were renamed..."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ls -la ./wolfcrypt/src/wc_*.c
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-19 12:00:04 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Clean up
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-08 10:36:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								popd || exit 2
							 | 
						
					
						
							
								
									
										
										
										
											2017-03-16 11:10:12 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [ "x$KEEP" == "xno" ];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    rm -rf $TEST_DIR
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								fi
							 |