diff options
author | cem <cem@FreeBSD.org> | 2016-05-26 19:29:29 +0000 |
---|---|---|
committer | cem <cem@FreeBSD.org> | 2016-05-26 19:29:29 +0000 |
commit | 444253bba579f26af746a0fbf42b89b8f44298a0 (patch) | |
tree | a3f8dd317ab9b8bf2071cc3dc88766e3294342a7 /sys/crypto/sha1.c | |
parent | 6aac4cff86e423c72bc1e352d3435843185b5977 (diff) | |
download | FreeBSD-src-444253bba579f26af746a0fbf42b89b8f44298a0.zip FreeBSD-src-444253bba579f26af746a0fbf42b89b8f44298a0.tar.gz |
crypto routines: Hint minimum buffer sizes to the compiler
Use the C99 'static' keyword to hint to the compiler IVs and output digest
sizes. The keyword informs the compiler of the minimum valid size for a given
array. Obviously not every pointer can be validated (i.e., the compiler can
produce false negative but not false positive reports).
No functional change. No ABI change.
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/crypto/sha1.c')
-rw-r--r-- | sys/crypto/sha1.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/crypto/sha1.c b/sys/crypto/sha1.c index 208789a..b2451c7 100644 --- a/sys/crypto/sha1.c +++ b/sys/crypto/sha1.c @@ -249,16 +249,14 @@ sha1_loop(ctxt, input, len) } void -sha1_result(ctxt, digest0) - struct sha1_ctxt *ctxt; - caddr_t digest0; +sha1_result(struct sha1_ctxt *ctxt, char digest0[static SHA1_RESULTLEN]) { u_int8_t *digest; digest = (u_int8_t *)digest0; sha1_pad(ctxt); #if BYTE_ORDER == BIG_ENDIAN - bcopy(&ctxt->h.b8[0], digest, 20); + bcopy(&ctxt->h.b8[0], digest, SHA1_RESULTLEN); #else digest[0] = ctxt->h.b8[3]; digest[1] = ctxt->h.b8[2]; digest[2] = ctxt->h.b8[1]; digest[3] = ctxt->h.b8[0]; |