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

version» Context lines:

pike.git/src/post_modules/Nettle/nettle.cmod:1:   /* nettle.cmod -*- c -*- */      #include "global.h" - RCSID("$Id: nettle.cmod,v 1.36 2004/03/24 00:08:30 nilsson Exp $"); + RCSID("$Id: nettle.cmod,v 1.37 2004/05/19 00:04:08 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   /* For this_object() */   #include "object.h"   #include "operators.h"   #include "module_support.h"   #include "threads.h"      #include "nettle_config.h"   
pike.git/src/post_modules/Nettle/nettle.cmod:490:    */    PIKEFUN string crypt(string data) {    unsigned INT8 *result;    INT32 offset = 0;       NO_WIDE_STRING(data);       if(data->len % THIS->block_size)    Pike_error("Data length not multiple of block size.\n");    if(!(result = alloca(data->len))) -  Pike_error("Out of memory.\n"); +  SIMPLE_OUT_OF_MEMORY_ERROR("crypt", data->len);       if(THIS->mode == 0) {    while (offset < data->len) {    cbc_encrypt_step((const unsigned INT8 *)data->str + offset,    result + offset);    offset += THIS->block_size;    }    }    else {    while (offset < data->len) {
pike.git/src/post_modules/Nettle/nettle.cmod:653:    *! data to en/decrypt a block, that will be done, and the result    *! returned. Any uncrypted data will be left in the buffer.    */    PIKEFUN string crypt(string data) {    unsigned char *result;    ptrdiff_t roffset = 0;    ptrdiff_t soffset = 0;    ptrdiff_t len;       if (!(result = alloca(data->len + THIS->block_size))) -  Pike_error("Out of memory\n"); +  SIMPLE_OUT_OF_MEMORY_ERROR("crypt", data->len + THIS->block_size);       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);