Commit 6bad9d05 authored by Richard Levitte's avatar Richard Levitte
Browse files

A few more memset()s converted to OPENSSL_cleanse().

I *think* I got them all covered by now, bu please, if you find any more,
tell me and I'll correct it.
PR: 343
parent dd546333
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -263,12 +263,12 @@ void BN_clear_free(BIGNUM *a)
	if (a == NULL) return;
	if (a->d != NULL)
		{
		memset(a->d,0,a->dmax*sizeof(a->d[0]));
		OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0]));
		if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
			OPENSSL_free(a->d);
		}
	i=BN_get_flags(a,BN_FLG_MALLOCED);
	memset(a,0,sizeof(BIGNUM));
	OPENSSL_cleanse(a,sizeof(BIGNUM));
	if (i)
		OPENSSL_free(a);
	}
+1 −1
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
err:
	if (buf != NULL)
		{
		memset(buf,0,bytes);
		OPENSSL_cleanse(buf,bytes);
		OPENSSL_free(buf);
		}
	return(ret);
+1 −1
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ static void md2_block(MD2_CTX *c, const unsigned char *d)
		t=(t+i)&0xff;
		}
	memcpy(sp1,state,16*sizeof(MD2_INT));
	memset(state,0,48*sizeof(MD2_INT));
	OPENSSL_cleanse(state,48*sizeof(MD2_INT));
	}

void MD2_Final(unsigned char *md, MD2_CTX *c)
+1 −1
Original line number Diff line number Diff line
@@ -88,6 +88,6 @@ unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md)
	}
#endif
	MD2_Final(md,&c);
	memset(&c,0,sizeof(c));	/* Security consideration */
	OPENSSL_cleanse(&c,sizeof(c));	/* Security consideration */
	return(md);
	}
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md)
	}
#endif
	MD4_Final(md,&c);
	memset(&c,0,sizeof(c)); /* security consideration */
	OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
	return(md);
	}
Loading