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

version» Context lines:

pike.git/src/post_modules/Nettle/nettle.cmod:300:       /*! @decl string(8bit) random_string(int(0..) len)    *!    *! Generates @[len] amount of pseudo random data. In contrast with    *! the Fortuna PseudoRandomData function, which only allows 2^20    *! bytes of random data per call, the necessary rekey operations    *! are here performed internally, so no such restrictions apply.    */    PIKEFUN string(8bit) random_string(int len)    { -  unsigned stored = 0; +  int stored = 0;    struct string_builder s;       if(len<0) Pike_error("Length has to be positive.\n");    init_string_builder_alloc(&s, len+16, 0);       while( stored < len )    {    fortuna_generate();    string_builder_binary_strcat(&s, (const char *)THIS->data,    MINIMUM(16, (len-stored)));