Prefer long long to BIGNUM or GMP

This commit is contained in:
Howard Chu 2006-02-09 07:48:19 +00:00
parent 9eca89acc8
commit bf81549c88
2 changed files with 17 additions and 7 deletions

View File

@ -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"

View File

@ -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