]> git.rm.cloudns.org Git - xonotic/d0_blind_id.git/commitdiff
fix usage of some functions
authorRudolf Polzer <divverent@xonotic.org>
Fri, 29 Apr 2011 12:24:32 +0000 (14:24 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 29 Apr 2011 12:24:32 +0000 (14:24 +0200)
d0_bignum-tommath.c
main.c

index 414d5af95cc602c019d4adf003e3836a9cd37948..40deef8e852bd9b96f506b7f630371e58d2cf82d 100644 (file)
@@ -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 bc39797db4b1b58face52be4a098119836279cc4..2be45cb16422aa4b1ec680ad21d39a636631f957 100644 (file)
--- 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))