pike.git
/
src
/
post_modules
/
Nettle
/
hogweed.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/post_modules/Nettle/hogweed.cmod:15:
DECLARATIONS #include "nettle.h" #include <nettle/dsa.h> #include <nettle/rsa.h> #include <gmp.h> #include "bignum.h"
-
void random_func_wrapper(void *f,
unsigned
int
num, uint8_t *out)
+
void random_func_wrapper(void *f,
size_t
num, uint8_t *out)
{ push_int(num); apply_svalue((struct svalue *)f, 1); if(TYPEOF(Pike_sp[-1])!=T_STRING) Pike_error("Random function did not return string value.\n");
-
if(Pike_sp[-1].u.string->len != num)
+
if(Pike_sp[-1].u.string->len !=
(unsigned int)
num)
Pike_error("Random function did not return correct number of bytes.\n"); memcpy(out, Pike_sp[-1].u.string->str, num); pop_stack(); } /*! @decl array(object(Gmp.mpz)) @ *! dsa_generate_keypair(int p_bits, int q_bits, @ *! function(int:string(0..255)) rnd) *! *! Generates a DSA key pair with @[p_bits] number of bits (sometimes
pike.git/src/post_modules/Nettle/hogweed.cmod:210:
ecc_scalar_init(&s, THIS->curve); ecc_scalar_random(&s, rnd, random_func_wrapper); push_object(ret = fast_clone_object(get_auto_bignum_program())); ecc_scalar_get(&s, (mpz_ptr)ret->storage); ecc_scalar_clear(&s); }
-
/*! @decl array(Gmp.mpz) `*(Gmp.
moz
|int scalar)
+
/*! @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. *! *! @returns *! Returns a new point (x, y) on the curve. */ PIKEFUN array(object(Gmp.mpz)) `*(object(Gmp.mpz)|int scalar) {