Skip to content
Snippets Groups Projects
Select Git revision
  • 9042f85ee4ef62cda2bf803c3dcb10d8f23d786d
  • master default
  • support_pre_UAL_arm_asm
  • skein
  • rsa-crt-hardening
  • chacha96
  • fat-library
  • versioned-symbols
  • curve25519
  • dsa-reorg
  • aead-api
  • set_key-changes
  • poly1305
  • aes-reorg
  • nettle-2.7-fixes
  • size_t-changes
  • ecc-support
  • experimental-20050201
  • lsh-1.4.2
  • 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
  • converted-master-branch-to-git
  • nettle_2.4_release_20110903
  • nettle_2.3_release_20110902
  • nettle_2.2_release_20110711
  • nettle_2.1_release_20100725
  • camellia_32bit_20100720
  • nettle_2.0_release_20090608
  • nettle_1.15_release_20061128
39 results

ctr.c

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    module_support.c 16.93 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.
    || $Id: module_support.c,v 1.74 2008/04/25 13:46:30 grubba Exp $
    */
    
    #include "global.h"
    #include "module_support.h"
    #include "interpret.h"
    #include "svalue.h"
    #include "stralloc.h"
    #include "pike_types.h"
    #include "pike_error.h"
    #include "mapping.h"
    #include "object.h"
    #include "operators.h"
    #include "bignum.h"
    
    #define sp Pike_sp
    
    /* Checks that args_to_check arguments are OK.
     * Returns 1 if everything worked ok, zero otherwise.
     * If something went wrong, 'exepect_result' tells you what went wrong.
     * Make sure to finish the argument list with a zero.
     */
    static int va_check_args(struct svalue *s,
    			 int args_to_check,
    			 struct expect_result *res,
    			 va_list arglist)
    {
      res->error_type = ERR_NONE;
      res->expected = 0;
      
      for (res->argno=0; res->argno < args_to_check; res->argno++)
      {
        if(!(res->expected & BIT_MANY))
        {
          res->expected = va_arg(arglist, unsigned int);
          if(!res->expected)
          {
    	res->error_type = ERR_TOO_MANY;
    	return 0;
          }
        }
    
        if (!((1UL << s[res->argno].type) & res->expected) &&
    	!(res->expected & BIT_ZERO &&
    	  s[res->argno].type == T_INT && s[res->argno].u.integer == 0))
        {
          res->got = DO_NOT_WARN((unsigned char)s[res->argno].type);
          res->error_type = ERR_BAD_ARG;
          return 0;
        }
      }
    
      if(!(res->expected & BIT_MANY))
        res->expected = va_arg(arglist, unsigned int);
    
      if(!res->expected ||
         (res->expected & BIT_VOID)) return 1;
      res->error_type = ERR_TOO_FEW;
      return 0;
    }
    
    /* Returns the number of the first bad argument,
     * -X if there were too few arguments
     * or 0 if all arguments were OK.
     */
    PMOD_EXPORT int check_args(int args, ...)