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.10 2003/08/06 00:50:16 nilsson Exp $"); + RCSID("$Id: nettle.cmod,v 1.11 2003/08/06 01:13:56 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:93:    PIKEFUN int(0..1) is_seeded()    {    RETURN yarrow256_is_seeded(THIS->ctx);    }       PIKEFUN void force_reseed()    {    yarrow256_force_reseed(THIS->ctx);    }    +  PIKEFUN int(0..1) update(string data, int source, int entropy) +  { +  NO_WIDE_STRING(data); +  if( !THIS->ctx->nsources ) +  Pike_error("This random generator has no sources.\n"); +  if( source<0 || source>=THIS->ctx->nsources ) +  Pike_error("Invalid random source.\n"); +  if( entropy<0 ) +  Pike_error("Entropy must be positive.\n"); +  RETURN yarrow256_update(THIS->ctx, source, entropy, data->len, data->str); +  } +     PIKEFUN int(0..) needed_sources()    {    RETURN yarrow256_needed_sources(THIS->ctx);    }       /*! @decl string random_string(int length)    *! Returns a pseudo-random string of the requested @[length].    */    PIKEFUN string random_string(int length)    {