fips-check.sh 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. #!/bin/bash
  2. # fips-check.sh
  3. # This script checks the current revision of the code against the
  4. # previous release of the FIPS code. While wolfSSL and wolfCrypt
  5. # may be advancing, they must work correctly with the last tested
  6. # copy of our FIPS approved code.
  7. #
  8. # This should check out all the approved versions. The command line
  9. # option selects the version.
  10. #
  11. # $ ./fips-check [version] [keep]
  12. #
  13. # - version: linux (default), ios, android, windows, freertos, linux-ecc, netbsd-selftest, linuxv2, fips-ready, stm32l4-v2
  14. #
  15. # - keep: (default off) XXX-fips-test temp dir around for inspection
  16. #
  17. Usage() {
  18. cat <<usageText
  19. Usage: $0 [platform [keep]]
  20. Platform is one of:
  21. linux (default)
  22. ios
  23. android
  24. windows
  25. freertos
  26. openrtos-3.9.2
  27. linux-ecc
  28. netbsd-selftest
  29. marvell-linux-selftest
  30. sgx
  31. netos-7.6
  32. linuxv2 (FIPSv2, use for Win10)
  33. fips-ready
  34. stm32l4-v2 (FIPSv2, use for STM32L4)
  35. wolfrand
  36. solaris
  37. linuxv5-RC8 (old FIPS 140-3)
  38. linuxv5 (current FIPS 140-3)
  39. linuxv5-ready (ready FIPS 140-3)
  40. linuxv5-RC10
  41. Keep (default off) retains the XXX-fips-test temp dir for inspection.
  42. Example:
  43. $0 windows keep
  44. usageText
  45. }
  46. MAKE=make
  47. LINUX_FIPS_VERSION=v3.2.6
  48. LINUX_FIPS_REPO=git@github.com:wolfSSL/fips.git
  49. LINUX_CRYPT_VERSION=v3.2.6
  50. LINUX_CRYPT_REPO=git@github.com:cyassl/cyassl.git
  51. LINUX_ECC_FIPS_VERSION=v3.10.3
  52. LINUX_ECC_FIPS_REPO=git@github.com:wolfSSL/fips.git
  53. LINUX_ECC_CRYPT_VERSION=v3.2.6
  54. LINUX_ECC_CRYPT_REPO=git@github.com:cyassl/cyassl.git
  55. IOS_FIPS_VERSION=v3.4.8a
  56. IOS_FIPS_REPO=git@github.com:wolfSSL/fips.git
  57. IOS_CRYPT_VERSION=v3.4.8.fips
  58. IOS_CRYPT_REPO=git@github.com:cyassl/cyassl.git
  59. ANDROID_FIPS_VERSION=v3.5.0
  60. ANDROID_FIPS_REPO=git@github.com:wolfSSL/fips.git
  61. ANDROID_CRYPT_VERSION=v3.5.0
  62. ANDROID_CRYPT_REPO=git@github.com:cyassl/cyassl.git
  63. WINDOWS_FIPS_VERSION=v3.6.6
  64. WINDOWS_FIPS_REPO=git@github.com:wolfSSL/fips.git
  65. WINDOWS_CRYPT_VERSION=v3.6.6
  66. WINDOWS_CRYPT_REPO=git@github.com:cyassl/cyassl.git
  67. FREERTOS_FIPS_VERSION=v3.6.1-FreeRTOS
  68. FREERTOS_FIPS_REPO=git@github.com:wolfSSL/fips.git
  69. FREERTOS_CRYPT_VERSION=v3.6.1
  70. FREERTOS_CRYPT_REPO=git@github.com:cyassl/cyassl.git
  71. OPENRTOS_3_9_2_FIPS_VERSION=v3.9.2-OpenRTOS
  72. OPENRTOS_3_9_2_FIPS_REPO=git@github.com:wolfSSL/fips.git
  73. OPENRTOS_3_9_2_CRYPT_VERSION=v3.6.1
  74. OPENRTOS_3_9_2_CRYPT_REPO=git@github.com:cyassl/cyassl.git
  75. #NOTE: Does not include the SGX examples yet, update version once fipsv2 is
  76. # finished and merge conflicts can be resolved. This will be tagged as
  77. # v3.12.4.sgx-examples
  78. #SGX_FIPS_VERSION=v3.12.4.sgx-examples
  79. SGX_FIPS_VERSION=v3.6.6
  80. SGX_FIPS_REPO=git@github.com:wolfSSL/fips.git
  81. SGX_CRYPT_VERSION=v3.12.4
  82. SGX_CRYPT_REPO=git@github.com:cyassl/cyassl.git
  83. NETOS_7_6_FIPS_VERSION=v3.12.6
  84. NETOS_7_6_FIPS_REPO=git@github.com:wolfSSL/fips.git
  85. NETOS_7_6_CRYPT_VERSION=v3.12.4
  86. NETOS_7_6_CRYPT_REPO=git@github.com:cyassl/cyassl.git
  87. # non-FIPS, CAVP only but pull in selftest
  88. # will reset above variables below in platform switch
  89. NETBSD_FIPS_VERSION=v3.14.2b
  90. NETBSD_FIPS_REPO=git@github.com:wolfssl/fips.git
  91. NETBSD_CRYPT_VERSION=v3.14.2
  92. NETBSD_CRYPT_REPO=git@github.com:wolfssl/wolfssl.git
  93. # non-FIPS, CAVP only but pull in selftest
  94. # will reset above variables below in platform switch
  95. MARVELL_LINUX_FIPS_VERSION=v3.14.2b
  96. MARVELL_LINUX_FIPS_REPO=git@github.com:wolfssl/fips.git
  97. MARVELL_LINUX_CRYPT_VERSION=v4.1.0-stable
  98. MARVELL_LINUX_CRYPT_REPO=git@github.com:wolfssl/wolfssl.git
  99. STM32L4_V2_FIPS_VERSION=WCv4.0.1-stable
  100. STM32L4_V2_FIPS_REPO=git@github.com:wolfSSL/fips.git
  101. STM32L4_V2_CRYPT_VERSION=WCv4.0.1-stable
  102. FIPS_SRCS=( fips.c fips_test.c )
  103. WC_MODS=( aes des3 sha sha256 sha512 rsa hmac random )
  104. TEST_DIR=XXX-fips-test
  105. CRYPT_INC_PATH=cyassl/ctaocrypt
  106. CRYPT_SRC_PATH=ctaocrypt/src
  107. RNG_VERSION=v3.6.0
  108. FIPS_OPTION=v1
  109. CAVP_SELFTEST_ONLY="no"
  110. GIT="git -c advice.detachedHead=false"
  111. if [ "x$1" == "x" ]; then PLATFORM="linux"; else PLATFORM=$1; fi
  112. if [ "x$2" == "xkeep" ]; then KEEP="yes"; else KEEP="no"; fi
  113. case $PLATFORM in
  114. ios)
  115. FIPS_VERSION=$IOS_FIPS_VERSION
  116. FIPS_REPO=$IOS_FIPS_REPO
  117. CRYPT_VERSION=$IOS_CRYPT_VERSION
  118. CRYPT_REPO=$IOS_CRYPT_REPO
  119. ;;
  120. android)
  121. FIPS_VERSION=$ANDROID_FIPS_VERSION
  122. FIPS_REPO=$ANDROID_FIPS_REPO
  123. CRYPT_VERSION=$ANDROID_CRYPT_VERSION
  124. CRYPT_REPO=$ANDROID_CRYPT_REPO
  125. ;;
  126. windows)
  127. FIPS_VERSION=$WINDOWS_FIPS_VERSION
  128. FIPS_REPO=$WINDOWS_FIPS_REPO
  129. CRYPT_VERSION=$WINDOWS_CRYPT_VERSION
  130. CRYPT_REPO=$WINDOWS_CRYPT_REPO
  131. ;;
  132. freertos)
  133. FIPS_VERSION=$FREERTOS_FIPS_VERSION
  134. FIPS_REPO=$FREERTOS_FIPS_REPO
  135. CRYPT_VERSION=$FREERTOS_CRYPT_VERSION
  136. CRYPT_REPO=$FREERTOS_CRYPT_REPO
  137. ;;
  138. openrtos-3.9.2)
  139. FIPS_VERSION=$OPENRTOS_3_9_2_FIPS_VERSION
  140. FIPS_REPO=$OPENRTOS_3_9_2_FIPS_REPO
  141. CRYPT_VERSION=$OPENRTOS_3_9_2_CRYPT_VERSION
  142. CRYPT_REPO=$OPENRTOS_3_9_2_CRYPT_REPO
  143. FIPS_CONFLICTS=( aes hmac random sha256 )
  144. ;;
  145. linux)
  146. FIPS_VERSION=$LINUX_FIPS_VERSION
  147. FIPS_REPO=$LINUX_FIPS_REPO
  148. CRYPT_VERSION=$LINUX_CRYPT_VERSION
  149. CRYPT_REPO=$LINUX_CRYPT_REPO
  150. ;;
  151. linux-ecc)
  152. FIPS_VERSION=$LINUX_ECC_FIPS_VERSION
  153. FIPS_REPO=$LINUX_ECC_FIPS_REPO
  154. CRYPT_VERSION=$LINUX_ECC_CRYPT_VERSION
  155. CRYPT_REPO=$LINUX_ECC_CRYPT_REPO
  156. ;;
  157. linuxv2)
  158. FIPS_VERSION=WCv4-stable
  159. FIPS_REPO=git@github.com:wolfssl/fips.git
  160. CRYPT_VERSION=WCv4-stable
  161. CRYPT_INC_PATH=wolfssl/wolfcrypt
  162. CRYPT_SRC_PATH=wolfcrypt/src
  163. WC_MODS+=( cmac dh ecc sha3 )
  164. RNG_VERSION=WCv4-rng-stable
  165. FIPS_SRCS+=( wolfcrypt_first.c wolfcrypt_last.c )
  166. FIPS_INCS=( fips.h )
  167. FIPS_OPTION=v2
  168. ;;
  169. netbsd-selftest)
  170. FIPS_VERSION=$NETBSD_FIPS_VERSION
  171. FIPS_REPO=$NETBSD_FIPS_REPO
  172. CRYPT_VERSION=$NETBSD_CRYPT_VERSION
  173. CRYPT_REPO=$NETBSD_CRYPT_REPO
  174. FIPS_SRCS=( selftest.c )
  175. WC_MODS=( dh ecc rsa dsa aes sha sha256 sha512 hmac random )
  176. CRYPT_INC_PATH=wolfssl/wolfcrypt
  177. CRYPT_SRC_PATH=wolfcrypt/src
  178. CAVP_SELFTEST_ONLY="yes"
  179. ;;
  180. marvell-linux-selftest)
  181. FIPS_VERSION=$MARVELL_LINUX_FIPS_VERSION
  182. FIPS_REPO=$MARVELL_LINUX_FIPS_REPO
  183. CRYPT_VERSION=$MARVELL_LINUX_CRYPT_VERSION
  184. CRYPT_REPO=$MARVELL_LINUX_CRYPT_REPO
  185. FIPS_SRCS=( selftest.c )
  186. WC_MODS=( dh ecc rsa dsa aes sha sha256 sha512 hmac random )
  187. CRYPT_INC_PATH=wolfssl/wolfcrypt
  188. CRYPT_SRC_PATH=wolfcrypt/src
  189. CAVP_SELFTEST_ONLY="yes"
  190. CAVP_SELFTEST_OPTION=v2
  191. ;;
  192. sgx)
  193. FIPS_VERSION=$SGX_FIPS_VERSION
  194. FIPS_REPO=$SGX_FIPS_REPO
  195. CRYPT_VERSION=$SGX_CRYPT_VERSION
  196. CRYPT_REPO=$SGX_CRYPT_REPO
  197. ;;
  198. netos-7.6)
  199. FIPS_VERSION=$NETOS_7_6_FIPS_VERSION
  200. FIPS_REPO=$NETOS_7_6_FIPS_REPO
  201. CRYPT_VERSION=$NETOS_7_6_CRYPT_VERSION
  202. CRYPT_REPO=$NETOS_7_6_CRYPT_REPO
  203. ;;
  204. fips-v3-ready)
  205. FIPS_REPO="git@github.com:wolfssl/fips.git"
  206. FIPS_VERSION="v4.1.1"
  207. CRYPT_INC_PATH=wolfssl/wolfcrypt
  208. CRYPT_SRC_PATH=wolfcrypt/src
  209. FIPS_SRCS+=( wolfcrypt_first.c wolfcrypt_last.c )
  210. FIPS_INCS=( fips.h )
  211. FIPS_OPTION=v3-ready
  212. ;;
  213. fips-ready|fips-v5-ready|linuxv5-ready)
  214. FIPS_REPO="git@github.com:wolfSSL/fips.git"
  215. FIPS_VERSION="master"
  216. CRYPT_INC_PATH=wolfssl/wolfcrypt
  217. CRYPT_SRC_PATH=wolfcrypt/src
  218. FIPS_SRCS+=( wolfcrypt_first.c wolfcrypt_last.c )
  219. FIPS_INCS=( fips.h )
  220. FIPS_OPTION=v5-ready
  221. ;;
  222. stm32l4-v2)
  223. FIPS_VERSION=$STM32L4_V2_FIPS_VERSION
  224. FIPS_REPO=$STM32L4_V2_FIPS_REPO
  225. CRYPT_VERSION=$STM32L4_V2_CRYPT_VERSION
  226. CRYPT_INC_PATH=wolfssl/wolfcrypt
  227. CRYPT_SRC_PATH=wolfcrypt/src
  228. # Replace the WC_MODS list for now. Do not want to copy over random.c yet.
  229. WC_MODS=( aes des3 sha sha256 sha512 rsa hmac )
  230. WC_MODS+=( cmac dh ecc )
  231. FIPS_SRCS+=( wolfcrypt_first.c wolfcrypt_last.c )
  232. FIPS_INCS=( fips.h )
  233. FIPS_OPTION=v2
  234. ;;
  235. wolfrand)
  236. FIPS_REPO=git@github.com:wolfssl/fips.git
  237. FIPS_VERSION=WRv4-stable
  238. CRYPT_REPO=git@github.com:wolfssl/wolfssl.git
  239. CRYPT_VERSION=WCv4-stable
  240. CRYPT_INC_PATH=wolfssl/wolfcrypt
  241. CRYPT_SRC_PATH=wolfcrypt/src
  242. RNG_VERSION=WCv4-rng-stable
  243. WC_MODS=( hmac sha256 random )
  244. FIPS_SRCS+=( wolfcrypt_first.c wolfcrypt_last.c )
  245. FIPS_INCS=( fips.h )
  246. FIPS_OPTION=rand
  247. ;;
  248. solaris)
  249. FIPS_VERSION=WCv4-stable
  250. FIPS_REPO=git@github.com:wolfssl/fips.git
  251. CRYPT_VERSION=WCv4-stable
  252. CRYPT_INC_PATH=wolfssl/wolfcrypt
  253. CRYPT_SRC_PATH=wolfcrypt/src
  254. WC_MODS+=( cmac dh ecc sha3 )
  255. RNG_VERSION=WCv4-rng-stable
  256. FIPS_SRCS+=( wolfcrypt_first.c wolfcrypt_last.c )
  257. FIPS_INCS=( fips.h )
  258. FIPS_OPTION=v2
  259. MAKE=gmake
  260. ;;
  261. linuxv5-RC8)
  262. FIPS_REPO="git@github.com:wolfSSL/fips.git"
  263. FIPS_VERSION="WCv5.0-RC8"
  264. CRYPT_REPO="git@github.com:wolfSSL/wolfssl.git"
  265. CRYPT_VERSION="WCv5.0-RC8"
  266. CRYPT_INC_PATH="wolfssl/wolfcrypt"
  267. CRYPT_SRC_PATH="wolfcrypt/src"
  268. WC_MODS=( aes sha sha256 sha512 rsa hmac random cmac dh ecc sha3 kdf )
  269. RNG_VERSION="WCv5.0-RC8"
  270. FIPS_SRCS=( fips.c fips_test.c wolfcrypt_first.c wolfcrypt_last.c )
  271. FIPS_INCS=( fips.h )
  272. FIPS_OPTION="v5-RC8"
  273. COPY_DIRECT=( wolfcrypt/src/aes_asm.S wolfcrypt/src/aes_asm.asm
  274. wolfcrypt/src/sha256_asm.S wolfcrypt/src/sha512_asm.S )
  275. ;;
  276. linuxv5|linuxv5-RC9)
  277. FIPS_REPO="git@github.com:wolfSSL/fips.git"
  278. FIPS_VERSION="WCv5.0-RC9"
  279. CRYPT_REPO="git@github.com:wolfSSL/wolfssl.git"
  280. CRYPT_VERSION="WCv5.0-RC9"
  281. CRYPT_INC_PATH="wolfssl/wolfcrypt"
  282. CRYPT_SRC_PATH="wolfcrypt/src"
  283. WC_MODS=( aes sha sha256 sha512 rsa hmac random cmac dh ecc sha3 kdf )
  284. RNG_VERSION="WCv5.0-RC9"
  285. FIPS_SRCS=( fips.c fips_test.c wolfcrypt_first.c wolfcrypt_last.c )
  286. FIPS_INCS=( fips.h )
  287. FIPS_OPTION="v5-RC9"
  288. COPY_DIRECT=( wolfcrypt/src/aes_asm.S wolfcrypt/src/aes_asm.asm
  289. wolfcrypt/src/sha256_asm.S wolfcrypt/src/sha512_asm.S )
  290. ;;
  291. linuxv5-RC10)
  292. FIPS_REPO="git@github.com:wolfSSL/fips.git"
  293. FIPS_VERSION="WCv5.0-RC10"
  294. CRYPT_REPO="git@github.com:wolfSSL/wolfssl.git"
  295. CRYPT_VERSION="WCv5.0-RC10"
  296. CRYPT_INC_PATH="wolfssl/wolfcrypt"
  297. CRYPT_SRC_PATH="wolfcrypt/src"
  298. WC_MODS=( aes sha sha256 sha512 rsa hmac random cmac dh ecc sha3 kdf )
  299. RNG_VERSION="WCv5.0-RC10"
  300. FIPS_SRCS=( fips.c fips_test.c wolfcrypt_first.c wolfcrypt_last.c )
  301. FIPS_INCS=( fips.h )
  302. FIPS_OPTION="v5-RC10"
  303. COPY_DIRECT=( wolfcrypt/src/aes_asm.S wolfcrypt/src/aes_asm.asm
  304. wolfcrypt/src/sha256_asm.S wolfcrypt/src/sha512_asm.S )
  305. ;;
  306. *)
  307. Usage
  308. exit 1
  309. esac
  310. if ! $GIT clone . $TEST_DIR; then
  311. echo "fips-check: Couldn't duplicate current working directory."
  312. exit 1
  313. fi
  314. pushd $TEST_DIR || exit 2
  315. case "$FIPS_OPTION" in
  316. v1)
  317. # make a clone of the last FIPS release tag
  318. if ! $GIT clone --depth 1 -b $CRYPT_VERSION $CRYPT_REPO old-tree; then
  319. echo "fips-check: Couldn't checkout the FIPS release."
  320. exit 1
  321. fi
  322. for MOD in "${WC_MODS[@]}"
  323. do
  324. cp "old-tree/$CRYPT_SRC_PATH/${MOD}.c" $CRYPT_SRC_PATH
  325. cp "old-tree/$CRYPT_INC_PATH/${MOD}.h" $CRYPT_INC_PATH
  326. done
  327. # We are using random.c from a separate release.
  328. # This is forcefully overwriting any other checkout of the cyassl sources.
  329. # Removing this as default behavior for SGX and netos projects.
  330. if [ "x$CAVP_SELFTEST_ONLY" == "xno" ] && [ "x$PLATFORM" != "xsgx" ] && \
  331. [ "x$PLATFORM" != "xnetos-7.6" ];
  332. then
  333. pushd old-tree || exit 2
  334. $GIT fetch origin $RNG_VERSION || exit $?
  335. $GIT checkout FETCH_HEAD || exit $?
  336. popd || exit 2
  337. cp "old-tree/$CRYPT_SRC_PATH/random.c" $CRYPT_SRC_PATH
  338. cp "old-tree/$CRYPT_INC_PATH/random.h" $CRYPT_INC_PATH
  339. fi
  340. ;;
  341. v2|rand|v5-RC8|v5-RC9)
  342. $GIT branch --no-track "my$CRYPT_VERSION" $CRYPT_VERSION || exit $?
  343. # Checkout the fips versions of the wolfCrypt files from the repo.
  344. for MOD in "${WC_MODS[@]}"
  345. do
  346. $GIT checkout "my$CRYPT_VERSION" -- "$CRYPT_SRC_PATH/$MOD.c" "$CRYPT_INC_PATH/$MOD.h" || exit $?
  347. done
  348. for MOD in "${COPY_DIRECT[@]}"
  349. do
  350. $GIT checkout "my$CRYPT_VERSION" -- "$MOD" || exit $?
  351. done
  352. $GIT branch --no-track "myrng$RNG_VERSION" $RNG_VERSION || exit $?
  353. # Checkout the fips versions of the wolfCrypt files from the repo.
  354. $GIT checkout "myrng$RNG_VERSION" -- "$CRYPT_SRC_PATH/random.c" "$CRYPT_INC_PATH/random.h" || exit $?
  355. ;;
  356. *ready*)
  357. echo "Don't need to copy anything in particular for FIPS Ready."
  358. ;;
  359. *)
  360. echo "fips-check: Invalid FIPS option \"${FIPS_OPTION}\"."
  361. exit 1
  362. ;;
  363. esac
  364. # clone the FIPS repository
  365. if [ "x$FIPS_OPTION" = "xready" ]
  366. then
  367. if ! $GIT clone --depth 1 $FIPS_REPO fips; then
  368. echo "fips-check: Couldn't checkout the FIPS repository for FIPS Ready."
  369. exit 1
  370. fi
  371. else
  372. if ! $GIT clone --depth 1 -b $FIPS_VERSION $FIPS_REPO fips; then
  373. echo "fips-check: Couldn't checkout the FIPS repository."
  374. exit 1
  375. fi
  376. fi
  377. for SRC in "${FIPS_SRCS[@]}"
  378. do
  379. cp "fips/$SRC" $CRYPT_SRC_PATH
  380. done
  381. for INC in "${FIPS_INCS[@]}"
  382. do
  383. cp "fips/$INC" $CRYPT_INC_PATH
  384. done
  385. # run the make test
  386. ./autogen.sh
  387. if [ "x$CAVP_SELFTEST_ONLY" == "xyes" ];
  388. then
  389. if [ "x$CAVP_SELFTEST_OPTION" == "xv2" ]
  390. then
  391. ./configure --enable-selftest=v2
  392. else
  393. ./configure --enable-selftest
  394. fi
  395. else
  396. ./configure --enable-fips=$FIPS_OPTION
  397. fi
  398. if ! $MAKE; then
  399. echo "fips-check: Make failed. Debris left for analysis."
  400. exit 3
  401. fi
  402. if [ "x$CAVP_SELFTEST_ONLY" == "xno" ];
  403. then
  404. NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
  405. if [ -n "$NEWHASH" ]; then
  406. cp $CRYPT_SRC_PATH/fips_test.c $CRYPT_SRC_PATH/fips_test.c.bak
  407. sed "s/^\".*\";/\"${NEWHASH}\";/" $CRYPT_SRC_PATH/fips_test.c.bak >$CRYPT_SRC_PATH/fips_test.c
  408. make clean
  409. fi
  410. fi
  411. if ! $MAKE test; then
  412. echo "fips-check: Test failed. Debris left for analysis."
  413. exit 3
  414. fi
  415. if [ ${#FIPS_CONFLICTS[@]} -ne 0 ];
  416. then
  417. echo "Due to the way this package is compiled by the customer duplicate"
  418. echo "source file names are an issue, renaming:"
  419. for FNAME in "${FIPS_CONFLICTS[@]}"
  420. do
  421. echo "wolfcrypt/src/$FNAME.c to wolfcrypt/src/wc_$FNAME.c"
  422. mv "./wolfcrypt/src/$FNAME.c" "./wolfcrypt/src/wc_$FNAME.c"
  423. done
  424. echo "Confirming files were renamed..."
  425. ls -la ./wolfcrypt/src/wc_*.c
  426. fi
  427. # Clean up
  428. popd || exit 2
  429. if [ "x$KEEP" == "xno" ];
  430. then
  431. rm -rf $TEST_DIR
  432. fi