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

version» Context lines:

pike.git/src/post_modules/Nettle/hash.cmod:126:    {    void *ctx;    struct pike_string *out;    unsigned digest_length;    const struct nettle_hash *meta = THIS->meta;       if (!meta)    Pike_error("Hash not properly initialized.\n");    NO_WIDE_STRING(in);    -  ctx = (void *)alloca(meta->context_size); +  ctx = alloca(meta->context_size);    if(!ctx)    SIMPLE_OUT_OF_MEMORY_ERROR("hash", meta->context_size);       /* Only thread this block for significant data size */    if (in->len > THREADS_ALLOW_THRESHOLD) {    THREADS_ALLOW();    meta->init(ctx);    meta->update(ctx, in->len, (const uint8_t *)in->str);    THREADS_DISALLOW();    } else {
pike.git/src/post_modules/Nettle/hash.cmod:204:    apply(in, "query_fd", 0);    fd = Pike_sp[-1].u.integer;    pop_stack();       if (fd_fstat(fd, &st)<0)    Pike_error("File not found!\n");       if (!S_ISREG(st.st_mode))    Pike_error("Non-regular file.\n");    -  ctx = (void *)alloca(meta->context_size); +  ctx = alloca(meta->context_size);    if (!ctx)    SIMPLE_OUT_OF_MEMORY_ERROR("hash", meta->context_size);    -  read_buffer=(char *)malloc(8192); -  if (!read_buffer) -  SIMPLE_OUT_OF_MEMORY_ERROR("hash", 8192); +  read_buffer=xalloc(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, (const uint8_t *)read_buffer);    bytes_left -= read_bytes;    read_bytes = MINIMUM(8192, bytes_left);
pike.git/src/post_modules/Nettle/hash.cmod:296:       if (!rounds) rounds = 5000;    if (rounds < 1000) rounds = 1000;    if (rounds > 999999999) rounds = 999999999;       NO_WIDE_STRING(password);    NO_WIDE_STRING(salt);       password->flags |= STRING_CLEAR_ON_EXIT;    -  ctx = (void *)alloca(meta->context_size); +  ctx = alloca(meta->context_size);    if (!ctx)    SIMPLE_OUT_OF_MEMORY_ERROR("crypt_hash", meta->context_size);    -  abcbuf = (uint8_t *)alloca(meta->digest_size * 3); +  abcbuf = alloca(meta->digest_size * 3);    if (!abcbuf)    SIMPLE_OUT_OF_MEMORY_ERROR("crypt_hash", meta->digest_size * 3);       dpbuf = abcbuf + meta->digest_size;    dsbuf = dpbuf + meta->digest_size;       /* NB: We use these to allow the compiler to    * avoid dereferencing at every step.    */    p = (unsigned char*)password->str;