Lines Matching refs:len

162 	(void) printf("\n%s\n%d\n", aname, a->sign*a->len);
163 for (i = a->len - 1; i >= 0; i--) {
237 number->len = 0;
279 number->len = 0;
302 * (len + BIGNUM_WORDSIZE - 1) / BIGNUM_WORDSIZE bytes
307 bytestring2bignum(BIGNUM *bn, uchar_t *kn, size_t len)
311 const uint32_t slen = UI32(len);
316 bn->len = 1;
322 bn->len = slen / BIGNUM_WORDSIZE;
335 bn->value[bn->len++] = word;
337 while ((bn->len > 1) && (bn->value[bn->len - 1] == 0)) {
338 bn->len --;
344 * copies the least significant len bytes if
345 * len < bn->len * BIGNUM_WORDSIZE
350 bignum2bytestring(uchar_t *kn, BIGNUM *bn, size_t len)
354 const uint32_t slen = UI32(len);
357 if (len < BIGNUM_WORDSIZE * bn->len) {
375 for (i = 0; i < bn->len; i++) {
383 for (i = 0; i < slen - BIGNUM_WORDSIZE * bn->len; i++) {
396 l = a->len - 1;
419 int i, len;
421 len = src->len;
422 while ((len > 1) && (src->value[len - 1] == 0)) {
423 len--;
425 src->len = len;
426 if (dest->size < len) {
430 BIGNUM_WORDSIZE * len);
433 big_malloc(BIGNUM_WORDSIZE * len);
442 dest->size = len;
444 dest->len = len;
446 for (i = 0; i < len; i++) {
498 for (i = 0; i < n->len; i++) {
516 if (aa->len > bb->len) {
517 shorter = bb->len;
518 longer = aa->len;
521 shorter = aa->len;
522 longer = bb->len;
555 result->len = longer + 1;
557 result->len = longer;
564 /* caller must make sure that result has at least len words allocated */
566 big_sub_vec(BIG_CHUNK_TYPE *r, BIG_CHUNK_TYPE *a, BIG_CHUNK_TYPE *b, int len)
572 for (i = 0; i < len; i++) {
593 if (aa->len > bb->len) {
594 shorter = bb->len;
596 shorter = aa->len;
598 if (result->size < aa->len) {
599 err = big_extend(result, aa->len);
608 result->len = aa->len;
619 for (; i < aa->len; i++) {
642 if (aa->len > bb->len) {
643 for (i = aa->len - 1; i > bb->len - 1; i--) {
648 } else if (aa->len < bb->len) {
649 for (i = bb->len - 1; i > aa->len - 1; i--) {
655 i = aa->len - 1;
766 if (result->size < aa->len) {
767 err = big_extend(result, aa->len);
773 result->len = aa->len;
777 for (i = aa->len - 1; i >= 0; i--) {
782 if (r[result->len - 1] == 0) {
783 result->len--;
798 if ((aa->len > 0) &&
799 ((aa->value[aa->len - 1] & BIG_CHUNK_HIGHBIT) != 0)) {
800 rsize = aa->len + 1;
802 rsize = aa->len;
813 if (rsize == aa->len + 1) {
817 for (i = 0; i < aa->len; i++) {
822 result->len = rsize;
837 if (aa->len == 0) {
840 rem = aa->value[aa->len - 1] % b;
841 for (i = aa->len - 2; i >= 0; i--) {
854 * result->size should be at least aa->len at entry
863 lendiff = aa->len - bb->len;
869 aa1.len = bb->len;
877 result->len = aa->len;
884 * aa->len should be >= bb->len
892 lendiff = aa->len - bb->len;
893 aa1.len = bb->len;
915 for (i = 0; i < aa->len; i++) {
925 result->len = aa->len + 1;
946 for (i = 0; i < aa->len; i++) {
956 result->len = aa->len + 1;
975 for (i = 0; i < aa->len; i++) {
981 result->len = aa->len + 1;
982 result->value[result->len - 1] = cy;
984 result->len = aa->len;
1004 for (i = 1; i < aa->len; i++) {
1009 result->len = aa->len;
1010 result->value[result->len - 1] = cy;
1035 alen = aa->len;
1036 blen = bb->len;
1040 aa->len = alen;
1044 bb->len = blen;
1055 result->len = 1;
1100 if (bbhigh.value[bbhigh.len - 1] == 0) {
1101 bbhigh.len--;
1103 bbhigh.value[bbhigh.len] = 0;
1106 highb = bblow.value[bblow.len - 1];
1109 rlen = tmp1.len - bblow.len + 1;
1110 tresult.len = rlen;
1112 tmp1.len++;
1113 tlen = tmp1.len;
1114 tmp1.value[tmp1.len - 1] = 0;
1121 bbhigh.len++;
1126 bbhigh.len--;
1128 tmp1.len--;
1137 tmp2.len--;
1237 big_mul_set_vec(uint32_t *r, uint32_t *a, int len, uint32_t b)
1241 if (len == 0)
1246 while (len > UNROLL) {
1257 len -= UNROLL;
1259 if (len == UNROLL) {
1270 while (len > 1) {
1274 --len;
1276 if (len > 0) {
1288 big_mul_add_vec(uint32_t *r, uint32_t *a, int len, uint32_t b)
1292 if (len == 0)
1297 while (len > 8) {
1308 len -= 8;
1310 if (len == 8) {
1321 while (len > 1) {
1325 --len;
1327 if (len > 0) {
1335 big_sqr_vec(uint32_t *r, uint32_t *a, int len)
1344 tlen = len - 1;
1360 while (row < len) {
1369 if (row == len - 1)
1383 * r = r + a * digit, r and a are vectors of length len
1387 big_mul_add_vec(BIG_CHUNK_TYPE *r, BIG_CHUNK_TYPE *a, int len,
1396 for (i = 0; i < len; i++) {
1409 for (i = 0; i < len - 1; i++) {
1420 dhigh * (a[len - 1] & BIG_CHUNK_LOWHALFBITS) +
1421 (r[len - 1] >> (BIG_CHUNK_SIZE / 2));
1422 r[len - 1] = (cy1 & BIG_CHUNK_LOWHALFBITS) |
1425 dhigh * (a[len - 1] >> (BIG_CHUNK_SIZE / 2)) + retcy;
1432 * r = a * digit, r and a are vectors of length len
1436 big_mul_set_vec(BIG_CHUNK_TYPE *r, BIG_CHUNK_TYPE *a, int len,
1442 for (i = 0; i < len; i++) {
1445 return (big_mul_add_vec(r, a, len, digit));
1449 big_sqr_vec(BIG_CHUNK_TYPE *r, BIG_CHUNK_TYPE *a, int len)
1454 r[len] = big_mul_set_vec(r, a, len, a[0]);
1455 for (i = 1; i < len; ++i)
1456 r[len + i] = big_mul_add_vec(r + i, a, len, a[i]);
1470 * r = r + a * digit, r and a are vectors of length len
1474 big_mul_add_vec(uint32_t *r, uint32_t *a, int len, uint32_t digit)
1482 for (i = 0; i < len; i++) {
1490 for (i = 0; i < len - 1; i++) {
1495 cy = (cy1 >> 16) + dhigh * (a[len - 1] & 0xffff) + (r[len - 1] >> 16);
1496 r[len - 1] = (cy1 & 0xffff) | (cy << 16);
1497 retcy = (cy >> 16) + dhigh * (a[len - 1] >> 16) + retcy;
1504 * r = a * digit, r and a are vectors of length len
1508 big_mul_set_vec(uint32_t *r, uint32_t *a, int len, uint32_t digit)
1513 for (i = 0; i < len; i++) {
1517 return (big_mul_add_vec(r, a, len, digit));
1521 big_sqr_vec(uint32_t *r, uint32_t *a, int len)
1526 r[len] = big_mul_set_vec(r, a, len, a[0]);
1527 for (i = 1; i < len; ++i)
1528 r[len + i] = big_mul_add_vec(r + i, a, len, a[i]);
1576 alen = aa->len;
1577 blen = bb->len;
1581 aa->len = alen;
1585 bb->len = blen;
1601 result->len = 1;
1611 result->len = blen;
1619 result->len = alen;
1641 tmp1.len = rsize - 1;
1643 tmp1.len = rsize;
1660 * Caller must ensure that a < n, b < n, ret->size >= 2 * n->len + 1,
1682 nlen = n->len;
1692 for (i = ret->len; i < 2 * nlen + 1; i++) {
1756 ret->len = i + 1;
1790 for (i = n->len - 1; i > 0; i--) {
1813 int len, i;
1817 len = n->len;
1819 if ((err = big_init1(&rr, 2 * len + 1,
1824 for (i = 0; i < 2 * len; i++) {
1827 rr.value[2 * len] = 1;
1828 rr.len = 2 * len + 1;
1846 int len, i;
1850 len = n->len;
1852 if ((err = big_init1(&rr, 2 * len + 1, rrvalue, arraysize(rrvalue)))
1858 for (i = 0; i < 2 * len; i++) {
1861 rr.value[2 * len] = 1;
1862 rr.len = 2 * len + 1;
1913 if ((err = big_init1(&tmp1, 2 * n->len + 1,
1924 if ((err = big_init1(&(apowers[i]), n->len, NULL, 0)) !=
2080 nlen = (BIG_CHUNK_SIZE / 32) * n->len;
2122 for (i = 0; i < ma->len; i++) {
2129 for (i = 0; i < ma->len; i++) {
2133 for (i = ma->len * 2; i < nlen; i++) {
2140 for (i = 0; i < n->len; i++) {
2147 for (i = 0; i < n->len; i++) {
2151 for (i = n->len * 2; i < nlen; i++) {
2166 for (i = 0; i < tmp->len; i++) {
2173 for (i = 0; i < tmp->len; i++) {
2177 for (i = tmp->len * 2; i < nlen + 1; i++) {
2261 result->len = i + 1;
2308 if ((err = big_init1(&ma, n->len, mavalue, arraysize(mavalue))) !=
2312 ma.len = 1;
2315 if ((err = big_init1(&tmp, 2 * n->len + 1,
2324 if ((err = big_init1(&rr, 2 * n->len + 1,
2348 tmp.len = 1;
2365 ma.len = 1;
2399 if (p->len > q->len) {
2400 biglen = p->len;
2402 biglen = q->len;
2405 if ((err = big_init1(&ap, p->len, NULL, 0)) != BIG_OK) {
2408 if ((err = big_init1(&aq, q->len, NULL, 0)) != BIG_OK) {
2411 if ((err = big_init1(&tmp, biglen + q->len + 1, NULL, 0)) != BIG_OK) {
2418 alen = a->len;
2419 while ((alen > p->len) && (a->value[alen - 1] == 0)) {
2422 if (alen < p->len + q->len) {
2529 if ((err = big_init1(&t1, n->len + 1,
2532 if ((err = big_init1(&t2, n->len + 1,
2535 if ((err = big_init1(&t3, n->len + 1,
2538 if ((err = big_init1(&prod, n->len + 1,
2543 t1.len = t2.len = t3.len = (nrootbits - 1) / BIG_CHUNK_SIZE + 1;
2544 for (i = 0; i < t1.len; i++) {
2548 highbits = nrootbits - BIG_CHUNK_SIZE * (t1.len - 1);
2550 t1.value[t1.len - 1] = BIG_CHUNK_HIGHBIT;
2551 t2.value[t2.len - 1] = BIG_CHUNK_ALLBITS;
2553 t1.value[t1.len - 1] = (BIG_CHUNK_TYPE)1 << (highbits - 1);
2554 t2.value[t2.len - 1] = 2 * t1.value[t1.len - 1] - 1;
2614 int len, err;
2622 if (nn->len > mm->len) {
2623 len = nn->len;
2625 len = mm->len;
2628 if ((err = big_init1(&t1, len,
2632 if ((err = big_init1(&t2, len,
2636 if ((err = big_init1(&t3, len,
2709 if ((err = big_init1(&ki, k->len + 1,
2713 if ((err = big_init1(&tmp, 2 * n->len + 1,
2717 if ((err = big_init1(&tmp2, n->len,
2722 ki.len = (m - 1) / BIG_CHUNK_SIZE + 1;
2725 for (i = 0; i < ki.len; i++) {
2728 ki.value[ki.len - 1] = bit;
2811 if ((err = big_init1(&o, n->len, ovalue, arraysize(ovalue))) !=
2816 if ((err = big_init1(&nminus1, n->len,
2821 if ((err = big_init1(&tmp, 2 * n->len,
2826 if ((err = big_init1(&Lkminus1, n->len,
2831 if ((err = big_init1(&Lk, n->len,
3029 int len;
3032 len = m->len;
3034 len = e->len;
3037 if ((err = big_init1(&t1, len,
3041 if ((err = big_init1(&t2, len,
3045 if ((err = big_init1(&t3, len,
3049 if ((err = big_init1(&t4, len,
3053 if ((err = big_init1(&t5, len,
3057 if ((err = big_init1(&t6, len,
3061 if ((err = big_init1(&t7, len,
3065 if ((err = big_init1(&t8, len,
3070 if ((err = big_init1(&tmp, 2 * len,
3077 ri->len = 1;
3090 vei->len = 1;
3170 * Convert rlen bits to r->len words (32- or 64-bit), rbytes bytes
3178 r->len = rwords;
3180 r->len = (uint32_t)rwords;