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 -*- */ #include "global.h"
-
RCSID("$Id: nettle.cmod,v 1.
25
2003/12/
14
00:
08
:
57
nilsson Exp $");
+
RCSID("$Id: nettle.cmod,v 1.
26
2003/12/
15
00:
00
:
35
nilsson Exp $");
#include "interpret.h" #include "svalue.h" /* For this_object() */ #include "object.h" #include "module_support.h" #include "nettle_config.h" #ifdef HAVE_LIBNETTLE
pike.git/src/post_modules/Nettle/nettle.cmod:385:
if ((!THIS->block_size) || (THIS->block_size > 4096)) Pike_error("Bad block size %d.\n", THIS->block_size); THIS->iv = (unsigned INT8 *)xalloc(THIS->block_size); MEMSET(THIS->iv, 0, THIS->block_size); } /*! @decl string name()
-
*! Returns the string @expr{"CBC"@}.
+
*! Returns the string @expr{"CBC
(x)
"@}
where x is the
+
*! encapsulated algorithm
.
*/ PIKEFUN string name() {
-
push_constant_text("CBC");
+
push_constant_text("CBC
(
");
+
safe_apply(THIS->object, "name", 0);
+
push_constant_text(")");
+
f_add(3);
} /*! @decl int block_size() *! Reurns the block size of the encapsulated cipher. */ PIKEFUN int block_size() { RETURN THIS->block_size; } /*! @decl int key_size()
pike.git/src/post_modules/Nettle/nettle.cmod:504:
EXIT { if(THIS->backlog) { MEMSET(THIS->backlog, 0, THIS->block_size); free(THIS->backlog); } if(THIS->object) free_object(THIS->object); } /*! @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) { 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:525:
if ((!THIS->block_size) || (THIS->block_size > 4096)) Pike_error("Bad block size %ld\n", DO_NOT_WARN((long)THIS->block_size)); THIS->backlog = (unsigned char *)xalloc(THIS->block_size); THIS->backlog_len = 0; MEMSET(THIS->backlog, 0, THIS->block_size); } /*! @decl string name()
+
*! Returns the string @expr{"CBC(x)"@} where x is the
+
*! encapsulated algorithm.
*/ PIKEFUN string name() {
-
push_constant_text("Proxy");
+
push_constant_text("Proxy
(
");
+
safe_apply(THIS->object, "name", 0);
+
push_constant_text(")");
+
f_add(3);
} /*! @decl int block_size() *! *! Get the block size of the contained block crypto. */ PIKEFUN int block_size() { RETURN THIS->block_size; }