Mercurial > illumos > illumos-gate
changeset 943:19aae6d81452
6286372 kernel SHA1Update uses global variable making it non-reentrant
author | krishna |
---|---|
date | Thu, 17 Nov 2005 15:04:51 -0800 |
parents | 8cf53d6a7d2e |
children | f5a4283de843 |
files | usr/src/common/crypto/sha1/sha1.c |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/common/crypto/sha1/sha1.c Thu Nov 17 11:42:26 2005 -0800 +++ b/usr/src/common/crypto/sha1/sha1.c Thu Nov 17 15:04:51 2005 -0800 @@ -325,12 +325,12 @@ #ifdef VIS_SHA1 -static int usevis = 0; #ifdef _KERNEL #include <sys/regset.h> #include <sys/vis.h> +#include <sys/fpu/fpusystm.h> /* the alignment for block stores to save fp registers */ #define VIS_ALIGN (64) @@ -343,6 +343,7 @@ #else /* !_KERNEL */ static boolean_t checked_vis = B_FALSE; +static int usevis = 0; static int havevis() @@ -432,8 +433,10 @@ SHA1Update(SHA1_CTX *ctx, const uint8_t *input, uint32_t input_len) { uint32_t i, buf_index, buf_len; - uint64_t X0[40], input64[8]; +#ifdef _KERNEL + int usevis = 0; +#endif /* _KERNEL */ /* check for noop */ if (input_len == 0) @@ -462,7 +465,7 @@ fpu = (kfpu_t *)P2ROUNDUP((uintptr_t)fpua, 64); svfp_ok = ((len >= vis_sha1_svfp_threshold) ? 1 : 0); - usevis = sha1_savefp(fpu, svfp_ok); + usevis = fpu_exists && sha1_savefp(fpu, svfp_ok); #else if (!checked_vis) usevis = havevis();