summaryrefslogtreecommitdiff
path: root/crypto/mem_clr.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2010-01-27 11:14:46 +0000
committerRichard Levitte <levitte@openssl.org>2010-01-27 11:14:46 +0000
commite6d8d6a89ae491106ff5860bcd339f1469ca350f (patch)
treebf5eb7cff5c855f24213c665470d57d9bc96b969 /crypto/mem_clr.c
parent0e785e5e093d4c24eaf531dd5ffc655e3a91c6b5 (diff)
downloadopenssl-new-BRANCH_VMS_64BIT.tar.gz
Merge main -> VMS_64BITBRANCH_VMS_64BIT
Diffstat (limited to 'crypto/mem_clr.c')
-rw-r--r--crypto/mem_clr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/crypto/mem_clr.c b/crypto/mem_clr.c
index e4b7f540b0..add1f78020 100644
--- a/crypto/mem_clr.c
+++ b/crypto/mem_clr.c
@@ -64,12 +64,14 @@ unsigned char cleanse_ctr = 0;
void OPENSSL_cleanse(void *ptr, size_t len)
{
unsigned char *p = ptr;
- size_t loop = len;
+ size_t loop = len, ctr = cleanse_ctr;
while(loop--)
{
- *(p++) = cleanse_ctr;
- cleanse_ctr += (17 + (unsigned char)((int)p & 0xF));
+ *(p++) = (unsigned char)ctr;
+ ctr += (17 + ((size_t)p & 0xF));
}
- if(memchr(ptr, cleanse_ctr, len))
- cleanse_ctr += 63;
+ p=memchr(ptr, (unsigned char)ctr, len);
+ if(p)
+ ctr += (63 + (size_t)p);
+ cleanse_ctr = (unsigned char)ctr;
}