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.
39
2004
/
10
/
22
22
:
42
:
10
nilsson Exp $ */
+
/* $Id: nettle.cmod,v 1.
40
2005
/
01
/
27
19
:
15
:
01
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:229:
static const char *crypto_functions[] = { "block_size", "key_size", "set_encrypt_key", "set_decrypt_key", "crypt", 0 };
-
static const char *
assert_is_crypto_object(struct program *p,
-
const char **required) {
+
static const char *assert_is_crypto_object(struct program *p,
+
const char *
const
*required) {
while (*required) { if (find_identifier( (char *) *required, p) < 0) return *required; required++; } return 0; } static struct object *make_cipher_object(INT32 args) { ptrdiff_t fun;
pike.git/src/post_modules/Nettle/nettle.cmod:323:
EXIT { if(THIS->object) free_object(THIS->object); if(THIS->iv) { MEMSET(THIS->iv, 0, THIS->block_size); free(THIS->iv); } THIS->iv = 0; }
-
INLINE static void cbc_encrypt_step(const unsigned INT8 *source,
+
INLINE static void cbc_encrypt_step(const unsigned INT8 *
const
source,
unsigned INT8 *dest) { INT32 block_size = THIS->block_size; INT32 i; for(i=0; i < block_size; i++) THIS->iv[i] ^= source[i]; push_string(make_shared_binary_string((INT8 *)THIS->iv, block_size)); safe_apply(THIS->object, "crypt", 1);
pike.git/src/post_modules/Nettle/nettle.cmod:347:
if(Pike_sp[-1].u.string->len != block_size) { Pike_error("Bad string length %ld returned from crypt()\n", DO_NOT_WARN((long)Pike_sp[-1].u.string->len)); } MEMCPY(THIS->iv, Pike_sp[-1].u.string->str, block_size); MEMCPY(dest, Pike_sp[-1].u.string->str, block_size); pop_stack(); }
-
INLINE static void cbc_decrypt_step(const unsigned INT8 *source,
+
INLINE static void cbc_decrypt_step(const unsigned INT8 *
const
source,
unsigned INT8 *dest) { INT32 block_size = THIS->block_size; INT32 i; push_string(make_shared_binary_string((const INT8 *)source, block_size)); safe_apply(THIS->object, "crypt", 1); if(Pike_sp[-1].type != T_STRING) Pike_error("Expected string from crypt()\n");