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

version» Context lines:

pike.git/src/post_modules/Nettle/hash.cmod:1:   /* hash.cmod -*- c -*- */      #include "global.h" - RCSID("$Id: hash.cmod,v 1.4 2003/03/18 15:41:57 nilsson Exp $"); + RCSID("$Id: hash.cmod,v 1.5 2003/05/07 16:12:17 grubba Exp $");   #include "interpret.h"   #include "svalue.h"      /* For this_object() */   #include "object.h"   #include "module_support.h"      #include "nettle_config.h"      #ifdef HAVE_LIBNETTLE
pike.git/src/post_modules/Nettle/hash.cmod:109:       /* FIXME: Create should copy state from the other object, if    * provided. */       /*! @decl HashState update(string data)    *!    *! Hashes more data.    */    PIKEFUN object update(string data)    { -  const struct nettle_hash *meta = GET_META(this_object()); +  const struct nettle_hash *meta = +  GET_META(Pike_fp->current_object);       if (!THIS->ctx || !meta)    Pike_error("hash_state not properly initialized.");       NO_WIDE_STRING(data);    meta->update(THIS->ctx, data->len, data->str);       push_object(this_object());    }   
pike.git/src/post_modules/Nettle/hash.cmod:140:    */    PIKEFUN string digest(int|void arg)    {    const struct nettle_hash *meta;    struct pike_string *digest;    unsigned length;       if (! THIS->ctx)    Pike_error("hash_state not properly initialized.");    -  meta = GET_META(this_object()); +  meta = GET_META(Pike_fp->current_object);    assert(meta);       if (!arg)    length = meta->digest_size;    else    {    if (arg->type != PIKE_T_INT)    Pike_error("Bad argument type");    if (arg->u.integer <= 0)    Pike_error("Invalid argument, must be positive.\n");
pike.git/src/post_modules/Nettle/hash.cmod:172:    INIT    {    werror("HashState->INIT\n");    THIS->ctx = NULL;    }    EXIT    {    werror("HashState->EXIT\n");    if (THIS->ctx)    { -  const struct nettle_hash *meta = GET_META(this_object()); +  const struct nettle_hash *meta = +  GET_META(Pike_fp->current_object);    assert(meta);    memset(THIS->ctx, 0, meta->context_size);    }    }   }      /*! @endclass HashState */      /*! @class MD5_Info    *!    *! Internal mixin class, intended to be multiply inherited    *! together with HashInfo. */      PIKECLASS MD5_Info   {    INIT    {    struct HashInfo_struct *HashInfo -  = (struct HashInfo_struct *) get_storage(this_object(), +  = (struct HashInfo_struct *) get_storage(Pike_fp->current_object,    HashInfo_program);       werror("MD5_Info->INIT\n");       if (HashInfo && !HashInfo->meta)    HashInfo->meta = &nettle_md5;    else    /* Can't call Pike_error here.    * Pike_error("Can't initialize this object.\n"); */    werror("MD5_Info->INIT failed\n");
pike.git/src/post_modules/Nettle/hash.cmod:220:    */   PIKECLASS MD5_State   {    INHERIT MD5_Info;    INHERIT HashState;    CVAR struct md5_ctx md5;       INIT    {    struct HashState_struct *instance -  = (struct HashState_struct *) get_storage(this_object(), +  = (struct HashState_struct *) get_storage(Pike_fp->current_object,    HashState_program);    werror("MD5_State->INIT\n");       assert(instance);       md5_init(&THIS->md5);    instance->ctx = &THIS->md5;    }   }   /*! @endclass MD5_State */
pike.git/src/post_modules/Nettle/hash.cmod:242:   /*! @class SHA1_Info    *!    *! Internal mixin class, intended to be multiply inherited    *! together with HashInfo. */      PIKECLASS SHA1_Info   {    INIT    {    struct HashInfo_struct *HashInfo -  = (struct HashInfo_struct *) get_storage(this_object(), +  = (struct HashInfo_struct *) get_storage(Pike_fp->current_object,    HashInfo_program);       werror("SHA1_Info->INIT\n");       if (HashInfo && !HashInfo->meta)    HashInfo->meta = &nettle_sha1;    else    /* Can't call Pike_error here.    * Pike_error("Can't initialize this object.\n"); */    werror("SHA1_Info->INIT failed\n");
pike.git/src/post_modules/Nettle/hash.cmod:272:      PIKECLASS SHA1_State   {    INHERIT SHA1_Info;    INHERIT HashState;    CVAR struct sha1_ctx sha1;       INIT    {    struct HashState_struct *instance -  = (struct HashState_struct *) get_storage(this_object(), +  = (struct HashState_struct *) get_storage(Pike_fp->current_object,    HashState_program);    werror("SHA1_State->INIT\n");       assert(instance);       sha1_init(&THIS->sha1);    instance->ctx = &THIS->sha1;    }   }   /*! @endclass SHA1_State */