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

version» Context lines:

pike.git/src/post_modules/Nettle/mac.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.   */    - #include "global.h" + #include "module.h"   #include "interpret.h" - #include "svalue.h" +    #include "threads.h" -  - /* For this_object() */ - #include "object.h" +    #include "module_support.h"   #include "pike_compiler.h" - #include "pike_memory.h" +       #include "nettle_config.h"      #ifdef HAVE_LIBNETTLE      DECLARATIONS      #include "nettle.h"      #ifdef HAVE_NETTLE_POLY1305_H
pike.git/src/post_modules/Nettle/mac.cmod:145:    */    PIKEFUN int(0..) iv_size()    optflags OPT_TRY_OPTIMIZE;    {    if (!THIS->meta)    Pike_error("MAC not properly initialized.\n");       push_int(THIS->meta->iv_size);    }    + #ifdef PIKE_NULL_IS_SPECIAL    INIT    {    THIS->meta = NULL;    } -  + #endif       /*! @class State    *!    *! Base class for MAC contexts.    */    PIKECLASS State    program_flags PROGRAM_USES_PARENT|PROGRAM_NEEDS_PARENT|PROGRAM_CLEAR_STORAGE;    {    DOCSTART() @decl inherit MAC::State    DOCEND()       EXTRA    {    /* Perform an inherit of the State class (if any) that our parent    * may contain via its inherit of __builtin.Nettle.MAC.    */ -  struct program *parent_prog = Pike_compiler->previous->new_program; -  struct object *parent_obj = Pike_compiler->previous->fake_object; -  int parent_State_fun_num = -  really_low_find_shared_string_identifier(MK_STRING("State"), -  parent_prog, -  SEE_PROTECTED|SEE_PRIVATE); -  if (parent_State_fun_num >= 0) { -  struct program *parent_State_prog = -  low_program_from_function(parent_obj, parent_State_fun_num); -  if (parent_State_prog) { -  parent_State_fun_num = -  really_low_reference_inherited_identifier(Pike_compiler->previous, -  0, parent_State_fun_num); -  low_inherit(parent_State_prog, 0, -  parent_State_fun_num, -  1 + 42, 0, NULL); +  lexical_inherit(1, MK_STRING("State"), 0, REPORT_WARNING);    } -  } -  } +       #define GET_META(o) \    ( ((struct Nettle_MAC_struct *)parent_storage(1, Nettle_MAC_program))->meta )       CVAR void *ctx;       /*! @decl void create(string(8bit) key)    *!    *! Initialize the MAC with a password.    *!
pike.git/src/post_modules/Nettle/mac.cmod:207:    flags ID_PROTECTED;    {    void *ctx = THIS->ctx;    const struct pike_mac *meta =    GET_META(Pike_fp->current_object);       key->flags |= STRING_CLEAR_ON_EXIT;    NO_WIDE_STRING(key);       meta->set_key(ctx, key->len, STR0(key)); +  pop_stack();    }       /*! @decl State set_iv(string(0..255) iv)    *!    *! Set the iv/nonce (if supported) for the MAC.    *!    *! @returns    *! Returns @expr{this@} in order to simplify chaining    *! of function calls.    */
pike.git/src/post_modules/Nettle/mac.cmod:345:    NO_WIDE_STRING(data);       meta->update(&THIS->ctx, data->len, STR0(data));       digest = begin_shared_string(meta->digest_size);    meta->digest(&THIS->ctx, meta->digest_size, STR0(digest));       push_string(end_shared_string(digest));    }    + #ifdef PIKE_NULL_IS_SPECIAL    INIT    {    THIS->ctx = NULL;    } -  + #endif       EXIT    {    if (THIS->ctx)    {    const struct pike_mac *meta =    GET_META(Pike_fp->current_object);    if (meta) {    memset(THIS->ctx, 0, meta->context_size);    }