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

version» Context lines:

pike.git/src/post_modules/Nettle/hash.cmod:1:   /* -*- c -*-   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: hash.cmod,v 1.34 2010/06/21 12:23:15 mast Exp $ + || $Id: hash.cmod,v 1.35 2010/06/21 12:35:35 mast 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:121:    const struct nettle_hash *meta = THIS->meta;       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(); */ +  THREADS_ALLOW();    meta->init(ctx);    meta->update(ctx, in->len, (const uint8_t *)in->str); -  +  THREADS_DISALLOW();       digest_length = meta->digest_size;    out = begin_shared_string(digest_length);    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{HashState()->update(Stdio.read_file(file))->digest()@},    *! where HashState is the hash state class corresponding to this
pike.git/src/post_modules/Nettle/hash.cmod:228:    bytes_left -= read_bytes;    read_bytes = MINIMUM(8192, bytes_left);    }    }    else    while((len=fd_read(fd, read_buffer, 8192))>0)    meta->update(ctx, len, (const uint8_t *)read_buffer);       free(read_buffer);    +  THREADS_DISALLOW();    out = begin_shared_string(meta->digest_size);    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;    }