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

version» Context lines:

pike.git/src/post_modules/Nettle/nettle.cmod:1:   /* nettle.cmod -*- c -*- */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   /* For this_object() */   #include "object.h"   #include "operators.h"   #include "module_support.h"   #include "threads.h" + #include "pike_memory.h"      #include "nettle_config.h"      #ifdef HAVE_LIBNETTLE      #include "nettle.h"      #include <nettle/yarrow.h>   #include <nettle/knuth-lfib.h>   
pike.git/src/post_modules/Nettle/nettle.cmod:392:    THIS->mode = 0;    }       EXIT    gc_trivial;    {    if(THIS->object) {    free_object(THIS->object);    }    if(THIS->iv) { -  MEMSET(THIS->iv, 0, THIS->block_size); +  guaranteed_memset(THIS->iv, 0, THIS->block_size);    free(THIS->iv);    }    }       INLINE static void cbc_encrypt_step(const unsigned INT8 *const source,    unsigned INT8 *dest)    {    INT32 block_size = THIS->block_size;    INT32 i;   
pike.git/src/post_modules/Nettle/nettle.cmod:472:       THIS->block_size = Pike_sp[-1].u.integer;       pop_stack();       if ((!THIS->block_size) ||    (THIS->block_size > 4096))    Pike_error("Bad block size %d.\n", THIS->block_size);       if(THIS->iv) { -  MEMSET(THIS->iv, 0, old_block_size); +  guaranteed_memset(THIS->iv, 0, old_block_size);    free(THIS->iv);    }    THIS->iv = (unsigned INT8 *)xalloc(THIS->block_size);    MEMSET(THIS->iv, 0, THIS->block_size);    }       /*! @decl string name()    *! Returns the string @expr{"CBC(x)"@} where x is the    *! encapsulated algorithm.    */
pike.git/src/post_modules/Nettle/nettle.cmod:587:    else {    while (offset < data->len) {    cbc_decrypt_step((const unsigned INT8 *)data->str + offset,    result + offset);    offset += THIS->block_size;    }    }       pop_n_elems(args);    push_string(make_shared_binary_string((INT8 *)result, offset)); -  MEMSET(result, 0, offset); +  guaranteed_memset(result, 0, offset);       CALL_AND_UNSET_ONERROR (uwp);    }   }      /*! @endclass    */      /*! @class Buffer    *! @belongs Crypto
pike.git/src/post_modules/Nettle/nettle.cmod:618:    THIS->object = NULL;    THIS->block_size = 0;    THIS->backlog = NULL;    THIS->backlog_len = 0;    }       EXIT    gc_trivial;    {    if(THIS->backlog) { -  MEMSET(THIS->backlog, 0, THIS->block_size); +  guaranteed_memset(THIS->backlog, 0, THIS->block_size);    free(THIS->backlog);    THIS->backlog = NULL;    }    if(THIS->object) {    free_object(THIS->object);    THIS->object = NULL;    }    }       /*! @decl void create(program|object|function cipher, mixed ... args)
pike.git/src/post_modules/Nettle/nettle.cmod:803:       if (soffset < Pike_sp[-1].u.string->len) {    MEMCPY(THIS->backlog, Pike_sp[-1].u.string->str + soffset,    Pike_sp[-1].u.string->len - soffset);    THIS->backlog_len = Pike_sp[-1].u.string->len - soffset;    }       pop_n_elems(args);       push_string(make_shared_binary_string((char *)result, roffset + len)); -  MEMSET(result, 0, roffset + len); +  guaranteed_memset(result, 0, roffset + len);    CALL_AND_UNSET_ONERROR (uwp);    }       /*! @decl string pad(void|int method)    *!    *! Pad and encrypt any data left in the buffer.    *!    *! @param method    *! The type of padding to apply to the buffer.    *! @int