| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 |
| 15 | # This script attempts to break each of the known KATs and checks that doing so |
| 16 | # seems to work and at least mentions the correct KAT in the output. |
| 17 |
| 18 | set -x |
| 19 | set -e |
| 20 |
| 21 | TEST_FIPS_BIN="build/util/fipstools/test_fips" |
| 22 |
| 23 | if [ ! -f $TEST_FIPS_BIN ]; then |
| 24 | echo "$TEST_FIPS_BIN is missing. Run this script from the top level of a" |
| 25 | echo "BoringSSL checkout and ensure that ./build-fips-break-test-binaries.sh" |
| 26 | echo "has been run first." |
| 27 | exit 1 |
| 28 | fi |
| 29 |
| 30 | KATS=$(go run util/fipstools/break-kat.go --list-tests) |
| 31 |
| 32 | for kat in $KATS; do |
| 33 | go run util/fipstools/break-kat.go $TEST_FIPS_BIN $kat > break-kat-bin |
| 34 | chmod u+x ./break-kat-bin |
| 35 | if ! (./break-kat-bin 2>&1 >/dev/null || true) | \ |
| 36 | egrep -q "^$kat[^a-zA-Z0-9]"; then |
| 37 | echo "Failure for $kat did not mention that name in the output" |
| 38 | exit 1 |
| 39 | fi |
| 40 | rm ./break-kat-bin |
| 41 | done |
| 42 |