pike.git
/
src
/
post_modules
/
Nettle
/
hogweed.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/post_modules/Nettle/hogweed.cmod:19:
#include "nettle.h" #include <nettle/dsa.h> #include <nettle/rsa.h> #include <gmp.h> #include "bignum.h" /*! @module Nettle */
-
static void random_func_wrapper(void *f,
unsigned
int
num, uint8_t *out)
+
static void random_func_wrapper(void *f,
size_t
num, uint8_t *out)
{ push_int(num); apply_svalue((struct svalue *)f, 1); if(TYPEOF(Pike_sp[-1])!=T_STRING) Pike_error("Random function did not return string value.\n"); if(Pike_sp[-1].u.string->len != (unsigned int)num) Pike_error("Random function did not return correct number of bytes.\n"); memcpy(out, Pike_sp[-1].u.string->str, num); pop_stack(); }
pike.git/src/post_modules/Nettle/hogweed.cmod:199:
{ int i, pad=0, nonpad=0, pos=0; unsigned char *str; NO_WIDE_STRING(data); /* Indata is smaller than minimum size, so we can exit immediately without timing issue. 1 type + 8 padding + 1 delimiter + 1 value = 11 bytes. */ if(data->len < 11 ) RETURN 0;
-
str = data->str + data->len - 1;
+
str =
(unsigned char*)
data->str + data->len - 1;
for(i=data->len-1; i>0; i--,str--) { switch(*str) { case 0: pos=i; break; case 0xff: pad=i; break; default: nonpad=i; break; } }