if(r == a)
return r; // trivial
if(!r) r = d0_bignum_new(); if(!r) return NULL;
- mp_copy(&r->z, &a->z);
+ mp_copy(&a->z, &r->z);
return r;
}
d0_bignum_t *d0_bignum_shl(d0_bignum_t *r, const d0_bignum_t *a, ssize_t n)
{
- r = d0_bignum_mov(r, a);
+ if(!r) r = d0_bignum_new(); if(!r) return NULL;
if(n > 0)
- mp_mul_2d(&r->z, n, &r->z);
+ mp_mul_2d(&a->z, n, &r->z);
else if(n < 0)
- mp_div_2d(&r->z, -n, &r->z, NULL);
+ mp_div_2d(&a->z, -n, &r->z, NULL);
+ else
+ mp_copy(&a->z, &r->z);
return r;
}
ctx_other = d0_blind_id_new();
printf("keygen RSA...\n");
- if(!d0_blind_id_generate_private_key(ctx_self, 1024))
+ if(!d0_blind_id_generate_private_key(ctx_self, 256))
errx(1, "keygen fail");
buf2size = sizeof(buf2) - 1;
if(!d0_blind_id_fingerprint64_public_key(ctx_self, buf2, &buf2size))