Skip to content
Snippets Groups Projects
Select Git revision
  • 2beb8969b50d5f3b0c347188f96cebf587be95d4
  • master default protected
  • streebog
  • gost28147
  • master-updates
  • ed448
  • shake256
  • curve448
  • ecc-sqrt
  • gosthash94cp
  • cmac64
  • block16-refactor
  • siv-mode
  • cmac-layout
  • delete-des-compat
  • delete-rsa_blind
  • aes-struct-layout
  • release-3.4-fixes
  • struct-layout
  • attribute-deprecated
  • rename-data-symbols
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
  • nettle_3.5rc1
  • nettle_3.4.1_release_20181204
  • nettle_3.4.1rc1
  • nettle_3.4_release_20171119
  • nettle_3.4rc2
  • nettle_3.4rc1
  • nettle_3.3_release_20161001
  • nettle_3.2_release_20160128
  • nettle_3.1.1_release_20150424
  • nettle_3.1_release_20150407
  • nettle_3.1rc3
  • nettle_3.1rc2
  • nettle_3.1rc1
  • nettle_3.0_release_20140607
  • nettle_2.7.1_release_20130528
  • nettle_2.7_release_20130424
  • nettle_2.6_release_20130116
  • nettle_2.5_release_20120707
41 results

rsa-encrypt.c

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    mapping.c 70.95 KiB
    /*
    || 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 "main.h"
    #include "object.h"
    #include "mapping.h"
    #include "svalue.h"
    #include "array.h"
    #include "pike_macros.h"
    #include "pike_error.h"
    #include "pike_memory.h"
    #include "pike_types.h"
    #include "dynamic_buffer.h"
    #include "interpret.h"
    #include "las.h"
    #include "gc.h"
    #include "stralloc.h"
    #include "pike_security.h"
    #include "block_allocator.h"
    #include "opcodes.h"
    #include "stuff.h"
    
    #define AVG_LINK_LENGTH 4
    #define MIN_LINK_LENGTH 1
    #define MAP_SLOTS(X) ((X)?((X)+((X)>>4)+8):0)
    
    struct mapping *first_mapping;
    
    struct mapping *gc_internal_mapping = 0;
    static struct mapping *gc_mark_mapping_pos = 0;
    
    #define unlink_mapping_data(M) do{				\
     struct mapping_data *md_=(M);					\
     if(md_->hardlinks) { md_->hardlinks--; md_->valrefs--; }	\
     free_mapping_data(M);						\
    }while(0)
    
    #define MAPPING_DATA_SIZE(HSIZE, KEYPAIRS) \
       PTR_TO_INT(MD_KEYPAIRS(0, HSIZE) + KEYPAIRS)
    
    static struct block_allocator mapping_allocator = BA_INIT_PAGES(sizeof(struct mapping), 2);
    void count_memory_in_mappings(size_t * num, size_t * size) {
        struct mapping *m;
        double datasize = 0.0;
        ba_count_all(&mapping_allocator, num, size);
        for(m=first_mapping;m;m=m->next) {
    	datasize+=MAPPING_DATA_SIZE(m->data->hashsize, m->data->num_keypairs) / (double) m->data->refs;
        }
        *size += (size_t) datasize;
    }
    
    void really_free_mapping(struct mapping * m) {
    #ifdef PIKE_DEBUG
      if (m->refs) {
    # ifdef DEBUG_MALLOC
        describe_something(m, T_MAPPING, 0,2,0, NULL);
    # endif
        Pike_fatal("really free mapping on mapping with %d refs.\n", m->refs);
      }
    #endif
      FREE_PROT(m);
      unlink_mapping_data(m->data);
      DOUBLEUNLINK(first_mapping, m);
      GC_FREE(m);
      ba_free(&mapping_allocator, m);
    }