From: Rudolf Polzer Date: Fri, 29 Apr 2011 12:24:32 +0000 (+0200) Subject: fix usage of some functions X-Git-Tag: xonotic-v0.5.0~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1eb0e54368ace344ba773a53b10f6eb2d4c20709;p=xonotic%2Fd0_blind_id.git fix usage of some functions --- diff --git a/d0_bignum-tommath.c b/d0_bignum-tommath.c index 414d5af..40deef8 100644 --- a/d0_bignum-tommath.c +++ b/d0_bignum-tommath.c @@ -312,7 +312,7 @@ d0_bignum_t *d0_bignum_mov(d0_bignum_t *r, const d0_bignum_t *a) 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; } @@ -325,11 +325,13 @@ d0_bignum_t *d0_bignum_neg(d0_bignum_t *r, const d0_bignum_t *a) 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; } diff --git a/main.c b/main.c index bc39797..2be45cb 100644 --- a/main.c +++ b/main.c @@ -83,7 +83,7 @@ int main(int argc, char **argv) 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))