Lines Matching refs:top

144         if (a->top == 1 && !a->neg
243 wstart = bits - 1; /* The top bit of the window */
324 if (m->top <= BN_CONSTTIME_SIZE_LIMIT
388 wstart = bits - 1; /* The top bit of the window */
392 j = m->top; /* borrow j */
396 /* 2^(top*BN_BITS2) - m */
400 r->top = j;
461 j = mont->N.top; /* borrow j */
465 val[0]->top = j;
488 if (wordpos >= 0 && wordpos < a->top) {
492 if (++wordpos < a->top)
507 static int MOD_EXP_CTIME_COPY_TO_PREBUF(const BIGNUM *b, int top,
515 if (top > b->top)
516 top = b->top; /* this works because 'buf' is explicitly
518 for (i = 0, j = idx; i < top; i++, j += width) {
525 static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top,
541 if (bn_wexpand(b, top) == NULL)
545 for (i = 0; i < top; i++, table += width) {
567 for (i = 0; i < top; i++, table += width) {
582 b->top = top;
606 int top;
627 top = m->top;
629 if (top > BN_CONSTTIME_SIZE_LIMIT) {
636 * whether the top bits are zero.
638 bits = p->top * BN_BITS2;
680 if ((16 == a->top) && (16 == p->top) && (BN_num_bits(m) == 1024)
686 rr->top = 16;
691 } else if ((8 == a->top) && (8 == p->top) && (BN_num_bits(m) == 512)) {
695 rr->top = 8;
706 if (window >= 5 && (top & 15) == 0 && top <= 64 &&
713 if (window >= 5 && top <= BN_SOFT_LIMIT) {
717 powerbufLen += top * sizeof(mont->N.d[0]);
727 powerbufLen += sizeof(m->d[0]) * (top * numPowers +
728 ((2 * top) >
729 numPowers ? (2 * top) : numPowers));
750 tmp.d = (BN_ULONG *)(powerbuf + sizeof(m->d[0]) * top * numPowers);
751 am.d = tmp.d + top;
752 tmp.top = am.top = 0;
753 tmp.dmax = am.dmax = top;
759 if (m->d[top - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) {
760 /* 2^(top*BN_BITS2) - m */
762 for (i = 1; i < top; i++)
764 tmp.top = top;
774 if (top > BN_SOFT_LIMIT)
798 bn_pwr5_mont_f pwr5_worker = pwr5_funcs[top / 16 - 1];
818 bn_mul_mont_f mul_worker = mul_funcs[top / 16 - 1];
836 int stride = 5 * (6 - (top / 16 - 1)); /* multiple of 5, but less
840 * BN_to_montgomery can contaminate words above .top [in
843 for (i = am.top; i < top; i++)
845 for (i = tmp.top; i < top; i++)
848 bn_flip_n_scatter5_t4(tmp.d, top, powerbuf, 0);
849 bn_flip_n_scatter5_t4(am.d, top, powerbuf, 1);
852 bn_mul_mont_vis3(tmp.d, am.d, am.d, np, n0, top);
853 bn_flip_n_scatter5_t4(tmp.d, top, powerbuf, 2);
859 bn_mul_mont_vis3(tmp.d, tmp.d, am.d, np, n0, top);
860 bn_flip_n_scatter5_t4(tmp.d, top, powerbuf, i);
864 np = alloca(top * sizeof(BN_ULONG));
865 top /= 2;
866 bn_flip_t4(np, mont->N.d, top);
878 bn_gather5_t4(tmp.d, top, powerbuf, wvalue);
899 bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
900 bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
901 bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
902 bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
903 bn_mul_mont_t4(tmp.d, tmp.d, tmp.d, np, n0, top);
904 bn_mul_mont_gather5_t4(tmp.d, tmp.d, powerbuf, np, n0, top,
908 bn_flip_t4(tmp.d, tmp.d, top);
909 top *= 2;
911 tmp.top = top;
913 OPENSSL_cleanse(np, top * sizeof(BN_ULONG));
917 if (window == 5 && top > 1) {
929 * They are bounded by R (i.e. they fit in |top| words), not |m|.
949 * BN_to_montgomery can contaminate words above .top [in
952 for (i = am.top; i < top; i++)
954 for (i = tmp.top; i < top; i++)
960 for (np = am.d + top, i = 0; i < top; i++)
963 bn_scatter5(tmp.d, top, powerbuf, 0);
964 bn_scatter5(am.d, am.top, powerbuf, 1);
965 bn_mul_mont(tmp.d, am.d, am.d, np, n0, top);
966 bn_scatter5(tmp.d, top, powerbuf, 2);
971 bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
972 bn_scatter5(tmp.d, top, powerbuf, i);
977 bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
978 bn_scatter5(tmp.d, top, powerbuf, i);
982 bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
983 bn_scatter5(tmp.d, top, powerbuf, i);
985 bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
986 bn_scatter5(tmp.d, top, powerbuf, j);
990 bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
991 bn_scatter5(tmp.d, top, powerbuf, i);
992 bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
993 bn_scatter5(tmp.d, top, powerbuf, 2 * i);
996 bn_mul_mont_gather5(tmp.d, am.d, powerbuf, np, n0, top, i - 1);
997 bn_scatter5(tmp.d, top, powerbuf, i);
1010 bn_gather5(tmp.d, top, powerbuf, wvalue);
1016 if (top & 7) {
1018 bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
1019 bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
1020 bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
1021 bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
1022 bn_mul_mont(tmp.d, tmp.d, tmp.d, np, n0, top);
1023 bn_mul_mont_gather5(tmp.d, tmp.d, powerbuf, np, n0, top,
1028 bn_power5(tmp.d, tmp.d, powerbuf, np, n0, top,
1033 tmp.top = top;
1049 if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 0, window))
1051 if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&am, top, powerbuf, 1, window))
1063 if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, 2,
1070 if (!MOD_EXP_CTIME_COPY_TO_PREBUF(&tmp, top, powerbuf, i,
1086 if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
1117 if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&am, top, powerbuf, wvalue,
1135 for (i = 1; i < top; i++)
1195 if (m->top == 1)
1362 wstart = bits - 1; /* The top bit of the window */
1442 ((a1->top == 16) && (p1->top == 16) && (BN_num_bits(m1) == 1024) &&
1443 (a2->top == 16) && (p2->top == 16) && (BN_num_bits(m2) == 1024))) {
1474 rr1->top = 16;
1479 rr2->top = 16;