From: Nikos Mavrogiannopoulos Date: Tue, 12 Dec 2000 15:01:25 +0000 (+0000) Subject: added a better(?) - not sure - xor function. X-Git-Tag: gnutls0-0-6~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d00d590e7cbadfdcacccf69dd2bcfbde831d30ae;p=thirdparty%2Fgnutls.git added a better(?) - not sure - xor function. --- diff --git a/lib/gnutls.c b/lib/gnutls.c index 5253c1ec61..1a1d590365 100644 --- a/lib/gnutls.c +++ b/lib/gnutls.c @@ -162,7 +162,7 @@ int gnutls_deinit(GNUTLS_STATE * state) return 0; } - +inline static void *_gnutls_cal_PRF_A( MACAlgorithm algorithm, void *secret, int secret_size, void *seed, int seed_size) { GNUTLS_MAC_HANDLE td1; @@ -226,13 +226,32 @@ static svoid *gnutls_P_hash( MACAlgorithm algorithm, opaque * secret, int secret return ret; } +/* Function that xor's buffers using the maximum word size supported + * by the system. It should be faster. + */ +inline static +void _gnutls_xor(void* _o1, void* _o2, int _length) { +unsigned long int* o1 = _o1; +unsigned long int* o2 = _o2; +int i, length = _length/sizeof(unsigned long int); +int modlen = _length%sizeof(unsigned long int); + + for (i = 0; i < length; i++) { + o1[i] ^= o2[i]; + } + i*=sizeof(unsigned long int); + for (;i