*/
#include <stdio.h>
+#include <openssl/bn.h>
#include "cryptlib.h"
#include "bn_lcl.h"
#else
-int BN_div(BIGNUM *dv, BIGNUM *rm, BIGNUM *num, BIGNUM *divisor,
- BN_CTX *ctx)
+int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
+ BN_CTX *ctx)
{
int norm_shift,i,j,loop;
BIGNUM *tmp,wnum,*snum,*sdiv,*res;
t1=((BN_ULLONG)n0<<BN_BITS2)|n1;
for (;;)
{
- t2=(BN_ULLONG)d1*q;
rem=t1-(BN_ULLONG)q*d0;
- if ((rem>>BN_BITS2) ||
- (t2 <= ((BN_ULLONG)(rem<<BN_BITS2)+wnump[-2])))
+ t2=(BN_ULLONG)d1*q;
+ if ((rem>>BN_BITS2) ||
+ (t2 <= ((rem<<BN_BITS2)|wnump[-2])))
break;
q--;
}
#endif
/* rem != m */
-int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx)
+int BN_mod(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
{
#if 0 /* The old slow way */
int i,nm,nd;