Branch: Tag:

2003-08-06

2003-08-06 01:13:56 by Martin Nilsson <mani@lysator.liu.se>

Added yarrow update function.

Rev: src/post_modules/Nettle/nettle.cmod:1.11

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() */
100:    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);