1.\" $NetBSD: SHA3_Selftest.3,v 1.1 2017/11/30 16:00:48 wiz Exp $ 2.\" 3.\" Copyright (c) 2015 Taylor R. Campbell 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.Dd October 14, 2015 28.Dt SHA3_SELFTEST 3 29.Os 30.Sh NAME 31.Nm SHA3_Selftest 32.Nd NIST FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions 33.Sh SYNOPSIS 34.In sha3.h 35.Ft int 36.Fn SHA3_Selftest "void" 37.Sh DESCRIPTION 38The 39.Nm 40function automatically tests a number of SHA-3 computations on fixed 41inputs with with known outputs to make sure the 42.Xr sha3 3 43library is not catastrophically broken. 44Applications should call 45.Fn SHA3_Selftest 46and confirm that it succeeded before using the 47.Xr sha3 3 , 48.Xr SHAKE 3 , 49or 50.Xr keccak 3 51functions. 52.Pp 53.Fn SHA3_Selftest 54returns 0 if successful, or -1 if the self-test failed. 55.Pp 56The 57.Fn SHA3_Selftest 58function costs a few hundred thousand cycles on most CPUs, since it 59involves a little over a hundred calls to the Keccak permutation, 60which usually take one or two thousand cycles each. 61.Sh SEE ALSO 62.Xr keccak 3 , 63.Xr sha3 3 , 64.Xr SHAKE 3 65.Sh STANDARDS 66.Rs 67.%A National Institute of Standards and Technology 68.%T SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions 69.%O FIPS PUB 202 70.%D August 2015 71.Re 72.Sh AUTHORS 73.An Taylor R Campbell Aq campbell+sha3@mumble.net 74