etwmc / Personal-HomeKit-HAP

This project will provide source code to build a HomeKit support accessories.
MIT License
236 stars 85 forks source link

srp/t_math.c(# line 353 ) does not compatible with the newest openssl release? #70

Closed lovelacelee closed 2 years ago

lovelacelee commented 7 years ago
int
BigIntegerCmpInt(c1, c2)
     BigInteger c1;
     unsigned int c2;
{
#ifdef OPENSSL
  if(c1->top > 1) // Error occurred here
    return 1;
  else if(c1->top < 1)
    return (c2 > 0) ? -1 : 0;
  else {
    if(c1->d[0] > c2)
      return 1;
    else if(c1->d[0] < c2)
      return -1;
    else
      return 0;
  }
#elif defined(CRYPTOLIB)
  BigInteger t;
  int rv;

  t = bigInit(c2);
  rv = bigCompare(c1, t);
  freeBignum(t);
  return rv;
#elif defined(GNU_MP)
  return mpz_cmp_ui(c1, c2);
#elif defined(TOMMATH)
  return mp_cmp_d(c1, c2);
#elif defined(GCRYPT)
  return gcry_mpi_cmp_ui(c1, c2);
#elif defined(MPI)
  return mp_cmp_int(c1, c2);
#endif
}

I just tested the openssl.1.0.0, everything is fine but compiling with openssl.1.1.0e(which my archlinux updated), or openssl.1.1.0f(the newest release of openssl official website) cause the error:

srp/t_math.c: In function 'BigIntegerCmpInt'
srp/t_math.c:353:8: error: dereferencing pointer to incomplete type 'BIGNUM {aka struct bignum_st}'
    if(c1->stop > 1)