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

version» Context lines:

pike.git/src/post_modules/Nettle/hash.cmod:1:   /* hash.cmod -*- c -*- */ - /* $Id: hash.cmod,v 1.26 2004/10/16 07:27:29 agehall Exp $ */ + /* $Id: hash.cmod,v 1.27 2005/12/12 20:51:40 nilsson Exp $ */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "threads.h"      /* For this_object() */   #include "object.h"   #include "module_support.h"   
pike.git/src/post_modules/Nettle/hash.cmod:115:    if (!meta)    Pike_error("HashInfo not properly initialized.\n");    NO_WIDE_STRING(in);       ctx = (void *)alloca(meta->context_size);    if(!ctx)    SIMPLE_OUT_OF_MEMORY_ERROR("hash", meta->context_size);       THREADS_ALLOW();    meta->init(ctx); -  meta->update(ctx, in->len, in->str); +  meta->update(ctx, in->len, (const uint8_t *)in->str);       digest_length = meta->digest_size;    out = begin_shared_string(digest_length); -  meta->digest(ctx, digest_length, out->str); +  meta->digest(ctx, digest_length, (uint8_t *)out->str);    THREADS_DISALLOW();       pop_n_elems(args);    push_string(end_shared_string(out));    }       /*! @decl string hash(Stdio.File file, void|int bytes)    *!    *! Works as a (faster) shortcut for    *! @expr{obj->update(Stdio.read_file(file))->digest()@}.
pike.git/src/post_modules/Nettle/hash.cmod:194:    read_buffer=(char *)malloc(8192);    if (!read_buffer)    SIMPLE_OUT_OF_MEMORY_ERROR("hash", 8192);       THREADS_ALLOW();    meta->init(ctx);    if(args==2 && bytes->u.integer>-1) {    int bytes_left = bytes->u.integer;    int read_bytes = MINIMUM(8192, bytes_left);    while(read_bytes>0 && (len=fd_read(fd, read_buffer, read_bytes))>0) { -  meta->update(ctx, len, read_buffer); +  meta->update(ctx, len, (const uint8_t *)read_buffer);    bytes_left -= read_bytes;    read_bytes = MINIMUM(8192, bytes_left);    }    }    else    while((len=fd_read(fd, read_buffer, 8192))>0) -  meta->update(ctx, len, read_buffer); +  meta->update(ctx, len, (const uint8_t *)read_buffer);       free(read_buffer);       out = begin_shared_string(meta->digest_size); -  meta->digest(ctx, meta->digest_size, out->str); +  meta->digest(ctx, meta->digest_size, (uint8_t *)out->str);    THREADS_DISALLOW();       pop_n_elems(args);    push_string(end_shared_string(out));    }       INIT    {    werror("HashInfo->INIT\n");    THIS->meta = NULL;
pike.git/src/post_modules/Nettle/hash.cmod:256:    {    void *ctx = THIS->ctx;    const struct nettle_hash *meta =    GET_META(Pike_fp->current_object);       if (!ctx || !meta)    Pike_error("HashState not properly initialized.\n");       NO_WIDE_STRING(data);    THREADS_ALLOW(); -  meta->update(ctx, data->len, data->str); +  meta->update(ctx, data->len, (const uint8_t *)data->str);    THREADS_DISALLOW();       push_object(this_object());    }       /*! @decl string digest(int|void length)    *!    *! Generates a digests, and resets the hashing contents.    *!    *! @param length
pike.git/src/post_modules/Nettle/hash.cmod:300:    Pike_error("Bad argument type.\n");    if (arg->u.integer < 0)    Pike_error("Invalid length, must be positive.\n");    if ((unsigned)arg->u.integer > meta->digest_size)    Pike_error("Unsupported digest length.\n");       length = arg->u.integer;    }       digest = begin_shared_string(length); -  meta->digest(THIS->ctx, length, digest->str); +  meta->digest(THIS->ctx, length, (uint8_t *)digest->str);    push_string(end_shared_string(digest));    }       INIT    {    werror("HashState->INIT\n");    THIS->ctx = NULL;    }    EXIT    {