2016-01-08 16:27:27 +00:00
|
|
|
.\"-
|
2017-04-29 00:31:15 +00:00
|
|
|
.\" Copyright (c) 2015 The University of Oslo
|
2016-09-17 14:48:50 +00:00
|
|
|
.\" Copyright (c) 2016 Dag-Erling Smørgrav
|
2016-01-08 16:27:27 +00:00
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. The name of the author may not be used to endorse or promote
|
|
|
|
.\" products derived from this software without specific prior written
|
|
|
|
.\" permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2016-09-17 14:48:50 +00:00
|
|
|
.Dd September 17, 2016
|
2016-01-08 16:27:27 +00:00
|
|
|
.Dt CRYB_SHA1 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm cryb_sha1_init ,
|
|
|
|
.Nm cryb_sha1_update ,
|
|
|
|
.Nm cryb_sha1_final ,
|
|
|
|
.Nm cryb_sha1_complete
|
|
|
|
.Nd Secure Hash Algorithm 1
|
|
|
|
.Sh LIBRARY
|
2016-09-17 14:48:50 +00:00
|
|
|
.Lb libcryb-digest
|
2016-01-08 16:27:27 +00:00
|
|
|
.Sh SYNOPSIS
|
2016-09-17 14:48:50 +00:00
|
|
|
.In stddef.h
|
2016-01-08 16:27:27 +00:00
|
|
|
.In stdint.h
|
|
|
|
.In cryb/sha1.h
|
|
|
|
.Ft void
|
|
|
|
.Fn cryb_sha1_init "cryb_sha1_ctx *context"
|
|
|
|
.Ft void
|
|
|
|
.Fn cryb_sha1_update "cryb_sha1_ctx *context" "const void *data" "size_t len"
|
|
|
|
.Ft void
|
|
|
|
.Fn cryb_sha1_final "cryb_sha1_ctx *context" "uint8_t *digest"
|
|
|
|
.Ft void
|
|
|
|
.Fn cryb_sha1_complete "const void *data" "size_t len" "uint8_t *digest"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm cryb_sha1
|
2016-09-17 14:48:50 +00:00
|
|
|
family of functions implements the NIST SHA-1 message digest algorithm
|
2016-01-08 16:27:27 +00:00
|
|
|
as described in FIPS 180-4.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn cryb_sha1_init
|
|
|
|
function initializes the context structure pointed to by
|
|
|
|
.Va context .
|
|
|
|
It is the caller's responsibility to allocate this structure.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn cryb_sha1_update
|
|
|
|
function hashes the next
|
|
|
|
.Va len
|
|
|
|
bytes of data pointed to by the
|
|
|
|
.Va data
|
|
|
|
pointer into the given hash context.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn cryb_sha1_final
|
|
|
|
function finalizes the computation and writes the resulting message
|
|
|
|
digest to the caller-provided buffer pointed to by
|
|
|
|
.Va digest ,
|
|
|
|
which must be at least
|
|
|
|
.Dv SHA1_DIGEST_LEN
|
|
|
|
bytes long.
|
|
|
|
It is the caller's responsibility to dispose of the context structure
|
|
|
|
after calling
|
|
|
|
.Fn cryb_sha1_final .
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn cryb_sha1_complete
|
|
|
|
function is a shortcut to calling
|
|
|
|
.Fn cryb_sha1_init ,
|
|
|
|
.Fn cryb_sha1_update
|
|
|
|
and
|
|
|
|
.Fn cryb_sha1_final
|
|
|
|
when the entire message is available up front in a single contiguous
|
|
|
|
buffer.
|
|
|
|
.Sh IMPLEMENTATION NOTES
|
|
|
|
The
|
|
|
|
.In cryb/sha1.h
|
|
|
|
header provides macros which allows these functions and the context
|
|
|
|
type to be referred to without their
|
|
|
|
.Dq Li cryb_
|
|
|
|
prefix.
|
|
|
|
.Pp
|
|
|
|
The SHA-1 message digest algorithm has been proven to be vulnerable to
|
|
|
|
collision attacks and should not be used for cryptographic purposes.
|
|
|
|
.Sh SEE ALSO
|
2016-09-17 14:48:50 +00:00
|
|
|
.Xr cryb_digest 3 ,
|
|
|
|
.Xr cryb_sha224 3 ,
|
|
|
|
.Xr cryb_sha256 3 ,
|
|
|
|
.Xr cryb_sha384 3 ,
|
|
|
|
.Xr cryb_sha512 3
|
2016-01-08 16:27:27 +00:00
|
|
|
.Sh REFERENCES
|
|
|
|
.Rs
|
|
|
|
.%Q National Institute of Standards and Technology
|
|
|
|
.%R Secure Hash Standard (SHS) (FIPS PUB 180-4)
|
|
|
|
.%D March 2012
|
|
|
|
.Re
|
|
|
|
.Sh AUTHORS
|
|
|
|
These functions and this manual page were written for the University
|
|
|
|
of Oslo by
|
|
|
|
.An Dag-Erling Sm\(/orgrav Aq Mt d.e.smorgrav@usit.uio.no .
|