Changes needed for Tandem NSK, supplied by Scott Uroff (scott@xypro.com).
authorDr. Stephen Henson <steve@openssl.org>
Fri, 4 Aug 2000 00:01:39 +0000 (00:01 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 4 Aug 2000 00:01:39 +0000 (00:01 +0000)
Fix warnings with BIO_dump_indent().

CHANGES
crypto/asn1/asn1_par.c
crypto/bn/bn.h
crypto/bn/bn_div.c
crypto/bn/bn_lib.c
crypto/bn/bn_mont.c

diff --git a/CHANGES b/CHANGES
index 74f5bc7d008207428f867844100b64bd83834f32..137e09d28519310534406cce99dda3f3d6f5c48d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@
 
  Changes between 0.9.5a and 0.9.6  [xx XXX 2000]
 
 
  Changes between 0.9.5a and 0.9.6  [xx XXX 2000]
 
+  *) Changes needed for Tandem NSK.
+     [Scott Uroff scott@xpro.com]
+
   *) Fix SSL 2.0 rollback checking: Due to an off-by-one error in
      RSA_padding_check_SSLv23(), special padding was never detected
      and thus the SSL 3.0/TLS 1.0 countermeasure against protocol
   *) Fix SSL 2.0 rollback checking: Due to an off-by-one error in
      RSA_padding_check_SSLv23(), special padding was never detected
      and thus the SSL 3.0/TLS 1.0 countermeasure against protocol
index dc868a4d87b636bc10f2ce7682fb0ba6c3066b2c..facfdd27fca0159f28f39e6d4fb50a2381985cc7 100644 (file)
@@ -292,7 +292,7 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
                                                        if (BIO_write(bp,"\n",1) <= 0)
                                                                goto end;
                                                        }
                                                        if (BIO_write(bp,"\n",1) <= 0)
                                                                goto end;
                                                        }
-                                               if (BIO_dump_indent(bp,opp,
+                                               if (BIO_dump_indent(bp,(char *)opp,
                                                        ((dump == -1 || dump > os->length)?os->length:dump),
                                                        dump_indent) <= 0)
                                                        goto end;
                                                        ((dump == -1 || dump > os->length)?os->length:dump),
                                                        dump_indent) <= 0)
                                                        goto end;
@@ -373,7 +373,7 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
                                        if (BIO_write(bp,"\n",1) <= 0)
                                                goto end;
                                        }
                                        if (BIO_write(bp,"\n",1) <= 0)
                                                goto end;
                                        }
-                               if (BIO_dump_indent(bp,p,
+                               if (BIO_dump_indent(bp,(char *)p,
                                        ((dump == -1 || dump > len)?len:dump),
                                        dump_indent) <= 0)
                                        goto end;
                                        ((dump == -1 || dump > len)?len:dump),
                                        dump_indent) <= 0)
                                        goto end;
index d292394c0fd13f5056b1829f453029fc95c8bffd..1eb8395b25c3c6c2a0f521dbb54d52d1cedceff3 100644 (file)
@@ -233,7 +233,7 @@ typedef struct bignum_st
        BN_ULONG *d;    /* Pointer to an array of 'BN_BITS2' bit chunks. */
        int top;        /* Index of last used d +1. */
        /* The next are internal book keeping for bn_expand. */
        BN_ULONG *d;    /* Pointer to an array of 'BN_BITS2' bit chunks. */
        int top;        /* Index of last used d +1. */
        /* The next are internal book keeping for bn_expand. */
-       int max;        /* Size of the d array. */
+       int dmax;       /* Size of the d array. */
        int neg;        /* one if the number is negative */
        int flags;
        } BIGNUM;
        int neg;        /* one if the number is negative */
        int flags;
        } BIGNUM;
@@ -435,9 +435,9 @@ int BN_div_recp(BIGNUM *dv, BIGNUM *rem, BIGNUM *m,
 
 /* library internal functions */
 
 
 /* library internal functions */
 
-#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->max)?\
+#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\
        (a):bn_expand2((a),(bits)/BN_BITS2+1))
        (a):bn_expand2((a),(bits)/BN_BITS2+1))
-#define bn_wexpand(a,words) (((words) <= (a)->max)?(a):bn_expand2((a),(words)))
+#define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
 BIGNUM *bn_expand2(BIGNUM *a, int words);
 
 #define bn_fix_top(a) \
 BIGNUM *bn_expand2(BIGNUM *a, int words);
 
 #define bn_fix_top(a) \
index 07af1d3b449b2c98baf9c9bbc9a208f8b2434dfd..c3772c243be575d8c321bc4f22fe3bc215008d59 100644 (file)
@@ -205,7 +205,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
        BN_init(&wnum);
        wnum.d=  &(snum->d[loop]);
        wnum.top= div_n;
        BN_init(&wnum);
        wnum.d=  &(snum->d[loop]);
        wnum.top= div_n;
-       wnum.max= snum->max+1; /* a bit of a lie */
+       wnum.dmax= snum->dmax+1; /* a bit of a lie */
 
        /* Get the top 2 words of sdiv */
        /* i=sdiv->top; */
 
        /* Get the top 2 words of sdiv */
        /* i=sdiv->top; */
index 81e5d7d98e8d804d8150e6c58ea467f47cd8ead7..b693c7e0c07b8cd493b1b18f81c1291495ba4218 100644 (file)
@@ -262,7 +262,7 @@ void BN_clear_free(BIGNUM *a)
        if (a == NULL) return;
        if (a->d != NULL)
                {
        if (a == NULL) return;
        if (a->d != NULL)
                {
-               memset(a->d,0,a->max*sizeof(a->d[0]));
+               memset(a->d,0,a->dmax*sizeof(a->d[0]));
                if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
                        OPENSSL_free(a->d);
                }
                if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
                        OPENSSL_free(a->d);
                }
@@ -299,7 +299,7 @@ BIGNUM *BN_new(void)
        ret->flags=BN_FLG_MALLOCED;
        ret->top=0;
        ret->neg=0;
        ret->flags=BN_FLG_MALLOCED;
        ret->top=0;
        ret->neg=0;
-       ret->max=0;
+       ret->dmax=0;
        ret->d=NULL;
        return(ret);
        }
        ret->d=NULL;
        return(ret);
        }
@@ -317,7 +317,7 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
 
        bn_check_top(b);
 
 
        bn_check_top(b);
 
-       if (words > b->max)
+       if (words > b->dmax)
                {
                bn_check_top(b);        
                if (BN_get_flags(b,BN_FLG_STATIC_DATA))
                {
                bn_check_top(b);        
                if (BN_get_flags(b,BN_FLG_STATIC_DATA))
@@ -427,17 +427,17 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
                        }
 
                b->d=a;
                        }
 
                b->d=a;
-               b->max=words;
+               b->dmax=words;
 
                /* Now need to zero any data between b->top and b->max */
 
                A= &(b->d[b->top]);
 
                /* Now need to zero any data between b->top and b->max */
 
                A= &(b->d[b->top]);
-               for (i=(b->max - b->top)>>3; i>0; i--,A+=8)
+               for (i=(b->dmax - b->top)>>3; i>0; i--,A+=8)
                        {
                        A[0]=0; A[1]=0; A[2]=0; A[3]=0;
                        A[4]=0; A[5]=0; A[6]=0; A[7]=0;
                        }
                        {
                        A[0]=0; A[1]=0; A[2]=0; A[3]=0;
                        A[4]=0; A[5]=0; A[6]=0; A[7]=0;
                        }
-               for (i=(b->max - b->top)&7; i>0; i--,A++)
+               for (i=(b->dmax - b->top)&7; i>0; i--,A++)
                        A[0]=0;
 #else
                        memset(A,0,sizeof(BN_ULONG)*(words+1));
                        A[0]=0;
 #else
                        memset(A,0,sizeof(BN_ULONG)*(words+1));
@@ -508,7 +508,7 @@ BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
 void BN_clear(BIGNUM *a)
        {
        if (a->d != NULL)
 void BN_clear(BIGNUM *a)
        {
        if (a->d != NULL)
-               memset(a->d,0,a->max*sizeof(a->d[0]));
+               memset(a->d,0,a->dmax*sizeof(a->d[0]));
        a->top=0;
        a->neg=0;
        }
        a->top=0;
        a->neg=0;
        }
index 6a54e8f4cf843a67bbeaea6db0292c37113d7307..d40a153f24d366d005bd430870b4e69ef556e440 100644 (file)
@@ -157,7 +157,22 @@ int BN_from_montgomery(BIGNUM *ret, BIGNUM *a, BN_MONT_CTX *mont,
 #endif
        for (i=0; i<nl; i++)
                {
 #endif
        for (i=0; i<nl; i++)
                {
+#ifdef __TANDEM
+                {
+                   long long t1;
+                   long long t2;
+                   long long t3;
+                   t1 = rp[0] * (n0 & 0177777);
+                   t2 = 037777600000l;
+                   t2 = n0 & t2;
+                   t3 = rp[0] & 0177777;
+                   t2 = (t3 * t2) & BN_MASK2;
+                   t1 = t1 + t2;
+                   v=bn_mul_add_words(rp,np,nl,(BN_ULONG) t1);
+                }
+#else
                v=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);
                v=bn_mul_add_words(rp,np,nl,(rp[0]*n0)&BN_MASK2);
+#endif
                nrp++;
                rp++;
                if (((nrp[-1]+=v)&BN_MASK2) >= v)
                nrp++;
                rp++;
                if (((nrp[-1]+=v)&BN_MASK2) >= v)
@@ -284,7 +299,7 @@ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
                buf[1]=0;
                tmod.d=buf;
                tmod.top=1;
                buf[1]=0;
                tmod.d=buf;
                tmod.top=1;
-               tmod.max=2;
+               tmod.dmax=2;
                tmod.neg=mod->neg;
                                                        /* Ri = R^-1 mod N*/
                if ((BN_mod_inverse(&Ri,R,&tmod,ctx)) == NULL)
                tmod.neg=mod->neg;
                                                        /* Ri = R^-1 mod N*/
                if ((BN_mod_inverse(&Ri,R,&tmod,ctx)) == NULL)