Changeset a7282fb


Ignore:
Timestamp:
11/14/06 13:56:01 (14 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
2595c4d
Parents:
35e0869
Message:

Fix lots of little warnings

Location:
tools
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • tools/traceanon/ipenc.c

    r4e65f42 ra7282fb  
    3333static uint32_t prefix;
    3434static uint32_t netmask;
    35 static void init_prefix(char *key)
     35static void init_prefix(uint8_t *key)
    3636{
    3737        int a,b,c,d;
     
    4949}
    5050
    51 void enc_init(enum enc_type_t type, char *key)
     51void enc_init(enum enc_type_t type, uint8_t *key)
    5252{
    53         char cryptopan_key[32];
     53        uint8_t cryptopan_key[32];
    5454        memset(cryptopan_key,0,sizeof(cryptopan_key));
    5555        enc_type = type;
  • tools/traceanon/ipenc.h

    r49f147b ra7282fb  
    99        ENC_CRYPTOPAN                   /**< Prefix preserving encryption */
    1010        };
    11 void enc_init(enum enc_type_t type, char *key);
     11void enc_init(enum enc_type_t type, uint8_t *key);
    1212uint32_t enc_ip(uint32_t orig_addr);
    1313#endif
  • tools/traceanon/panon.h

    r49f147b ra7282fb  
    22#define _PANON_H_
    33
    4 // $Id$
     4/* $Id$ */
    55
    66#include "rijndael.h"
     
    1313void panon_init(const uint8_t * key);
    1414void panon_init_cache();
    15 #endif // _PANON_H_
     15#endif
  • tools/traceanon/rijndael.c

    rc631f0f ra7282fb  
    1 // $Id$
    2 
    3 //
     1/* $Id$ */
     2
     3/*
    44// File : rijndael.cpp
    55// Creation date : Sun Nov 5 2000 03:22:10 CEST
     
    1010// This code is public domain.
    1111// Based on the Vincent Rijmen and K.U.Leuven implementation 2.4.
    12 //
    13 
    14 //
     12*/
     13
     14/*
    1515// Original Copyright notice:
    1616//
     
    2828//
    2929//    This code is placed in the public domain.
    30 //
    31 
    32 //
     30*/
     31
     32/*
    3333// This implementation works on 128 , 192 , 256 bit keys
    3434// and on 128 bit blocks
    35 //
     35*/
    3636
    3737#define _RIJNDAEL_CPP_
     
    971971
    972972
    973 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     973/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    974974// API
    975 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     975//////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
    976976
    977977int rijndael_init(Mode mode,Direction dir,const UINT8 * key,KeyLength keyLen,UINT8 * initVector)
     
    982982        UINT32 j;
    983983
    984         // Not initialized yet
     984        /* Not initialized yet */
    985985        m_state = Invalid;
    986986
    987         // Check the mode
     987        /* Check the mode */
    988988        if((mode != CBC) && (mode != ECB) && (mode != CFB1))return RIJNDAEL_UNSUPPORTED_MODE;
    989989        m_mode = mode;
    990990
    991         // And the direction
     991        /* And the direction */
    992992        if((dir != Encrypt) && (dir != Decrypt))return RIJNDAEL_UNSUPPORTED_DIRECTION;
    993993        m_direction = dir;
    994994
    995         // Allow to set an init vector
     995        /* Allow to set an init vector */
    996996        if(initVector)
    997997        {
    998                 // specified init vector
     998                /* specified init vector */
    999999                for(i = 0;i < MAX_IV_SIZE;i++)
    10001000                {
     
    10021002                }
    10031003        } else {
    1004                 // zero init vector
     1004                /* zero init vector */
    10051005                for(i = 0;i < MAX_IV_SIZE;i++)
    10061006                {
     
    10101010
    10111011
    1012         // And check the key length
     1012        /* And check the key length */
    10131013        switch(keyLen)
    10141014        {
     
    10291029                        break;
    10301030        }
    1031         // The number of rounds is calculated as
     1031        /* The number of rounds is calculated as
    10321032        // m_uRounds = (m_uKeyLenInBits / 32) + 6;
     1033        */
    10331034
    10341035        if(!key)return RIJNDAEL_BAD_KEY;
     
    11541155                        }
    11551156                        padLen = 16 - (inputOctets - 16*numBlocks);
    1156                         //                      assert(padLen > 0 && padLen <= 16);
    11571157                        memcpy(block, input, 16 - padLen);
    11581158                        memset(block + 16 - padLen, padLen, padLen);
     
    11731173                        }
    11741174                        padLen = 16 - (inputOctets - 16*numBlocks);
    1175                         //                      assert(padLen > 0 && padLen <= 16); // DO SOMETHING HERE ?
    11761175                        for (i = 0; i < 16 - padLen; i++) {
    11771176                                block[i] = input[i] ^ iv[i];
     
    13581357}
    13591358
    1360 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     1359/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    13611360// ALGORITHM
    1362 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     1361////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
    13631362
    13641363
     
    13691368        int t = 0;
    13701369
    1371         // Calculate the necessary round keys
    1372         // The number of calculations depends on keyBits and blockBits
     1370        /* Calculate the necessary round keys */
     1371        /* The number of calculations depends on keyBits and blockBits */
    13731372        int uKeyColumns = m_uRounds - 6;
    13741373
    13751374        UINT8 tempKey[_MAX_KEY_COLUMNS][4];
    13761375
    1377         // Copy the input key to the temporary key matrix
     1376        /* Copy the input key to the temporary key matrix */
    13781377
    13791378        for(j = 0;j < uKeyColumns;j++)
     
    13831382
    13841383
    1385         // copy values into round key array
     1384        /* copy values into round key array */
    13861385        for(j = 0;(j < uKeyColumns) && (r <= m_uRounds); )
    13871386        {
     
    15401539        UINT8 temp[4][4];
    15411540
    1542         *((UINT32*)temp[0]) = *((UINT32*)(a   )) ^ *((UINT32*)m_expandedKey[m_uRounds][0]);
    1543         *((UINT32*)temp[1]) = *((UINT32*)(a+ 4)) ^ *((UINT32*)m_expandedKey[m_uRounds][1]);
    1544         *((UINT32*)temp[2]) = *((UINT32*)(a+ 8)) ^ *((UINT32*)m_expandedKey[m_uRounds][2]);
    1545         *((UINT32*)temp[3]) = *((UINT32*)(a+12)) ^ *((UINT32*)m_expandedKey[m_uRounds][3]);
    1546 
    1547         *((UINT32*)(b   )) = *((UINT32*)T5[temp[0][0]])
    1548                 ^ *((UINT32*)T6[temp[3][1]])
    1549                 ^ *((UINT32*)T7[temp[2][2]])
    1550                 ^ *((UINT32*)T8[temp[1][3]]);
    1551         *((UINT32*)(b+ 4)) = *((UINT32*)T5[temp[1][0]])
    1552                 ^ *((UINT32*)T6[temp[0][1]])
    1553                 ^ *((UINT32*)T7[temp[3][2]])
    1554                 ^ *((UINT32*)T8[temp[2][3]]);
     1541        *((UINT32*)temp[0]) = *((const UINT32*)(a   )) ^ *((const UINT32*)m_expandedKey[m_uRounds][0]);
     1542        *((UINT32*)temp[1]) = *((const UINT32*)(a+ 4)) ^ *((const UINT32*)m_expandedKey[m_uRounds][1]);
     1543        *((UINT32*)temp[2]) = *((const UINT32*)(a+ 8)) ^ *((const UINT32*)m_expandedKey[m_uRounds][2]);
     1544        *((UINT32*)temp[3]) = *((const UINT32*)(a+12)) ^ *((const UINT32*)m_expandedKey[m_uRounds][3]);
     1545
     1546        *((UINT32*)(b   )) = *((const UINT32*)T5[temp[0][0]])
     1547                ^ *((const UINT32*)T6[temp[3][1]])
     1548                ^ *((const UINT32*)T7[temp[2][2]])
     1549                ^ *((const UINT32*)T8[temp[1][3]]);
     1550        *((UINT32*)(b+ 4)) = *((const UINT32*)T5[temp[1][0]])
     1551                ^ *((const UINT32*)T6[temp[0][1]])
     1552                ^ *((const UINT32*)T7[temp[3][2]])
     1553                ^ *((const UINT32*)T8[temp[2][3]]);
    15551554        *((UINT32*)(b+ 8)) = *((UINT32*)T5[temp[2][0]])
    1556                 ^ *((UINT32*)T6[temp[1][1]])
    1557                 ^ *((UINT32*)T7[temp[0][2]])
    1558                 ^ *((UINT32*)T8[temp[3][3]]);
     1555                ^ *((const UINT32*)T6[temp[1][1]])
     1556                ^ *((const UINT32*)T7[temp[0][2]])
     1557                ^ *((const UINT32*)T8[temp[3][3]]);
    15591558        *((UINT32*)(b+12)) = *((UINT32*)T5[temp[3][0]])
    1560                 ^ *((UINT32*)T6[temp[2][1]])
    1561                 ^ *((UINT32*)T7[temp[1][2]])
    1562                 ^ *((UINT32*)T8[temp[0][3]]);
     1559                ^ *((const UINT32*)T6[temp[2][1]])
     1560                ^ *((const UINT32*)T7[temp[1][2]])
     1561                ^ *((const UINT32*)T8[temp[0][3]]);
    15631562        for(r = m_uRounds-1; r > 1; r--)
    15641563        {
  • tools/traceanon/traceanon.c

    r66caf4b ra7282fb  
    1212
    1313
    14 void usage(char *argv0)
     14static void usage(char *argv0)
    1515{
    1616        fprintf(stderr,"Usage:\n"
     
    2727
    2828/* Incrementally update a checksum */
    29 void update_in_cksum(uint16_t *csum, uint16_t old, uint16_t new)
     29static void update_in_cksum(uint16_t *csum, uint16_t old, uint16_t new)
    3030{
    3131        uint32_t sum = (~htons(*csum) & 0xFFFF)
     
    3636}
    3737
    38 void update_in_cksum32(uint16_t *csum, uint32_t old, uint32_t new)
    39 {
    40         update_in_cksum(csum,old>>16,new>>16);
    41         update_in_cksum(csum,old&0xFFFF,new&0xFFFF);
     38static void update_in_cksum32(uint16_t *csum, uint32_t old, uint32_t new)
     39{
     40        update_in_cksum(csum,(uint16_t)(old>>16),(uint16_t)(new>>16));
     41        update_in_cksum(csum,(uint16_t)(old&0xFFFF),(uint16_t)(new&0xFFFF));
    4242}
    4343
     
    5252 * source instead of the source and destination!
    5353 */
    54 void encrypt_ips(struct libtrace_ip *ip,bool enc_source,bool enc_dest)
     54static void encrypt_ips(struct libtrace_ip *ip,bool enc_source,bool enc_dest)
    5555{
    5656        struct libtrace_tcp *tcp;
     
    6868                                        ));
    6969                update_in_cksum32(&ip->ip_sum,old_ip,new_ip);
    70                 if (tcp) update_in_cksum(&tcp->check,old_ip,new_ip);
    71                 if (udp) update_in_cksum(&udp->check,old_ip,new_ip);
     70                if (tcp) update_in_cksum32(&tcp->check,old_ip,new_ip);
     71                if (udp) update_in_cksum32(&udp->check,old_ip,new_ip);
    7272                ip->ip_src.s_addr = new_ip;
    7373        }
     
    7979                                        ));
    8080                update_in_cksum32(&ip->ip_sum,old_ip,new_ip);
    81                 if (tcp) update_in_cksum(&tcp->check,old_ip,new_ip);
    82                 if (udp) update_in_cksum(&udp->check,old_ip,new_ip);
     81                if (tcp) update_in_cksum32(&tcp->check,old_ip,new_ip);
     82                if (udp) update_in_cksum32(&udp->check,old_ip,new_ip);
    8383                ip->ip_dst.s_addr = new_ip;
    8484        }
     
    103103{
    104104        enum enc_type_t enc_type = ENC_NONE;
    105         char *key = NULL;
     105        uint8_t *key = NULL;
    106106        struct libtrace_t *trace = 0;
    107107        struct libtrace_packet_t *packet = trace_create_packet();
  • tools/tracemerge/tracemerge.c

    ra31b4c7 ra7282fb  
    66#include <getopt.h>
    77
    8 void usage(char *argv0)
     8static void usage(char *argv0)
    99{
    1010        fprintf(stderr,"Usage:\n"
  • tools/tracereport/dir_report.c

    r3b49843 ra7282fb  
    55#include "libtrace.h"
    66#include "tracereport.h"
     7#include "report.h"
    78
    89static uint64_t dir_bytes[8];
  • tools/tracereport/flow_report.c

    re3b0188 ra7282fb  
    77#include "tracereport.h"
    88#include "contain.h"
     9#include "report.h"
    910
    1011static uint64_t flow_count=0;
  • tools/tracereport/port_report.c

    r11c4044 ra7282fb  
    88#include "tracereport.h"
    99#include "contain.h"
     10#include "report.h"
    1011
    1112stat_t ports[256][65536]={{{0,0}}};
     
    3132}
    3233
    33 void port_port(int i,char *prot, int j)
     34static void port_port(int i,char *prot, int j)
    3435{
    3536        struct servent *ent = getservbyport(htons(j),prot);
     
    4849}
    4950
    50 void port_protocol(int i)
     51static void port_protocol(int i)
    5152{
    5253        int j;
  • tools/tracereport/tos_report.c

    re3b0188 ra7282fb  
    55#include "libtrace.h"
    66#include "tracereport.h"
     7#include "report.h"
    78
    89static stat_t tos_stat[256] = { {0,0} } ;
  • tools/tracereport/tracereport.c

    r66caf4b ra7282fb  
    5959
    6060/* Process a trace, counting packets that match filter(s) */
    61 void run_trace(char *uri, libtrace_filter_t *filter, int count)
     61static void run_trace(char *uri, libtrace_filter_t *filter, int count)
    6262{
    6363        struct libtrace_packet_t *packet = trace_create_packet();
     
    101101}
    102102
    103 void usage(char *argv0)
     103static void usage(char *argv0)
    104104{
    105105        fprintf(stderr,"Usage:\n"
  • tools/tracereport/ttl_report.c

    re3b0188 ra7282fb  
    55#include "libtrace.h"
    66#include "tracereport.h"
     7#include "report.h"
    78
    89static stat_t ttl_stat[256] = { {0,0} } ;
  • tools/tracertstats/tracertstats.c

    r66caf4b ra7282fb  
    8080struct output_data_t *output;
    8181
    82 void report_results(double ts,uint64_t count,uint64_t bytes)
     82static void report_results(double ts,uint64_t count,uint64_t bytes)
    8383{
    8484        int i=0;
     
    9595
    9696/* Process a trace, counting packets that match filter(s) */
    97 void run_trace(char *uri)
     97static void run_trace(char *uri)
    9898{
    9999        struct libtrace_packet_t *packet = trace_create_packet();
     
    178178}
    179179
    180 void usage(char *argv0)
     180static void usage(char *argv0)
    181181{
    182182        fprintf(stderr,"Usage:\n"
  • tools/tracesplit/tracesplit.c

    r19c6cbe ra7282fb  
    1111#include <assert.h>
    1212
    13 char *strdupcat(char *str,char *app)
     13static char *strdupcat(char *str,char *app)
    1414{
    1515        str=realloc(str,strlen(str)+strlen(app)+1);
     
    1818}
    1919
    20 char *strdupcati(char *str,int i)
     20static char *strdupcati(char *str,uint64_t i)
    2121{
    2222        char buffer[64];
    23         snprintf(buffer,sizeof(buffer),"%i",i);
     23        snprintf(buffer,sizeof(buffer),"%" PRIu64,i);
    2424        return strdupcat(str,buffer);
    2525}
    2626
    27 int usage(char *argv0)
     27static int usage(char *argv0)
    2828{
    2929        printf("Usage:\n"
     
    166166                        if (interval!=UINT64_MAX) {
    167167                                buffer=strdupcat(buffer,"-");
    168                                 buffer=strdupcati(buffer,firsttime);
     168                                buffer=strdupcati(buffer,(uint64_t)firsttime);
    169169                        }
    170170                        if (count!=UINT64_MAX) {
    171171                                buffer=strdupcat(buffer,"-");
    172                                 buffer=strdupcati(buffer,pktcount);
     172                                buffer=strdupcati(buffer,(uint64_t)pktcount);
    173173                        }
    174174                        if (bytes!=UINT64_MAX) {
    175175                                static int filenum=0;
    176176                                buffer=strdupcat(buffer,"-");
    177                                 buffer=strdupcati(buffer,++filenum);
     177                                buffer=strdupcati(buffer,(uint64_t)++filenum);
    178178                        }
    179179                        output=trace_create_output(buffer);
  • tools/tracesplit/tracesplit_dir.c

    rfc0f131 ra7282fb  
    33
    44
    5 struct libtrace_out_t *create_output(char *uri) {
     5static struct libtrace_out_t *create_output(char *uri) {
    66        struct libtrace_out_t *output = NULL;
    77        libtrace_err_t trace_err;
     
    1818}
    1919
    20 void usage() {
    21         printf("tracesplit_dir inputuri outputuri_incoming outputuri_outgoing\n");
     20static void usage(char*argv0) {
     21        printf("%s inputuri outputuri_incoming outputuri_outgoing\n",argv0);
    2222}
    2323
  • tools/tracestats/tracestats.c

    r66caf4b ra7282fb  
    7171
    7272/* Process a trace, counting packets that match filter(s) */
    73 void run_trace(char *uri)
     73static void run_trace(char *uri)
    7474{
    7575        struct libtrace_packet_t *packet = trace_create_packet();
     
    122122}
    123123
    124 void usage(char *argv0)
     124static void usage(char *argv0)
    125125{
    126126        fprintf(stderr,"Usage: %s [-H|--libtrace-help] [--filter|-f bpf ]... libtraceuri...\n",argv0);
Note: See TracChangeset for help on using the changeset viewer.