pike.git / src / post_modules / Nettle / nettle.cmod

version» Context lines:

pike.git/src/post_modules/Nettle/nettle.cmod:1:   /* nettle.cmod -*- c -*- */      #include "global.h" - RCSID("$Id: nettle.cmod,v 1.20 2003/11/25 23:30:40 nilsson Exp $"); + RCSID("$Id: nettle.cmod,v 1.21 2003/12/05 07:00:23 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:296:    DO_NOT_WARN((long)Pike_sp[-1].u.string->len));    }       for(i=0; i < block_size; i++)    dest[i] = THIS->iv[i] ^ Pike_sp[-1].u.string->str[i];       pop_stack();    MEMCPY(THIS->iv, source, block_size);    }    -  /*! @decl void create(program|object algorithm, mixed ... args) +  /*! @decl void create(program|object|function algorithm, mixed ... args)    */ -  PIKEFUN void create(program|object algorithm, mixed ... more) { +  PIKEFUN void create(program|object|function algorithm, mixed ... more) { +  ptrdiff_t fun;       switch(algorithm->type)    {    case T_PROGRAM:    THIS->object = clone_object(algorithm->u.program, args-1);    break; -  +     case T_FUNCTION:    apply_svalue(Pike_sp - args, args-1);       /* Check return value */    if(Pike_sp[-1].type != T_OBJECT)    Pike_error("Returned value is not an object.\n");       add_ref(THIS->object = Pike_sp[-1].u.object);    break; -  +     case T_OBJECT: -  +  fun = FIND_LFUN(algorithm->u.object->prog, LFUN_CALL); +  if(fun!=-1) { +  apply_low(algorithm->u.object, fun, args-1); +  stack_swap(); +  pop_stack(); +  } +  else    if(args!=1) Pike_error("Too many arguments.\n"); -  +     add_ref(THIS->object = algorithm->u.object);    break;    default: -  SIMPLE_BAD_ARG_ERROR("CBC->create", 1, "program|object"); +  SIMPLE_BAD_ARG_ERROR("CBC->create", 1, "program|object|function");    }       pop_stack(); /* Just one element left on the stack in all cases */       assert_is_crypto_object(THIS->object->prog, crypto_functions);       safe_apply(THIS->object, "block_size", 0);       if(Pike_sp[-1].type != T_INT)    Pike_error("block_size() didn't return an int.\n");