pike.git / src / post_modules / Nettle / hogweed.cmod

version» Context lines:

pike.git/src/post_modules/Nettle/hogweed.cmod:430:    {    struct ecc_scalar s;    struct object *ret;       if (!THIS->curve) Pike_error("No curve defined.\n");       ecc_scalar_init(&s, THIS->curve);       ecc_scalar_random(&s, rnd, random_func_wrapper);    -  push_object(ret = fast_clone_object(get_auto_bignum_program())); +  push_object(ret = fast_clone_object(bignum_program));    ecc_scalar_get(&s, (mpz_ptr)ret->storage);       ecc_scalar_clear(&s);    }       /*! @decl array(Gmp.mpz) `*(Gmp.mpz|int scalar)    *!    *! Multiply the curve by a scalar.    *!    *! This can be used to get the public key from a private key.
pike.git/src/post_modules/Nettle/hogweed.cmod:466:    ecc_scalar_init(&s, THIS->curve);    ecc_point_init(&r, THIS->curve);       if (!ecc_scalar_set(&s, (mpz_srcptr)scalar->u.object->storage)) {    ecc_scalar_clear(&s);    ecc_point_clear(&r);    SIMPLE_ARG_ERROR("`*", 1, "Invalid scalar for curve.");    }       ecc_point_mul_g(&r, &s); -  push_object(x = fast_clone_object(get_auto_bignum_program())); -  push_object(y = fast_clone_object(get_auto_bignum_program())); +  push_object(x = fast_clone_object(bignum_program)); +  push_object(y = fast_clone_object(bignum_program));    ecc_point_get(&r, (mpz_ptr)x->storage, (mpz_ptr)y->storage);       ecc_scalar_clear(&s);    ecc_point_clear(&r);       f_aggregate(2);    }       /*! @decl array(Gmp.mpz) point_mul(Gmp.mpz|int x, Gmp.mpz|int y, @    *! Gmp.mpz|int scalar)
pike.git/src/post_modules/Nettle/hogweed.cmod:523:    if (!ecc_scalar_set(&s, (mpz_srcptr)scalar->u.object->storage)) {    ecc_scalar_clear(&s);    ecc_point_clear(&p);    SIMPLE_ARG_ERROR("point_mul", 3, "Invalid scalar for curve.");    }       ecc_point_init(&r, THIS->curve);       ecc_point_mul(&r, &s, &p);    -  push_object(rx = fast_clone_object(get_auto_bignum_program())); -  push_object(ry = fast_clone_object(get_auto_bignum_program())); +  push_object(rx = fast_clone_object(bignum_program)); +  push_object(ry = fast_clone_object(bignum_program));    ecc_point_get(&r, (mpz_ptr)rx->storage, (mpz_ptr)ry->storage);       ecc_point_clear(&r);    ecc_scalar_clear(&s);    ecc_point_clear(&p);       f_aggregate(2);    stack_pop_n_elems_keep_top(args);    }   
pike.git/src/post_modules/Nettle/hogweed.cmod:607:    ref_push_object_inherit(loc.o, loc.inherit - loc.o->prog->inherits);    }       /*! @decl Gmp.mpz get_private_key()    *!    *! Get the private key.    */    PIKEFUN object(Gmp.mpz) get_private_key()    {    struct object *ret; -  push_object(ret = fast_clone_object(get_auto_bignum_program())); +  push_object(ret = fast_clone_object(bignum_program));    ecc_scalar_get(&THIS->key, (mpz_ptr)ret->storage);    }       /*! @decl void set_private_key(object(Gmp.mpz)|int k)    *!    *! Set the private key (and corresponding private key).    *!    *! @note    *! Throws errors if the key isn't valid for the curve.    */
pike.git/src/post_modules/Nettle/hogweed.cmod:638:    /*! @decl object(Gmp.mpz) get_x()    *!    *! Get the x coordinate of the public key.    *!    *! @seealso    *! @[get_y()]    */    PIKEFUN object(Gmp.mpz) get_x()    {    struct object *ret; -  push_object(ret = fast_clone_object(get_auto_bignum_program())); +  push_object(ret = fast_clone_object(bignum_program));    ecc_point_get(&THIS->pub, (mpz_ptr)ret->storage, NULL);    }       /*! @decl object(Gmp.mpz) get_y()    *!    *! Get the y coordinate of the public key.    *!    *! @seealso    *! @[get_x()]    */    PIKEFUN object(Gmp.mpz) get_y()    {    struct object *ret; -  push_object(ret = fast_clone_object(get_auto_bignum_program())); +  push_object(ret = fast_clone_object(bignum_program));    ecc_point_get(&THIS->pub, NULL, (mpz_ptr)ret->storage);    }       /*! @decl void set_public_key(object(Gmp.mpz)|int x, object(Gmp.mpz)|int y)    *!    *! Change to the selected point on the curve as public key.    *!    *! @note    *! Throws errors if the point isn't on the curve.    */