> I wouldn't have thought so no. The more garbage that gets written the
> better, provided it gets written to the right place that is.

Correct, there is no reason to serialize OPENSSL_cleanse.

> FWIW. There's a measurable performance increase reverting that to memset()
> and adding tests to ensure that the compiler hasn't in fact optimized it
> away.

Or one can optimize OPENSSL_cleanse, because the way it's written
prevents compiler from holding cleanse_ctr value in register. Tricking
compiler to allocate register for it improves performance of e.g. sha1
smallest block benchmark by 66% on my x86.

unsigned char cleanse_ctr = 0;

void OPENSSL_cleanse(void *ptr, size_t len)
unsigned char *p = ptr;
size_t loop = len, ctr = cleanse_ctr;
*(p++) = (unsigned char)ctr;
ctr += (17 + ((size_t)p & 0xF));
if(memchr(ptr, (unsigned char)ctr, len))
ctr += (63 + (size_t)p);
cleanse_ctr = (unsigned char)ctr;


__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
Development Mailing List openssl-dev@openssl.org
Automated List Manager majordomo@openssl.org