Commit b171a181 authored by Robert David Graham's avatar Robert David Graham
Browse files

sll changes

parent fbe1db2c
Loading
Loading
Loading
Loading
+13 −13
Changes for src/crypto-blackrock2.c: 13 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ static const uint32_t SB8[64] =
/***************************************************************************
 * It's an s-box. You gotta have an s-box
 ***************************************************************************/
static const unsigned char sbox[] = {
const unsigned char sbox2[] = {
0x91, 0x58, 0xb3, 0x31, 0x6c, 0x33, 0xda, 0x88,
0x57, 0xdd, 0x8c, 0xf2, 0x29, 0x5a, 0x08, 0x9f,
0x49, 0x34, 0xce, 0x99, 0x9e, 0xbf, 0x0f, 0x81,
@@ -311,22 +311,22 @@ ROUND(uint64_t r, uint64_t R, uint64_t seed)
    }
    return Y;
#if 0
    r0 = sbox[GETBYTE(R,0)]<< 6 | sbox[GETBYTE(R,1)]<< 0;
    r1 = sbox[GETBYTE(R,2)]<< 6 | sbox[GETBYTE(R,5)]<< 0;
    r2 = sbox[GETBYTE(R,4)]<< 6 | sbox[GETBYTE(R,5)]<< 0;
    r3 = sbox[GETBYTE(R,6)]<< 6 | sbox[GETBYTE(R,7)]<< 0;
    r0 = sbox2[GETBYTE(R,0)]<< 6 | sbox2[GETBYTE(R,1)]<< 0;
    r1 = sbox2[GETBYTE(R,2)]<< 6 | sbox2[GETBYTE(R,5)]<< 0;
    r2 = sbox2[GETBYTE(R,4)]<< 6 | sbox2[GETBYTE(R,5)]<< 0;
    r3 = sbox2[GETBYTE(R,6)]<< 6 | sbox2[GETBYTE(R,7)]<< 0;

    R = r0 ^ (r1<<12) * (r2 << 24) ^ (r3 << 36) * r;

    return R;
    /*return((uint64_t)sbox[GETBYTE(R,7ULL)]<< 0ULL)
        | ((uint64_t)sbox[GETBYTE(R,6ULL)]<< 8ULL)
        | ((uint64_t)sbox[GETBYTE(R,5ULL)]<<16ULL)
        | ((uint64_t)sbox[GETBYTE(R,4ULL)]<<24ULL)
        | ((uint64_t)sbox[GETBYTE(R,3ULL)]<<32ULL)
        | ((uint64_t)sbox[GETBYTE(R,2ULL)]<<40ULL)
        | ((uint64_t)sbox[GETBYTE(R,1ULL)]<<48ULL)
        | ((uint64_t)sbox[GETBYTE(R,0ULL)]<<56ULL)
    /*return((uint64_t)sbox2[GETBYTE(R,7ULL)]<< 0ULL)
        | ((uint64_t)sbox2[GETBYTE(R,6ULL)]<< 8ULL)
        | ((uint64_t)sbox2[GETBYTE(R,5ULL)]<<16ULL)
        | ((uint64_t)sbox2[GETBYTE(R,4ULL)]<<24ULL)
        | ((uint64_t)sbox2[GETBYTE(R,3ULL)]<<32ULL)
        | ((uint64_t)sbox2[GETBYTE(R,2ULL)]<<40ULL)
        | ((uint64_t)sbox2[GETBYTE(R,1ULL)]<<48ULL)
        | ((uint64_t)sbox2[GETBYTE(R,0ULL)]<<56ULL)
        ;*/
    return R;
#endif
+1 −1
Changes for src/main-initadapter.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ masscan_initialize_adapter(
     * the best Interface to use. We do this by choosing the first
     * interface with a "default route" (aka. "gateway") defined
     */
    if (masscan->nic[index].ifname && masscan->nic[index].ifname[0])
    if (masscan->nic[index].ifname[0])
        ifname = masscan->nic[index].ifname;
    else {
        /* no adapter specified, so find a default one */
+1 −1
Changes for src/pixie-threads.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -204,6 +204,6 @@ void pixie_thread_join(size_t thread_handle)
#else
    void *p;

    pthread_join(thread_handle, &p);
    pthread_join((pthread_t)thread_handle, &p);
#endif
}
+43 −6
Changes for src/proto-preprocess.c: 43 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -11,8 +11,9 @@

 ****************************************************************************/
#include "proto-preprocess.h"
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>

#define ex32be(px)  (   *((unsigned char*)(px)+0)<<24 \
                    |   *((unsigned char*)(px)+1)<<16 \
@@ -58,6 +59,7 @@ preprocess_frame(const unsigned char *px, unsigned length, unsigned link_type,
    info->found = FOUND_NOTHING;
    info->found_offset = 0;

    /* If not standard Ethernet, go do something else */
    if (link_type != 1)
        goto parse_linktype;

@@ -427,18 +429,53 @@ parse_linktype:
    case 1:     goto parse_ethernet;
    case 12:    goto parse_ipv4;
    case 0x69:  goto parse_wifi;
    case 113:   goto parse_linux_sll; /* LINKTYPE_LINUX_SLL DLT_LINUX_SLL */
    case 119:   goto parse_prism_header;
    case 127:   goto parse_radiotap_header;
    default:    return 0;
    }
    
parse_linux_sll:
    /*
     +--------+--------+--------+--------+
     |   hardware type |   protocol type |
     +--------+--------+--------+--------+
     | h-len  |  p-len |      opcode     |
     +--------+--------+--------+--------+
     +--------+--------+
     |    packet type  |
     +--------+--------+
     |   ARPHRD_ type  |
     +--------+--------+
     |   addr length   |
     +--------+--------+
     |                 |
     +  first 8 bytes  +
     |     of the      |
     +  hardware/MAC   +
     |     address     |
     +                 +
     |                 |
     +--------+--------+
     |     ethertype   |
     +--------+--------+
     */
    {
        struct {
            unsigned packet_type;
            unsigned arp_type;
            unsigned addr_length;
            unsigned char mac_address[8];
            unsigned ethertype;
        } sll;
        
        VERIFY_REMAINING(16, FOUND_SLL);
        
        sll.packet_type = ex16be(px+offset+0);
        sll.arp_type = ex16be(px+offset+2);
        sll.addr_length = ex16be(px+offset+4);
        memcpy(sll.mac_address, px+offset+6, 8);
        sll.ethertype = ex16be(px+offset+14);
   
        offset += 16;
        
        goto parse_ethertype;
    }
    
parse_arp:
    info->ip_version = 256;
+1
Changes for src/proto-preprocess.h: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ enum {
    FOUND_PRISM,
    FOUND_LLC,
    FOUND_ARP,
    FOUND_SLL, /* Linux SLL */
};
struct PreprocessedInfo {
    const unsigned char *mac_src;
Loading