Ticket #761 (assigned Problem)

Opened 4 weeks ago

Last modified 3 weeks ago

64bit types in binpac

Reported by: seth Owned by: seth
Priority: Normal Milestone: Bro2.1
Component: Bro Version: git/master
Keywords: Cc:

Description

There are branches in binpac and bro repositories to add support for 64bit ints to binpac. (int64 and uint64)

binpac: topic/seth/64bit-types
bro: topic/seth/64bit-binpac-updates

The only updates that were needed to Bro were to remove some state tracking code that I don't think would have worked very well anyway (for bittorrent). I'm planning on doing some rework on the bittorrent analyzer soon anyway so this shouldn't be a problem for long.

Change History

comment:0 Changed 3 weeks ago by robin

I'm trusting that these are correct ...

inline int64 pac_swap(int64 x)
    {
    return  (x >> 56) |
        ((x & 0xff000000000000) >> 40) |
        ((x & 0xff0000000000) >> 24) |
        ((x & 0xff00000000) >> 8) |
        ((x & 0xff000000) << 8) |
        ((x & 0xff0000) << 24) |
        ((x & 0xff00) << 40) |
        ((x & 0xff) << 56);
    }





inline uint64 pac_swap(uint64 x)
    {
    return  (x >> 56) |
        ((x & 0xff000000000000) >> 40) |
        ((x & 0xff0000000000) >> 24) |
        ((x & 0xff00000000) >> 8) |
        ((x & 0xff000000) << 8) |
        ((x & 0xff0000) << 24) |
        ((x & 0xff00) << 40) |
        ((x & 0xff) << 56);
    }


comment:1 Changed 3 weeks ago by robin

  • Owner changed from robin to seth
  • Status changed from new to assigned
  • Type changed from Merge Request to Problem

This doesn't compile for me on a 64-bit Linux:

[ 15%] Building CXX object src/CMakeFiles/bro.dir/ssl_pac.cc.o
/home/robin/bro/master/build/src/ssl_pac.cc: In member function ‘bool binpac::SSL::SSL_Conn::proc_certificate(binpac::SSL::SSLRecord*, std::vector<binpac::datastring<unsigned char> >*)’:
/home/robin/bro/master/build/src/ssl_pac.cc:312:78: error: call of overloaded ‘Val(binpac::uint64, TypeTag)’ is ambiguous
/home/robin/bro/master/build/src/ssl_pac.cc:312:78: note: candidates are:
/home/robin/bro/master/src/Val.h:352:2: note: Val::Val(BroString*, TypeTag) <near match>
/home/robin/bro/master/src/Val.h:352:2: note:   no known conversion for argument 1 from ‘binpac::uint64 {aka long long unsigned int}’ to ‘BroString*’
/home/robin/bro/master/src/Val.h:144:2: note: Val::Val(BroType*, bool) <near match>
/home/robin/bro/master/src/Val.h:144:2: note:   no known conversion for argument 1 from ‘binpac::uint64 {aka long long unsigned int}’ to ‘BroType*’
/home/robin/bro/master/src/Val.h:128:2: note: Val::Val(double, TypeTag)
/home/robin/bro/master/src/Val.h:118:2: note: Val::Val(uint64, TypeTag)
/home/robin/bro/master/src/Val.h:108:2: note: Val::Val(int64, TypeTag)
/home/robin/bro/master/src/Val.h:98:2: note: Val::Val(uint32, TypeTag)
/home/robin/bro/master/src/Val.h:88:2: note: Val::Val(int32, TypeTag)
/home/robin/bro/master/src/Val.h:78:2: note: Val::Val(bool, TypeTag)
make[3]: *** [src/CMakeFiles/bro.dir/ssl_pac.cc.o] Error 1
make[3]: Leaving directory `/da/home/robin/bro/master/build'
make[2]: *** [src/CMakeFiles/bro.dir/all] Error 2
make[2]: Leaving directory `/da/home/robin/bro/master/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/da/home/robin/bro/master/build'
make: *** [all] Error 2

comment:5 Changed 3 weeks ago by gregor

IMHO these constants need to be long long constants (or whatever 64 bit is on the target architecture), i.e., 0xff000000000000ll

Should just figure out a way to make that work properly on all platforms.

Note: See TracTickets for help on using tickets.