From: Howard Chu Date: Thu, 9 Feb 2006 07:48:19 +0000 (+0000) Subject: Prefer long long to BIGNUM or GMP X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~210 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bf81549c886cb4ca1b8a125f6d10372c1b708e4b;p=openldap Prefer long long to BIGNUM or GMP --- diff --git a/include/ldap_pvt.h b/include/ldap_pvt.h index 1ec90b048e..f568f509fa 100644 --- a/include/ldap_pvt.h +++ b/include/ldap_pvt.h @@ -266,11 +266,21 @@ LDAP_END_DECL * Multiple precision stuff * * May use OpenSSL's BIGNUM if built with TLS, - * or GNU's multiple precision library. + * or GNU's multiple precision library. But if + * long long is available, that's big enough + * and much more efficient. * * If none is available, unsigned long data is used. */ -#ifdef HAVE_BIGNUM +#if !defined(HAVE_LONG_LONG) +#if defined(HAVE_BIGNUM) +#define USE_BIGNUM +#elif defined(HAVE_GMP) +#define USE_GMP +#endif +#endif + +#ifdef USE_BIGNUM /* * Use OpenSSL's BIGNUM */ @@ -304,7 +314,7 @@ typedef BIGNUM* ldap_pvt_mp_t; #define ldap_pvt_mp_clear(mp) \ do { BN_free((mp)); (mp) = 0; } while (0) -#elif defined(HAVE_GMP) +#elif defined(USE_GMP) /* * Use GNU's multiple precision library */ @@ -330,7 +340,7 @@ typedef mpz_t ldap_pvt_mp_t; #define ldap_pvt_mp_clear(mp) \ mpz_clear((mp)) -#else /* ! HAVE_BIGNUM && ! HAVE_GMP */ +#else /* ! USE_BIGNUM && ! USE_GMP */ /* * Use unsigned long */ @@ -358,7 +368,7 @@ typedef unsigned long ldap_pvt_mp_t; #define ldap_pvt_mp_clear(mp) \ (mp) = 0 -#endif /* ! HAVE_BIGNUM && ! HAVE_GMP */ +#endif /* ! USE_BIGNUM && ! USE_GMP */ #include "ldap_pvt_uc.h" diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 5bdba47717..fb025c8011 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1821,7 +1821,7 @@ LDAP_SLAPD_F (int) fe_access_allowed LDAP_P(( /* NOTE: this macro assumes that bv has been allocated * by ber_* malloc functions or is { 0L, NULL } */ -#if defined(HAVE_BIGNUM) +#if defined(USE_BIGNUM) #define UI2BVX(bv,ui,ctx) \ do { \ char *val; \ @@ -1840,7 +1840,7 @@ LDAP_SLAPD_F (int) fe_access_allowed LDAP_P(( BER_BVZERO( (bv) ); \ } \ } while ( 0 ) -#elif defined(HAVE_GMP) +#elif defined(USE_GMP) /* NOTE: according to the documentation, the result * of mpz_sizeinbase() can exceed the length of the * string representation of the number by 1