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

version» Context lines:

pike.git/src/post_modules/Nettle/hogweed.cmod:2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information.   */      #include "global.h"   #include "builtin_functions.h"   #include "operators.h"   #include "interpret.h"   #include "module.h" + #include "mapping.h" + #include "constants.h"      #include "nettle_config.h"      #ifdef HAVE_LIBHOGWEED      DECLARATIONS      #include "nettle.h"   #include <nettle/dsa.h>   #include <nettle/rsa.h>
pike.git/src/post_modules/Nettle/hogweed.cmod:880:       PIKEVAR function(int(0..):string(0..255)) random    flags ID_PROTECTED;       INIT    {    const struct ecc_curve *curve =    (((const struct Nettle_ECC_Curve_struct *)parent_storage(1, Nettle_ECC_Curve_program))->curve);    if (!curve) Pike_error("No curve selected.\n");    ecc_scalar_init(&THIS->key, curve); -  push_constant_text("Crypto.Random.random_string"); -  APPLY_MASTER("resolv",1); -  assign_svalue(&THIS->random, Pike_sp-1); -  pop_stack(); +  +  struct svalue *random = +  simple_mapping_string_lookup(get_builtin_constants(), "random_string"); +  if(!random || (TYPEOF(*random) != T_FUNCTION)) +  Pike_error("Unable to resolve random function.\n"); +  assign_svalue(&THIS->random, random);    }       EXIT    {    const struct ecc_curve *curve =    (((const struct Nettle_ECC_Curve_struct *)parent_storage(1, Nettle_ECC_Curve_program))->curve);    if (!curve) return;    ecc_scalar_clear(&THIS->key);    }