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

version» Context lines:

pike.git/src/post_modules/Nettle/hash.cmod:120:    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);    +  /* 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 { +  meta->init(ctx); +  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, (uint8_t *)out->str);       pop_n_elems(args);    push_string(end_shared_string(out));    }       /*! @decl string hash(Stdio.File file, void|int bytes)
pike.git/src/post_modules/Nettle/hash.cmod:277:    optflags OPT_SIDE_EFFECT;    {    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); +  +  /* Only thread this block for significant data size */ +  if (data->len > THREADS_ALLOW_THRESHOLD) {    THREADS_ALLOW();    meta->update(ctx, data->len, (const uint8_t *)data->str);    THREADS_DISALLOW(); -  +  } else { +  meta->update(ctx, data->len, (const uint8_t *)data->str); +  }       push_object(this_object());    }       /*! @decl string digest(int|void length)    *!    *! Generates a digests, and resets the hashing contents.    *!    *! @param length    *! If the length argument is provided, the digest is truncated