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:1:
/* nettle.cmod -*- c -*- */
-
/* $Id: nettle.cmod,v 1.
45
2008/
05
/
29
23
:
03
:
47
nilsson Exp $ */
+
/* $Id: nettle.cmod,v 1.
46
2008/
06
/
28
22
:
53
:
06
nilsson Exp $ */
#include "global.h" #include "interpret.h" #include "svalue.h" /* For this_object() */ #include "object.h" #include "operators.h" #include "module_support.h" #include "threads.h"
pike.git/src/post_modules/Nettle/nettle.cmod:47:
CVAR struct yarrow_source *sources; /*! @decl void create(void|int sources) *! The number of entropy sources that will feed entropy to the *! random number generator is given as an argument to Yarrow *! during instantiation. *! @seealso *! @[update] */ PIKEFUN void create(void|int arg)
-
flags ID_
STATIC
;
+
flags ID_
PROTECTED
;
{ INT32 num = 0; if(arg) { if (arg->type != PIKE_T_INT) Pike_error("Bad argument type.\n"); num = arg->u.integer; if(num < 0) Pike_error("Invalid number of sources.\n"); free (THIS->sources);
pike.git/src/post_modules/Nettle/nettle.cmod:389:
} /*! @decl void create(program|object|function cipher, mixed ... args) *! Initialize the CBC wrapper with a cipher algorithm. If it is a *! program, an object will be instantiated with @[args] as arguments. *! If it is an object that doesn't conform to the cipher API, but has *! an @[LFUN::`()], that LFUN will be called. If it is a function, *! that function will be called with @[args] as arguments. */ PIKEFUN void create(program|object|function cipher, mixed ... more)
-
flags ID_
STATIC
;
+
flags ID_
PROTECTED
;
{ int old_block_size = THIS->block_size; THIS->object = make_cipher_object(args); safe_apply(THIS->object, "block_size", 0); if(Pike_sp[-1].type != T_INT) Pike_error("block_size() didn't return an int.\n"); THIS->block_size = Pike_sp[-1].u.integer;
pike.git/src/post_modules/Nettle/nettle.cmod:567:
} /*! @decl void create(program|object|function cipher, mixed ... args) *! Initialize the Proxy wrapper with a cipher algorithm. If it is a *! program, an object will be instantiated with @[args] as arguments. *! If it is an object that doesn't conform to the cipher API, but has *! an @[LFUN::`()], that LFUN will be called. If it is a function, *! that function will be called with @[args] as arguments. */ PIKEFUN void create(program|object|function cipher, mixed ... more)
-
flags ID_
STATIC
;
+
flags ID_
PROTECTED
;
{ THIS->object = make_cipher_object(args); safe_apply(THIS->object, "block_size", 0); if (Pike_sp[-1].type != T_INT) Pike_error("block_size() didn't return an int\n"); THIS->block_size = Pike_sp[-1].u.integer; pop_stack();
pike.git/src/post_modules/Nettle/nettle.cmod:827:
gc_trivial; { free(THIS->ctx); THIS->ctx = NULL; } /* @decl void create(int seed) * The Lfib generator must be seeded with a number. */ PIKEFUN void create(int seed)
-
flags ID_
STATIC
;
+
flags ID_
PROTECTED
;
{ knuth_lfib_init(THIS->ctx, seed); } /* @decl this_program reseed(int s) * Reseed this object with seed @[s]. * @return * Returns the current object. */ PIKEFUN object reseed(int s) {