pike.git
/
src
/
post_modules
/
Nettle
/
nettle.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/post_modules/Nettle/nettle.cmod:97:
THIS->sources = xalloc(sizeof(struct yarrow_source)*num); } else { free (THIS->sources); THIS->sources = NULL; } yarrow256_init(&THIS->ctx, num, THIS->sources); }
-
/*! @decl Yarrow seed(string data)
+
/*! @decl Yarrow seed(string
(0..255)
data)
*! *! The random generator needs to be seeded before it can be used. *! The seed must be at least 32 characters long. The seed could be *! stored from a previous run by inserting the value returned from *! @[get_seed]. *! *! @returns *! Returns the called object. *! @seealso *! @[min_seed_size], @[get_seed], @[is_seeded] */
-
PIKEFUN object seed(string data)
+
PIKEFUN object seed(string
(0..255)
data)
optflags OPT_SIDE_EFFECT; { if(data->len < YARROW256_SEED_FILE_SIZE) Pike_error("Seed must be at least %d characters.\n", YARROW256_SEED_FILE_SIZE); NO_WIDE_STRING(data); yarrow256_seed(&THIS->ctx, data->len, STR0(data)); pike_generate_seed_file(); RETURN this_object();
pike.git/src/post_modules/Nettle/nettle.cmod:205:
* functions yarrow256_fast_reseed and yarrow256_slow_reseed, * which were previously static. */ yarrow256_slow_reseed(&THIS->ctx); #else yarrow256_force_reseed(&THIS->ctx); #endif pike_generate_seed_file(); }
-
/*! @decl int(0..1) update(string data, int source, int entropy)
+
/*! @decl int(0..1) update(string
(0..255)
data, int source, int entropy)
*! Inject additional entropy into the random number generator. *! *! @seealso *! @[create] */
-
PIKEFUN int(0..1) update(string data, int source, int entropy)
+
PIKEFUN int(0..1) update(string
(0..255)
data, int source, int entropy)
optflags OPT_SIDE_EFFECT; { int ret; /* FIXME: Wide strings could actually be supported here */ NO_WIDE_STRING(data); if( !THIS->sources ) Pike_error("This random generator has no sources.\n"); if( source<0 || (unsigned)source>=THIS->ctx.nsources ) Pike_error("Invalid random source.\n"); if( entropy<0 )
pike.git/src/post_modules/Nettle/nettle.cmod:278:
if( THIS->sources ) { free(THIS->sources); } } } /*! @endclass */
-
/*! @decl string(0..127) crypt_md5(string password, string salt,@
-
*! void|string magic)
+
/*! @decl string(0..127) crypt_md5(string
(0..255)
password,
@
+
*!
string
(0..255)
salt,@
+
*! void|string
(0..255)
magic)
*! Does the crypt_md5 abrakadabra (MD5 + snakeoil). It is assumed *! that @[salt] does not contain "$". *! *! The @[password] memory will be cleared before released. */
-
PIKEFUN string(0..127) crypt_md5(string pw, string salt, void|string magic)
+
PIKEFUN string(0..127) crypt_md5(string
(0..255)
pw, string
(0..255)
salt,
+
void|string
(0..255)
magic)
optflags OPT_TRY_OPTIMIZE; { char *hash; NO_WIDE_STRING(pw); NO_WIDE_STRING(salt); pw->flags |= STRING_CLEAR_ON_EXIT; if(!magic) { hash = pike_crypt_md5(pw->len, pw->str, salt->len, salt->str, 3, "$1$"); } else {
-
+
NO_WIDE_STRING(magic);
hash = pike_crypt_md5(pw->len, pw->str, salt->len, salt->str, magic->len, magic->str); } push_text(hash); } #if 0 /* @class LFib
pike.git/src/post_modules/Nettle/nettle.cmod:356:
} /* Get one 32bit pseudorandom integer. */ PIKEFUN int get() { RETURN knuth_lfib_get(THIS->ctx); } /* Get a pseudorandom string of length @[len]. */
-
PIKEFUN string get_string(int len) {
+
PIKEFUN string
(0..255)
get_string(int len) {
struct pike_string *s = begin_shared_string(len); knuth_lfib_random(THIS->ctx, len, s->str); push_string(end_shared_string(s)); } } /* @endclass */ #endif