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

version» Context lines:

pike.git/src/post_modules/Nettle/nettle.cmod:81:    *! during instantiation.    *! @seealso    *! @[update]    */    PIKEFUN void create(void|int arg)    flags ID_PROTECTED;    {    INT32 num = 0;       if(arg) { -  if (arg->type != PIKE_T_INT) +  if (TYPEOF(*arg) != PIKE_T_INT)    Pike_error("Bad argument type.\n");    num = arg->u.integer;    if(num < 0)    Pike_error("Invalid number of sources.\n");    free (THIS->sources);    THIS->sources = xalloc(sizeof(struct yarrow_source)*num);    }    else    {    free (THIS->sources);
pike.git/src/post_modules/Nettle/nettle.cmod:308:    }    return 0;   }      static struct object *make_cipher_object(INT32 args) {    ptrdiff_t fun;    const char *missing;    struct svalue *top = Pike_sp-args;    struct object *obj;    -  switch(top->type) +  switch(TYPEOF(*top))    {    case T_PROGRAM:    obj = clone_object(top->u.program, args-1);    break;       case T_FUNCTION:    apply_svalue(Pike_sp - args, args-1);       /* Check return value */ -  if(Pike_sp[-1].type != T_OBJECT) +  if(TYPEOF(Pike_sp[-1]) != T_OBJECT)    Pike_error("Returned value is not an object.\n");       add_ref(obj = Pike_sp[-1].u.object);    break;       case T_OBJECT:    fun = -1;    missing = assert_is_crypto_object(top->u.object->prog,    crypto_functions);    if(missing)
pike.git/src/post_modules/Nettle/nettle.cmod:400:    {    INT32 block_size = THIS->block_size;    INT32 i;       for(i=0; i < block_size; i++)    THIS->iv[i] ^= source[i];       push_string(make_shared_binary_string((INT8 *)THIS->iv, block_size));    safe_apply(THIS->object, "crypt", 1);    -  if(Pike_sp[-1].type != T_STRING) +  if(TYPEOF(Pike_sp[-1]) != T_STRING)    Pike_error("Expected string from crypt()\n");       if(Pike_sp[-1].u.string->len != block_size) {    Pike_error("Bad string length %ld returned from crypt()\n",    DO_NOT_WARN((long)Pike_sp[-1].u.string->len));    }    MEMCPY(THIS->iv, Pike_sp[-1].u.string->str, block_size);    MEMCPY(dest, Pike_sp[-1].u.string->str, block_size);    pop_stack();    }       INLINE static void cbc_decrypt_step(const unsigned INT8 *const source,    unsigned INT8 *dest)    {    INT32 block_size = THIS->block_size;    INT32 i;       push_string(make_shared_binary_string((const INT8 *)source, block_size));    safe_apply(THIS->object, "crypt", 1);    -  if(Pike_sp[-1].type != T_STRING) +  if(TYPEOF(Pike_sp[-1]) != T_STRING)    Pike_error("Expected string from crypt()\n");       if(Pike_sp[-1].u.string->len != block_size) {    Pike_error("Bad string length %ld returned from crypt()\n",    DO_NOT_WARN((long)Pike_sp[-1].u.string->len));    }       for(i=0; i < block_size; i++)    dest[i] = THIS->iv[i] ^ Pike_sp[-1].u.string->str[i];   
pike.git/src/post_modules/Nettle/nettle.cmod:451:    *! that function will be called with @[args] as arguments.    */    PIKEFUN void create(program|object|function cipher, mixed ... more)    flags ID_PROTECTED;    {    int old_block_size = THIS->block_size;    THIS->object = make_cipher_object(args);       safe_apply(THIS->object, "block_size", 0);    -  if(Pike_sp[-1].type != T_INT) +  if(TYPEOF(Pike_sp[-1]) != T_INT)    Pike_error("block_size() didn't return an int.\n");       THIS->block_size = Pike_sp[-1].u.integer;       pop_stack();       if ((!THIS->block_size) ||    (THIS->block_size > 4096))    Pike_error("Bad block size %d.\n", THIS->block_size);   
pike.git/src/post_modules/Nettle/nettle.cmod:633:    *! an @[LFUN::`()], that LFUN will be called. If it is a function,    *! that function will be called with @[args] as arguments.    */    PIKEFUN void create(program|object|function cipher, mixed ... more)    flags ID_PROTECTED;    {    exit_Proxy_struct();    THIS->object = make_cipher_object(args);       safe_apply(THIS->object, "block_size", 0); -  if (Pike_sp[-1].type != T_INT) +  if (TYPEOF(Pike_sp[-1]) != T_INT)    Pike_error("block_size() didn't return an int\n");    THIS->block_size = Pike_sp[-1].u.integer;       pop_stack();       if ((!THIS->block_size) ||    (THIS->block_size > 4096))    Pike_error("Bad block size %ld\n", DO_NOT_WARN((long)THIS->block_size));       THIS->backlog = (unsigned char *)xalloc(THIS->block_size);
pike.git/src/post_modules/Nettle/nettle.cmod:743:       if (THIS->backlog_len) {    if (data->len >= (THIS->block_size - THIS->backlog_len)) {    MEMCPY(THIS->backlog + THIS->backlog_len, data->str,    (THIS->block_size - THIS->backlog_len));    soffset += (THIS->block_size - THIS->backlog_len);    THIS->backlog_len = 0;    push_string(make_shared_binary_string((char *)THIS->backlog,    THIS->block_size));    safe_apply(THIS->object, "crypt", 1); -  if (Pike_sp[-1].type != T_STRING) +  if (TYPEOF(Pike_sp[-1]) != T_STRING)    Pike_error("crypt() did not return string\n");    if (Pike_sp[-1].u.string->len != THIS->block_size)    Pike_error("Unexpected string length %ld\n",    DO_NOT_WARN((long)Pike_sp[-1].u.string->len));       MEMCPY(result, Pike_sp[-1].u.string->str, THIS->block_size);    roffset = THIS->block_size;    pop_stack();    MEMSET(THIS->backlog, 0, THIS->block_size);    } else {
pike.git/src/post_modules/Nettle/nettle.cmod:774:    len = (Pike_sp[-1].u.string->len - soffset);    len -= len % THIS->block_size;       if (len) {    push_string(make_shared_binary_string(Pike_sp[-1].u.string->str +    soffset, len));    soffset += len;       safe_apply(THIS->object, "crypt", 1);    -  if (Pike_sp[-1].type != T_STRING) +  if (TYPEOF(Pike_sp[-1]) != T_STRING)    Pike_error("crypt() did not return string.\n");    if (Pike_sp[-1].u.string->len != len)    Pike_error("crypt() Unexpected string length %ld.\n",    DO_NOT_WARN((long)Pike_sp[-1].u.string->len));       MEMCPY(result + roffset, Pike_sp[-1].u.string->str, len);       pop_stack();    }   
pike.git/src/post_modules/Nettle/nettle.cmod:823:    *! @seealso    *! @[unpad()]    */    PIKEFUN string pad(void|int method) {    ptrdiff_t i;    int m = 0;    int size = THIS->block_size - THIS->backlog_len;       if(method)    { -  if(method->type != PIKE_T_INT) +  if(TYPEOF(*method) != PIKE_T_INT)    Pike_error("Bad argument type.\n");    m = method->u.integer;    }       switch(m)    {    case 0:    size--;    break;    case 4:
pike.git/src/post_modules/Nettle/nettle.cmod:913:    Pike_error("String must be integral numbers of blocks.\n");       if( method!=NULL )    {    m = method->u.integer;    pop_stack();    args--;    }       safe_apply(THIS->object, "crypt", 1); -  if (Pike_sp[-1].type != T_STRING) +  if (TYPEOF(Pike_sp[-1]) != T_STRING)    Pike_error("crypt() did not return string.\n");    if (Pike_sp[-1].u.string->len != len)    Pike_error("crypt() Unexpected string length %ld.\n",    DO_NOT_WARN((long)Pike_sp[-1].u.string->len));    str = Pike_sp[-1].u.string;       if( m==0 )    {    if (str->str[len - 1]+1 > THIS->block_size)    Pike_error("Invalid padding (%d > %d)\n",