fuzz_des.c:k5memdup:
 2300|     37|{
 2301|     37|    void *ptr = k5alloc(len, code);
 2302|       |
 2303|     37|    if (ptr != NULL && len > 0)
  ------------------
  |  Branch (2303:9): [True: 37, False: 0]
  |  Branch (2303:24): [True: 37, False: 0]
  ------------------
 2304|     37|        memcpy(ptr, in, len);
 2305|     37|    return ptr;
 2306|     37|}
fuzz_des.c:k5alloc:
 2293|     37|{
 2294|     37|    return k5calloc(1, size, code);
 2295|     37|}
fuzz_des.c:k5calloc:
 2281|     37|{
 2282|     37|    void *ptr;
 2283|       |
 2284|       |    /* Allocate at least one byte since zero-byte allocs may return NULL. */
 2285|     37|    ptr = calloc(nmemb ? nmemb : 1, size ? size : 1);
  ------------------
  |  Branch (2285:18): [True: 37, False: 0]
  |  Branch (2285:37): [True: 37, False: 0]
  ------------------
 2286|     37|    *code = (ptr == NULL) ? ENOMEM : 0;
  ------------------
  |  Branch (2286:13): [True: 0, False: 37]
  ------------------
 2287|     37|    return ptr;
 2288|     37|}

fuzz_des.c:load_32_be:
  596|    444|{
  597|    444|    const unsigned char *p = (const unsigned char *) cvp;
  598|       |#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
  599|       |    return GET(32,p);
  600|       |#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32) && !defined(__cplusplus)
  601|    444|    return GETSWAPPED(32,p);
  ------------------
  |  |  492|    444|# define GETSWAPPED(SIZE,PTR)           SWAP##SIZE(GET(SIZE,PTR))
  |  |  ------------------
  |  |  |  |  505|    444|# define SWAP32                 bswap_32
  |  |  ------------------
  ------------------
  602|       |#else
  603|       |    return (p[3] | (p[2] << 8)
  604|       |            | ((uint32_t) p[1] << 16)
  605|       |            | ((uint32_t) p[0] << 24));
  606|       |#endif
  607|    444|}
fuzz_des.c:store_32_be:
  550|     74|{
  551|     74|    unsigned char *p = (unsigned char *) vp;
  552|       |#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
  553|       |    PUT(32,p,val);
  554|       |#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32) && !defined(__cplusplus)
  555|     74|    PUTSWAPPED(32,p,val);
  ------------------
  |  |  491|     74|# define PUTSWAPPED(SIZE,PTR,VAL)       PUT(SIZE,PTR,SWAP##SIZE(VAL))
  |  |  ------------------
  |  |  |  |  489|     74|# define PUT(SIZE,PTR,VAL)      (((struct { uint##SIZE##_t i; } __attribute__((packed)) *)(PTR))->i = (VAL))
  |  |  ------------------
  ------------------
  556|       |#else
  557|       |    p[0] = (val >> 24) & 0xff;
  558|       |    p[1] = (val >> 16) & 0xff;
  559|       |    p[2] = (val >>  8) & 0xff;
  560|       |    p[3] = (val      ) & 0xff;
  561|       |#endif
  562|     74|}
f_cksum.c:load_32_be:
  596|    148|{
  597|    148|    const unsigned char *p = (const unsigned char *) cvp;
  598|       |#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
  599|       |    return GET(32,p);
  600|       |#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32) && !defined(__cplusplus)
  601|    148|    return GETSWAPPED(32,p);
  ------------------
  |  |  492|    148|# define GETSWAPPED(SIZE,PTR)           SWAP##SIZE(GET(SIZE,PTR))
  |  |  ------------------
  |  |  |  |  505|    148|# define SWAP32                 bswap_32
  |  |  ------------------
  ------------------
  602|       |#else
  603|       |    return (p[3] | (p[2] << 8)
  604|       |            | ((uint32_t) p[1] << 16)
  605|       |            | ((uint32_t) p[0] << 24));
  606|       |#endif
  607|    148|}
f_cksum.c:store_32_be:
  550|     74|{
  551|     74|    unsigned char *p = (unsigned char *) vp;
  552|       |#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
  553|       |    PUT(32,p,val);
  554|       |#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32) && !defined(__cplusplus)
  555|     74|    PUTSWAPPED(32,p,val);
  ------------------
  |  |  491|     74|# define PUTSWAPPED(SIZE,PTR,VAL)       PUT(SIZE,PTR,SWAP##SIZE(VAL))
  |  |  ------------------
  |  |  |  |  489|     74|# define PUT(SIZE,PTR,VAL)      (((struct { uint##SIZE##_t i; } __attribute__((packed)) *)(PTR))->i = (VAL))
  |  |  ------------------
  ------------------
  556|       |#else
  557|       |    p[0] = (val >> 24) & 0xff;
  558|       |    p[1] = (val >> 16) & 0xff;
  559|       |    p[2] = (val >>  8) & 0xff;
  560|       |    p[3] = (val      ) & 0xff;
  561|       |#endif
  562|     74|}
f_sched.c:load_32_be:
  596|    102|{
  597|    102|    const unsigned char *p = (const unsigned char *) cvp;
  598|       |#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
  599|       |    return GET(32,p);
  600|       |#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32) && !defined(__cplusplus)
  601|    102|    return GETSWAPPED(32,p);
  ------------------
  |  |  492|    102|# define GETSWAPPED(SIZE,PTR)           SWAP##SIZE(GET(SIZE,PTR))
  |  |  ------------------
  |  |  |  |  505|    102|# define SWAP32                 bswap_32
  |  |  ------------------
  ------------------
  602|       |#else
  603|       |    return (p[3] | (p[2] << 8)
  604|       |            | ((uint32_t) p[1] << 16)
  605|       |            | ((uint32_t) p[0] << 24));
  606|       |#endif
  607|    102|}

mit_des_cbc_encrypt:
  247|    111|{
  248|       |    /*
  249|       |     * Deal with encryption and decryption separately.
  250|       |     */
  251|    111|    if (enc)
  ------------------
  |  Branch (251:9): [True: 37, False: 74]
  ------------------
  252|     37|        des_cbc_encrypt(in, out, length, schedule, ivec);
  253|     74|    else
  254|     74|        des_cbc_decrypt(in, out, length, schedule, ivec);
  255|    111|    return 0;
  256|    111|}
fuzz_des.c:des_cbc_encrypt:
   67|     37|{
   68|     37|    unsigned DES_INT32 left, right;
   69|     37|    const unsigned DES_INT32 *kp;
   70|     37|    const unsigned char *ip;
   71|     37|    unsigned char *op;
   72|       |
   73|       |    /*
   74|       |     * Get key pointer here.  This won't need to be reinitialized
   75|       |     */
   76|     37|    kp = (const unsigned DES_INT32 *)schedule;
   77|       |
   78|       |    /*
   79|       |     * Initialize left and right with the contents of the initial
   80|       |     * vector.
   81|       |     */
   82|     37|    ip = ivec;
   83|     37|    GET_HALF_BLOCK(left, ip);
  ------------------
  |  |  278|     37|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   84|     37|    GET_HALF_BLOCK(right, ip);
  ------------------
  |  |  278|     37|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   85|       |
   86|       |    /*
   87|       |     * Suitably initialized, now work the length down 8 bytes
   88|       |     * at a time.
   89|       |     */
   90|     37|    ip = *in;
   91|     37|    op = *out;
   92|     74|    while (length > 0) {
  ------------------
  |  Branch (92:12): [True: 37, False: 37]
  ------------------
   93|       |        /*
   94|       |         * Get more input, xor it in.  If the length is
   95|       |         * greater than or equal to 8 this is straight
   96|       |         * forward.  Otherwise we have to fart around.
   97|       |         */
   98|     37|        if (length >= 8) {
  ------------------
  |  Branch (98:13): [True: 37, False: 0]
  ------------------
   99|     37|            unsigned DES_INT32 temp;
  100|     37|            GET_HALF_BLOCK(temp, ip);
  ------------------
  |  |  278|     37|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  101|     37|            left  ^= temp;
  102|     37|            GET_HALF_BLOCK(temp, ip);
  ------------------
  |  |  278|     37|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  103|     37|            right ^= temp;
  104|     37|            length -= 8;
  105|     37|        } else {
  106|       |            /*
  107|       |             * Oh, shoot.  We need to pad the
  108|       |             * end with zeroes.  Work backwards
  109|       |             * to do this.
  110|       |             */
  111|      0|            ip += (int) length;
  112|      0|            switch(length) {
  ------------------
  |  Branch (112:20): [True: 0, False: 0]
  ------------------
  113|      0|            case 7:
  ------------------
  |  Branch (113:13): [True: 0, False: 0]
  ------------------
  114|      0|                right ^= (*(--ip) & FF_UINT32) <<  8;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  115|      0|            case 6:
  ------------------
  |  Branch (115:13): [True: 0, False: 0]
  ------------------
  116|      0|                right ^= (*(--ip) & FF_UINT32) << 16;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  117|      0|            case 5:
  ------------------
  |  Branch (117:13): [True: 0, False: 0]
  ------------------
  118|      0|                right ^= (*(--ip) & FF_UINT32) << 24;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  119|      0|            case 4:
  ------------------
  |  Branch (119:13): [True: 0, False: 0]
  ------------------
  120|      0|                left  ^=  *(--ip) & FF_UINT32;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  121|      0|            case 3:
  ------------------
  |  Branch (121:13): [True: 0, False: 0]
  ------------------
  122|      0|                left  ^= (*(--ip) & FF_UINT32) <<  8;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  123|      0|            case 2:
  ------------------
  |  Branch (123:13): [True: 0, False: 0]
  ------------------
  124|      0|                left  ^= (*(--ip) & FF_UINT32) << 16;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  125|      0|            case 1:
  ------------------
  |  Branch (125:13): [True: 0, False: 0]
  ------------------
  126|      0|                left  ^= (*(--ip) & FF_UINT32) << 24;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  127|      0|                break;
  128|      0|            }
  129|      0|            length = 0;
  130|      0|        }
  131|       |
  132|       |        /*
  133|       |         * Encrypt what we have
  134|       |         */
  135|     37|        DES_DO_ENCRYPT(left, right, kp);
  ------------------
  |  |  270|     37|#define DES_DO_ENCRYPT DES_DO_ENCRYPT_1
  |  |  ------------------
  |  |  |  |  230|     37|    do {                                                                \
  |  |  |  |  231|     37|        int i;                                                          \
  |  |  |  |  232|     37|        unsigned DES_INT32 temp1;                                       \
  |  |  |  |  233|     37|        DEB (("do_encrypt %8lX %8lX \n", left, right));                 \
  |  |  |  |  234|     37|        DES_INITIAL_PERM((left), (right), (temp1));                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  161|     37|#define DES_INITIAL_PERM(left, right, temp) do {        \
  |  |  |  |  |  |  162|     37|        (temp) = DES_IP_RIGHT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|     37|    (((left) & 0xaaaaaaaa) |                                    \
  |  |  |  |  |  |  |  |  151|     37|     ( ( (unsigned DES_INT32) ((right) & 0xaaaaaaaa) ) >> 1))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  163|     37|        (right) = DES_IP_LEFT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  148|     37|    ((((left) & 0x55555555) << 1) | ((right) & 0x55555555))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  164|     37|        (left) = IP[((right) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  165|     37|            | (IP[((right) >> 16) & 0xff] << 1)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  166|     37|            | (IP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|     37|            | (IP[(right) & 0xff] << 3);                \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  168|     37|        (right) = IP[((temp) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|     37|            | (IP[((temp) >> 16) & 0xff] << 1)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  170|     37|            | (IP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     37|            | (IP[(temp) & 0xff] << 3);                 \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  172|     37|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (172:13): [Folded, False: 37]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  235|     37|        DEB (("  after IP %8lX %8lX\n", left, right));                  \
  |  |  |  |  236|    333|        for (i = 0; i < 8; i++) {                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:21): [True: 296, False: 37]
  |  |  |  |  ------------------
  |  |  |  |  237|    296|            DES_SP_ENCRYPT_ROUND((left), (right), (temp1), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    296|#define DES_SP_ENCRYPT_ROUND(left, right, temp, kp) do {        \
  |  |  |  |  |  |  105|    296|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(kp)++; \
  |  |  |  |  |  |  106|    296|        (left) ^= SP[0][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    296|            | SP[1][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    296|            | SP[2][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    296|            | SP[3][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    296|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(kp)++;  \
  |  |  |  |  |  |  111|    296|        (left) ^= SP[4][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    296|            | SP[5][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    296|            | SP[6][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    296|            | SP[7][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    296|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (115:13): [Folded, False: 296]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  238|    296|            DEB (("  round %2d %8lX %8lX \n", i*2, left, right));       \
  |  |  |  |  239|    296|            DES_SP_ENCRYPT_ROUND((right), (left), (temp1), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    296|#define DES_SP_ENCRYPT_ROUND(left, right, temp, kp) do {        \
  |  |  |  |  |  |  105|    296|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(kp)++; \
  |  |  |  |  |  |  106|    296|        (left) ^= SP[0][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    296|            | SP[1][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    296|            | SP[2][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    296|            | SP[3][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    296|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(kp)++;  \
  |  |  |  |  |  |  111|    296|        (left) ^= SP[4][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    296|            | SP[5][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    296|            | SP[6][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    296|            | SP[7][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    296|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (115:13): [Folded, False: 296]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  240|    296|            DEB (("  round %2d %8lX %8lX \n", 1+i*2, left, right));     \
  |  |  |  |  241|    296|        }                                                               \
  |  |  |  |  242|     37|        DES_FINAL_PERM((left), (right), (temp1));                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  197|     37|#define DES_FINAL_PERM(left, right, temp) do {          \
  |  |  |  |  |  |  198|     37|        (temp) = DES_FP_RIGHT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  186|     37|    (((left) & 0xf0f0f0f0) |                                    \
  |  |  |  |  |  |  |  |  187|     37|     ( ( (unsigned DES_INT32) ((right) & 0xf0f0f0f0) ) >> 4))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  199|     37|        (right) = DES_FP_LEFT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  184|     37|    ((((left) & 0x0f0f0f0f) << 4) | ((right) & 0x0f0f0f0f))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  200|     37|        (left) = (FP[((right) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  201|     37|            | (FP[((right) >> 16) & 0xff] << 4)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  202|     37|            | (FP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  203|     37|            |  FP[(right) & 0xff];                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     37|        (right) = (FP[((temp) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  205|     37|            | (FP[((temp) >> 16) & 0xff] << 4)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  206|     37|            | (FP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  207|     37|            |  FP[temp & 0xff];                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  208|     37|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (208:13): [Folded, False: 37]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  243|     37|        (kp) -= (2 * 16);                                               \
  |  |  |  |  244|     37|        DEB (("  after FP %8lX %8lX \n", left, right));                 \
  |  |  |  |  245|     37|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (245:14): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  136|       |
  137|       |        /*
  138|       |         * Copy the results out
  139|       |         */
  140|     37|        PUT_HALF_BLOCK(left, op);
  ------------------
  |  |  279|     37|#define PUT_HALF_BLOCK(lr, op)  (store_32_be(lr, op), (op) += 4)
  ------------------
  141|     37|        PUT_HALF_BLOCK(right, op);
  ------------------
  |  |  279|     37|#define PUT_HALF_BLOCK(lr, op)  (store_32_be(lr, op), (op) += 4)
  ------------------
  142|     37|    }
  143|     37|}
fuzz_des.c:des_cbc_decrypt:
  149|     74|{
  150|     74|    unsigned DES_INT32 left, right;
  151|     74|    const unsigned DES_INT32 *kp;
  152|     74|    const unsigned char *ip;
  153|     74|    unsigned char *op;
  154|     74|    unsigned DES_INT32 ocipherl, ocipherr;
  155|     74|    unsigned DES_INT32 cipherl, cipherr;
  156|       |
  157|       |    /*
  158|       |     * Get key pointer here.  This won't need to be reinitialized
  159|       |     */
  160|     74|    kp = (const unsigned DES_INT32 *)schedule;
  161|       |
  162|       |    /*
  163|       |     * Decrypting is harder than encrypting because of
  164|       |     * the necessity of remembering a lot more things.
  165|       |     * Should think about this a little more...
  166|       |     */
  167|       |
  168|     74|    if (length <= 0)
  ------------------
  |  Branch (168:9): [True: 0, False: 74]
  ------------------
  169|      0|        return;
  170|       |
  171|       |    /*
  172|       |     * Prime the old cipher with ivec.
  173|       |     */
  174|     74|    ip = ivec;
  175|     74|    GET_HALF_BLOCK(ocipherl, ip);
  ------------------
  |  |  278|     74|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  176|     74|    GET_HALF_BLOCK(ocipherr, ip);
  ------------------
  |  |  278|     74|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  177|       |
  178|       |    /*
  179|       |     * Now do this in earnest until we run out of length.
  180|       |     */
  181|     74|    ip = *in;
  182|     74|    op = *out;
  183|     74|    for (;;) {              /* check done inside loop */
  184|       |        /*
  185|       |         * Read a block from the input into left and
  186|       |         * right.  Save this cipher block for later.
  187|       |         */
  188|     74|        GET_HALF_BLOCK(left, ip);
  ------------------
  |  |  278|     74|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  189|     74|        GET_HALF_BLOCK(right, ip);
  ------------------
  |  |  278|     74|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  190|     74|        cipherl = left;
  191|     74|        cipherr = right;
  192|       |
  193|       |        /*
  194|       |         * Decrypt this.
  195|       |         */
  196|     74|        DES_DO_DECRYPT(left, right, kp);
  ------------------
  |  |  271|     74|#define DES_DO_DECRYPT DES_DO_DECRYPT_1
  |  |  ------------------
  |  |  |  |  248|     74|    do {                                                                \
  |  |  |  |  249|     74|        int i;                                                          \
  |  |  |  |  250|     74|        unsigned DES_INT32 temp2;                                       \
  |  |  |  |  251|     74|        DES_INITIAL_PERM((left), (right), (temp2));                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  161|     74|#define DES_INITIAL_PERM(left, right, temp) do {        \
  |  |  |  |  |  |  162|     74|        (temp) = DES_IP_RIGHT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|     74|    (((left) & 0xaaaaaaaa) |                                    \
  |  |  |  |  |  |  |  |  151|     74|     ( ( (unsigned DES_INT32) ((right) & 0xaaaaaaaa) ) >> 1))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  163|     74|        (right) = DES_IP_LEFT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  148|     74|    ((((left) & 0x55555555) << 1) | ((right) & 0x55555555))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  164|     74|        (left) = IP[((right) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     74|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  165|     74|            | (IP[((right) >> 16) & 0xff] << 1)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     74|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  166|     74|            | (IP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     74|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|     74|            | (IP[(right) & 0xff] << 3);                \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     74|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  168|     74|        (right) = IP[((temp) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     74|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|     74|            | (IP[((temp) >> 16) & 0xff] << 1)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     74|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  170|     74|            | (IP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     74|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     74|            | (IP[(temp) & 0xff] << 3);                 \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     74|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  172|     74|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (172:13): [Folded, False: 74]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  252|     74|        (kp) += (2 * 16);                                               \
  |  |  |  |  253|    666|        for (i = 0; i < 8; i++) {                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (253:21): [True: 592, False: 74]
  |  |  |  |  ------------------
  |  |  |  |  254|    592|            DES_SP_DECRYPT_ROUND((left), (right), (temp2), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|    592|#define DES_SP_DECRYPT_ROUND(left, right, temp, kp) do {                \
  |  |  |  |  |  |  118|    592|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(--(kp));        \
  |  |  |  |  |  |  119|    592|        (left) ^= SP[7][((temp)      ) & 0x3f]                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  120|    592|            | SP[6][((temp) >>  8) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  121|    592|            | SP[5][((temp) >> 16) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  122|    592|            | SP[4][((temp) >> 24) & 0x3f];                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  123|    592|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(--(kp));       \
  |  |  |  |  |  |  124|    592|        (left) ^= SP[3][((temp)      ) & 0x3f]                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  125|    592|            | SP[2][((temp) >>  8) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    592|            | SP[1][((temp) >> 16) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  127|    592|            | SP[0][((temp) >> 24) & 0x3f];                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  128|    592|    } while (0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (128:14): [Folded, False: 592]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  255|    592|            DES_SP_DECRYPT_ROUND((right), (left), (temp2), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|    592|#define DES_SP_DECRYPT_ROUND(left, right, temp, kp) do {                \
  |  |  |  |  |  |  118|    592|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(--(kp));        \
  |  |  |  |  |  |  119|    592|        (left) ^= SP[7][((temp)      ) & 0x3f]                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  120|    592|            | SP[6][((temp) >>  8) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  121|    592|            | SP[5][((temp) >> 16) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  122|    592|            | SP[4][((temp) >> 24) & 0x3f];                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  123|    592|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(--(kp));       \
  |  |  |  |  |  |  124|    592|        (left) ^= SP[3][((temp)      ) & 0x3f]                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  125|    592|            | SP[2][((temp) >>  8) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    592|            | SP[1][((temp) >> 16) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  127|    592|            | SP[0][((temp) >> 24) & 0x3f];                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    592|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  128|    592|    } while (0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (128:14): [Folded, False: 592]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  256|    592|        }                                                               \
  |  |  |  |  257|     74|        DES_FINAL_PERM((left), (right), (temp2));                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  197|     74|#define DES_FINAL_PERM(left, right, temp) do {          \
  |  |  |  |  |  |  198|     74|        (temp) = DES_FP_RIGHT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  186|     74|    (((left) & 0xf0f0f0f0) |                                    \
  |  |  |  |  |  |  |  |  187|     74|     ( ( (unsigned DES_INT32) ((right) & 0xf0f0f0f0) ) >> 4))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  199|     74|        (right) = DES_FP_LEFT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  184|     74|    ((((left) & 0x0f0f0f0f) << 4) | ((right) & 0x0f0f0f0f))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  200|     74|        (left) = (FP[((right) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     74|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  201|     74|            | (FP[((right) >> 16) & 0xff] << 4)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     74|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  202|     74|            | (FP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     74|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  203|     74|            |  FP[(right) & 0xff];                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     74|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     74|        (right) = (FP[((temp) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     74|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  205|     74|            | (FP[((temp) >> 16) & 0xff] << 4)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     74|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  206|     74|            | (FP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     74|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  207|     74|            |  FP[temp & 0xff];                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     74|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  208|     74|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (208:13): [Folded, False: 74]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  258|     74|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (258:14): [Folded, False: 74]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  197|       |
  198|       |        /*
  199|       |         * Xor with the old cipher to get plain
  200|       |         * text.  Output 8 or less bytes of this.
  201|       |         */
  202|     74|        left ^= ocipherl;
  203|     74|        right ^= ocipherr;
  204|     74|        if (length > 8) {
  ------------------
  |  Branch (204:13): [True: 0, False: 74]
  ------------------
  205|      0|            length -= 8;
  206|      0|            PUT_HALF_BLOCK(left, op);
  ------------------
  |  |  279|      0|#define PUT_HALF_BLOCK(lr, op)  (store_32_be(lr, op), (op) += 4)
  ------------------
  207|      0|            PUT_HALF_BLOCK(right, op);
  ------------------
  |  |  279|      0|#define PUT_HALF_BLOCK(lr, op)  (store_32_be(lr, op), (op) += 4)
  ------------------
  208|       |            /*
  209|       |             * Save current cipher block here
  210|       |             */
  211|      0|            ocipherl = cipherl;
  212|      0|            ocipherr = cipherr;
  213|     74|        } else {
  214|       |            /*
  215|       |             * Trouble here.  Start at end of output,
  216|       |             * work backwards.
  217|       |             */
  218|     74|            op += (int) length;
  219|     74|            switch(length) {
  ------------------
  |  Branch (219:20): [True: 74, False: 0]
  ------------------
  220|     74|            case 8:
  ------------------
  |  Branch (220:13): [True: 74, False: 0]
  ------------------
  221|     74|                *(--op) = (unsigned char) (right & 0xff);
  222|     74|            case 7:
  ------------------
  |  Branch (222:13): [True: 0, False: 74]
  ------------------
  223|     74|                *(--op) = (unsigned char) ((right >> 8) & 0xff);
  224|     74|            case 6:
  ------------------
  |  Branch (224:13): [True: 0, False: 74]
  ------------------
  225|     74|                *(--op) = (unsigned char) ((right >> 16) & 0xff);
  226|     74|            case 5:
  ------------------
  |  Branch (226:13): [True: 0, False: 74]
  ------------------
  227|     74|                *(--op) = (unsigned char) ((right >> 24) & 0xff);
  228|     74|            case 4:
  ------------------
  |  Branch (228:13): [True: 0, False: 74]
  ------------------
  229|     74|                *(--op) = (unsigned char) (left & 0xff);
  230|     74|            case 3:
  ------------------
  |  Branch (230:13): [True: 0, False: 74]
  ------------------
  231|     74|                *(--op) = (unsigned char) ((left >> 8) & 0xff);
  232|     74|            case 2:
  ------------------
  |  Branch (232:13): [True: 0, False: 74]
  ------------------
  233|     74|                *(--op) = (unsigned char) ((left >> 16) & 0xff);
  234|     74|            case 1:
  ------------------
  |  Branch (234:13): [True: 0, False: 74]
  ------------------
  235|     74|                *(--op) = (unsigned char) ((left >> 24) & 0xff);
  236|     74|                break;
  237|     74|            }
  238|     74|            break;          /* we're done */
  239|     74|        }
  240|     74|    }
  241|     74|}

mit_des_cbc_cksum:
   57|     37|{
   58|     37|    unsigned DES_INT32 left, right;
   59|     37|    const unsigned DES_INT32 *kp;
   60|     37|    const unsigned char *ip;
   61|     37|    unsigned char *op;
   62|     37|    DES_INT32 len;
  ------------------
  |  |   85|     37|#define DES_INT32 int
  ------------------
   63|       |
   64|       |    /*
   65|       |     * Initialize left and right with the contents of the initial
   66|       |     * vector.
   67|       |     */
   68|     37|    ip = ivec;
   69|     37|    GET_HALF_BLOCK(left, ip);
  ------------------
  |  |  278|     37|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   70|     37|    GET_HALF_BLOCK(right, ip);
  ------------------
  |  |  278|     37|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   71|       |
   72|       |    /*
   73|       |     * Suitably initialized, now work the length down 8 bytes
   74|       |     * at a time.
   75|       |     */
   76|     37|    ip = in;
   77|     37|    len = length;
   78|     74|    while (len > 0) {
  ------------------
  |  Branch (78:12): [True: 37, False: 37]
  ------------------
   79|       |        /*
   80|       |         * Get more input, xor it in.  If the length is
   81|       |         * greater than or equal to 8 this is straight
   82|       |         * forward.  Otherwise we have to fart around.
   83|       |         */
   84|     37|        if (len >= 8) {
  ------------------
  |  Branch (84:13): [True: 37, False: 0]
  ------------------
   85|     37|            unsigned DES_INT32 temp;
   86|     37|            GET_HALF_BLOCK(temp, ip);
  ------------------
  |  |  278|     37|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   87|     37|            left  ^= temp;
   88|     37|            GET_HALF_BLOCK(temp, ip);
  ------------------
  |  |  278|     37|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   89|     37|            right ^= temp;
   90|     37|            len -= 8;
   91|     37|        } else {
   92|       |            /*
   93|       |             * Oh, shoot.  We need to pad the
   94|       |             * end with zeroes.  Work backwards
   95|       |             * to do this.
   96|       |             */
   97|      0|            ip += (int) len;
   98|      0|            switch(len) {
  ------------------
  |  Branch (98:20): [True: 0, False: 0]
  ------------------
   99|      0|            case 7:
  ------------------
  |  Branch (99:13): [True: 0, False: 0]
  ------------------
  100|      0|                right ^= (*(--ip) & FF_UINT32) <<  8;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  101|      0|            case 6:
  ------------------
  |  Branch (101:13): [True: 0, False: 0]
  ------------------
  102|      0|                right ^= (*(--ip) & FF_UINT32) << 16;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  103|      0|            case 5:
  ------------------
  |  Branch (103:13): [True: 0, False: 0]
  ------------------
  104|      0|                right ^= (*(--ip) & FF_UINT32) << 24;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  105|      0|            case 4:
  ------------------
  |  Branch (105:13): [True: 0, False: 0]
  ------------------
  106|      0|                left  ^=  *(--ip) & FF_UINT32;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  107|      0|            case 3:
  ------------------
  |  Branch (107:13): [True: 0, False: 0]
  ------------------
  108|      0|                left  ^= (*(--ip) & FF_UINT32) <<  8;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  109|      0|            case 2:
  ------------------
  |  Branch (109:13): [True: 0, False: 0]
  ------------------
  110|      0|                left  ^= (*(--ip) & FF_UINT32) << 16;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  111|      0|            case 1:
  ------------------
  |  Branch (111:13): [True: 0, False: 0]
  ------------------
  112|      0|                left  ^= (*(--ip) & FF_UINT32) << 24;
  ------------------
  |  |  283|      0|#define FF_UINT32       ((unsigned DES_INT32) 0xFF)
  ------------------
  113|      0|                break;
  114|      0|            }
  115|      0|            len = 0;
  116|      0|        }
  117|       |
  118|       |        /*
  119|       |         * Encrypt what we have
  120|       |         */
  121|     37|        kp = (const unsigned DES_INT32 *)schedule;
  122|     37|        DES_DO_ENCRYPT(left, right, kp);
  ------------------
  |  |  270|     37|#define DES_DO_ENCRYPT DES_DO_ENCRYPT_1
  |  |  ------------------
  |  |  |  |  230|     37|    do {                                                                \
  |  |  |  |  231|     37|        int i;                                                          \
  |  |  |  |  232|     37|        unsigned DES_INT32 temp1;                                       \
  |  |  |  |  233|     37|        DEB (("do_encrypt %8lX %8lX \n", left, right));                 \
  |  |  |  |  234|     37|        DES_INITIAL_PERM((left), (right), (temp1));                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  161|     37|#define DES_INITIAL_PERM(left, right, temp) do {        \
  |  |  |  |  |  |  162|     37|        (temp) = DES_IP_RIGHT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|     37|    (((left) & 0xaaaaaaaa) |                                    \
  |  |  |  |  |  |  |  |  151|     37|     ( ( (unsigned DES_INT32) ((right) & 0xaaaaaaaa) ) >> 1))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  163|     37|        (right) = DES_IP_LEFT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  148|     37|    ((((left) & 0x55555555) << 1) | ((right) & 0x55555555))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  164|     37|        (left) = IP[((right) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  165|     37|            | (IP[((right) >> 16) & 0xff] << 1)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  166|     37|            | (IP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|     37|            | (IP[(right) & 0xff] << 3);                \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  168|     37|        (right) = IP[((temp) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|     37|            | (IP[((temp) >> 16) & 0xff] << 1)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  170|     37|            | (IP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     37|            | (IP[(temp) & 0xff] << 3);                 \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     37|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  172|     37|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (172:13): [Folded, False: 37]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  235|     37|        DEB (("  after IP %8lX %8lX\n", left, right));                  \
  |  |  |  |  236|    333|        for (i = 0; i < 8; i++) {                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:21): [True: 296, False: 37]
  |  |  |  |  ------------------
  |  |  |  |  237|    296|            DES_SP_ENCRYPT_ROUND((left), (right), (temp1), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    296|#define DES_SP_ENCRYPT_ROUND(left, right, temp, kp) do {        \
  |  |  |  |  |  |  105|    296|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(kp)++; \
  |  |  |  |  |  |  106|    296|        (left) ^= SP[0][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    296|            | SP[1][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    296|            | SP[2][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    296|            | SP[3][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    296|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(kp)++;  \
  |  |  |  |  |  |  111|    296|        (left) ^= SP[4][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    296|            | SP[5][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    296|            | SP[6][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    296|            | SP[7][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    296|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (115:13): [Folded, False: 296]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  238|    296|            DEB (("  round %2d %8lX %8lX \n", i*2, left, right));       \
  |  |  |  |  239|    296|            DES_SP_ENCRYPT_ROUND((right), (left), (temp1), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    296|#define DES_SP_ENCRYPT_ROUND(left, right, temp, kp) do {        \
  |  |  |  |  |  |  105|    296|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(kp)++; \
  |  |  |  |  |  |  106|    296|        (left) ^= SP[0][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    296|            | SP[1][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    296|            | SP[2][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    296|            | SP[3][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    296|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(kp)++;  \
  |  |  |  |  |  |  111|    296|        (left) ^= SP[4][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    296|            | SP[5][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    296|            | SP[6][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    296|            | SP[7][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    296|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    296|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (115:13): [Folded, False: 296]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  240|    296|            DEB (("  round %2d %8lX %8lX \n", 1+i*2, left, right));     \
  |  |  |  |  241|    296|        }                                                               \
  |  |  |  |  242|     37|        DES_FINAL_PERM((left), (right), (temp1));                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  197|     37|#define DES_FINAL_PERM(left, right, temp) do {          \
  |  |  |  |  |  |  198|     37|        (temp) = DES_FP_RIGHT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  186|     37|    (((left) & 0xf0f0f0f0) |                                    \
  |  |  |  |  |  |  |  |  187|     37|     ( ( (unsigned DES_INT32) ((right) & 0xf0f0f0f0) ) >> 4))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  199|     37|        (right) = DES_FP_LEFT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  184|     37|    ((((left) & 0x0f0f0f0f) << 4) | ((right) & 0x0f0f0f0f))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  200|     37|        (left) = (FP[((right) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  201|     37|            | (FP[((right) >> 16) & 0xff] << 4)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  202|     37|            | (FP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  203|     37|            |  FP[(right) & 0xff];                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     37|        (right) = (FP[((temp) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  205|     37|            | (FP[((temp) >> 16) & 0xff] << 4)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  206|     37|            | (FP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  207|     37|            |  FP[temp & 0xff];                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     37|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  208|     37|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (208:13): [Folded, False: 37]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  243|     37|        (kp) -= (2 * 16);                                               \
  |  |  |  |  244|     37|        DEB (("  after FP %8lX %8lX \n", left, right));                 \
  |  |  |  |  245|     37|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (245:14): [Folded, False: 37]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  123|     37|    }
  124|       |
  125|       |    /*
  126|       |     * Done.  Left and right have the checksum.  Put it into
  127|       |     * the output.
  128|       |     */
  129|     37|    op = out;
  130|     37|    PUT_HALF_BLOCK(left, op);
  ------------------
  |  |  279|     37|#define PUT_HALF_BLOCK(lr, op)  (store_32_be(lr, op), (op) += 4)
  ------------------
  131|     37|    PUT_HALF_BLOCK(right, op);
  ------------------
  |  |  279|     37|#define PUT_HALF_BLOCK(lr, op)  (store_32_be(lr, op), (op) += 4)
  ------------------
  132|       |
  133|       |    /*
  134|       |     * Return right.  I'll bet the MIT code returns this
  135|       |     * inconsistantly (with the low order byte of the checksum
  136|       |     * not always in the low order byte of the DES_INT32).  We won't.
  137|       |     */
  138|     37|    return right & 0xFFFFFFFFUL;
  139|     37|}

mit_des_check_key_parity:
   50|     51|{
   51|     51|    unsigned int i;
   52|       |
   53|    401|    for (i=0; i<sizeof(mit_des_cblock); i++)
  ------------------
  |  Branch (53:15): [True: 359, False: 42]
  ------------------
   54|    359|    {
   55|    359|        if((key[i] & 1) == parity_char(0xfe&key[i]))
  ------------------
  |  |   24|    359|#define parity_char(x) pstep(pstep(pstep((x),4),2),1)
  |  |  ------------------
  |  |  |  |   23|    359|#define pstep(x,step) (((x)&smask(step))^(((x)>>step)&smask(step)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|    359|#define smask(step) ((1<<step)-1)
  |  |  |  |  ------------------
  |  |  |  |               #define pstep(x,step) (((x)&smask(step))^(((x)>>step)&smask(step)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   22|    359|#define smask(step) ((1<<step)-1)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (55:12): [True: 9, False: 350]
  ------------------
   56|      9|        {
   57|      9|            return 0;
   58|      9|        }
   59|    359|    }
   60|       |
   61|     42|    return(1);
   62|     51|}

mit_des_make_key_sched:
  245|     51|{
  246|     51|    unsigned DES_INT32 c, d;
  247|       |
  248|     51|    {
  249|       |        /*
  250|       |         * Need a pointer for the keys and a temporary DES_INT32
  251|       |         */
  252|     51|        const unsigned char *k;
  253|     51|        unsigned DES_INT32 tmp;
  254|       |
  255|       |        /*
  256|       |         * Fetch the key into something we can work with
  257|       |         */
  258|     51|        k = key;
  259|       |
  260|       |        /*
  261|       |         * The first permutted choice gives us the 28 bits for C0 and
  262|       |         * 28 for D0.  C0 gets 12 bits from the left key and 16 from
  263|       |         * the right, while D0 gets 16 from the left and 12 from the
  264|       |         * right.  The code knows which bits go where.
  265|       |         */
  266|     51|        tmp = load_32_be(k), k += 4;
  267|       |
  268|     51|        c =  PC1_CL[(tmp >> 29) & 0x7]
  269|     51|            | (PC1_CL[(tmp >> 21) & 0x7] << 1)
  270|     51|            | (PC1_CL[(tmp >> 13) & 0x7] << 2)
  271|     51|            | (PC1_CL[(tmp >>  5) & 0x7] << 3);
  272|     51|        d =  PC1_DL[(tmp >> 25) & 0xf]
  273|     51|            | (PC1_DL[(tmp >> 17) & 0xf] << 1)
  274|     51|            | (PC1_DL[(tmp >>  9) & 0xf] << 2)
  275|     51|            | (PC1_DL[(tmp >>  1) & 0xf] << 3);
  276|       |
  277|     51|        tmp = load_32_be(k), k += 4;
  278|       |
  279|     51|        c |= PC1_CR[(tmp >> 28) & 0xf]
  280|     51|            | (PC1_CR[(tmp >> 20) & 0xf] << 1)
  281|     51|            | (PC1_CR[(tmp >> 12) & 0xf] << 2)
  282|     51|            | (PC1_CR[(tmp >>  4) & 0xf] << 3);
  283|     51|        d |= PC1_DR[(tmp >> 25) & 0x7]
  284|     51|            | (PC1_DR[(tmp >> 17) & 0x7] << 1)
  285|     51|            | (PC1_DR[(tmp >>  9) & 0x7] << 2)
  286|     51|            | (PC1_DR[(tmp >>  1) & 0x7] << 3);
  287|     51|    }
  288|       |
  289|     51|    {
  290|       |        /*
  291|       |         * Need several temporaries in here
  292|       |         */
  293|     51|        unsigned DES_INT32 ltmp, rtmp;
  294|     51|        unsigned DES_INT32 *k;
  295|     51|        int two_bit_shifts;
  296|     51|        int i;
  297|       |        /*
  298|       |         * Now iterate to compute the key schedule.  Note that we
  299|       |         * record the entire set of subkeys in 6 bit chunks since
  300|       |         * they are used that way.  At 6 bits/char, we need
  301|       |         * 48/6 char's/subkey * 16 subkeys/encryption == 128 bytes.
  302|       |         * The schedule must be this big.
  303|       |         */
  304|     51|        k = (unsigned DES_INT32 *)schedule;
  305|     51|        two_bit_shifts = TWO_BIT_SHIFTS;
  ------------------
  |  |   74|     51|#define TWO_BIT_SHIFTS  0x7efc
  ------------------
  306|    867|        for (i = 16; i > 0; i--) {
  ------------------
  |  Branch (306:22): [True: 816, False: 51]
  ------------------
  307|       |            /*
  308|       |             * Do the rotation.  One bit and two bit rotations
  309|       |             * are done separately.  Note C and D are 28 bits.
  310|       |             */
  311|    816|            if (two_bit_shifts & 0x1) {
  ------------------
  |  Branch (311:17): [True: 612, False: 204]
  ------------------
  312|    612|                c = ((c << 2) & 0xffffffc) | (c >> 26);
  313|    612|                d = ((d << 2) & 0xffffffc) | (d >> 26);
  314|    612|            } else {
  315|    204|                c = ((c << 1) & 0xffffffe) | (c >> 27);
  316|    204|                d = ((d << 1) & 0xffffffe) | (d >> 27);
  317|    204|            }
  318|    816|            two_bit_shifts >>= 1;
  319|       |
  320|       |            /*
  321|       |             * Apply permutted choice 2 to C to get the first
  322|       |             * 24 bits worth of keys.  Note that bits 9, 18, 22
  323|       |             * and 25 (using DES numbering) in C are unused.  The
  324|       |             * shift-mask stuff is done to delete these bits from
  325|       |             * the indices, since this cuts the table size in half.
  326|       |             *
  327|       |             * The table is torqued, by the way.  If the standard
  328|       |             * byte order for this (high to low order) is 1234,
  329|       |             * the table actually gives us 4132.
  330|       |             */
  331|    816|            ltmp = PC2_C[0][((c >> 22) & 0x3f)]
  332|    816|                | PC2_C[1][((c >> 15) & 0xf) | ((c >> 16) & 0x30)]
  333|    816|                | PC2_C[2][((c >>  4) & 0x3) | ((c >>  9) & 0x3c)]
  334|    816|                | PC2_C[3][((c      ) & 0x7) | ((c >>  4) & 0x38)];
  335|       |            /*
  336|       |             * Apply permutted choice 2 to D to get the other half.
  337|       |             * Here, bits 7, 10, 15 and 26 go unused.  The sqeezing
  338|       |             * actually turns out to be cheaper here.
  339|       |             *
  340|       |             * This table is similarly torqued.  If the standard
  341|       |             * byte order is 5678, the table has the bytes permuted
  342|       |             * to give us 7685.
  343|       |             */
  344|    816|            rtmp = PC2_D[0][((d >> 22) & 0x3f)]
  345|    816|                | PC2_D[1][((d >> 14) & 0xf) | ((d >> 15) & 0x30)]
  346|    816|                | PC2_D[2][((d >>  7) & 0x3f)]
  347|    816|                | PC2_D[3][((d      ) & 0x3) | ((d >>  1) & 0x3c)];
  348|       |
  349|       |            /*
  350|       |             * Make up two words of the key schedule, with a
  351|       |             * byte order which is convenient for the DES
  352|       |             * inner loop.  The high order (first) word will
  353|       |             * hold bytes 7135 (high to low order) while the
  354|       |             * second holds bytes 4682.
  355|       |             */
  356|    816|            *k++ = (ltmp & 0x00ffff00) | (rtmp & 0xff0000ff);
  357|    816|            *k++ = (ltmp & 0xff0000ff) | (rtmp & 0x00ffff00);
  358|    816|        }
  359|     51|    }
  360|     51|    return (0);
  361|     51|}

mit_des_key_sched:
   53|     51|{
   54|     51|    mit_des_make_key_sched(k,schedule);
   55|       |
   56|     51|    if (!mit_des_check_key_parity(k))   /* bad parity --> return -1 */
  ------------------
  |  Branch (56:9): [True: 9, False: 42]
  ------------------
   57|      9|        return(-1);
   58|       |
   59|     42|    if (mit_des_is_weak_key(k))
  ------------------
  |  Branch (59:9): [True: 5, False: 37]
  ------------------
   60|      5|        return(-2);
   61|       |
   62|       |    /* if key was good, return 0 */
   63|     37|    return 0;
   64|     42|}

mit_des_is_weak_key:
   78|     42|{
   79|     42|    unsigned int i;
   80|     42|    const mit_des_cblock *weak_p = weak;
   81|       |
   82|    649|    for (i = 0; i < (sizeof(weak)/sizeof(mit_des_cblock)); i++) {
  ------------------
  |  Branch (82:17): [True: 612, False: 37]
  ------------------
   83|    612|        if (!memcmp(weak_p++,key,sizeof(mit_des_cblock)))
  ------------------
  |  Branch (83:13): [True: 5, False: 607]
  ------------------
   84|      5|            return 1;
   85|    612|    }
   86|       |
   87|     37|    return 0;
   88|     42|}

LLVMFuzzerTestOneInput:
   82|     89|{
   83|     89|    krb5_error_code ret;
   84|     89|    mit_des_key_schedule sched;
   85|     89|    uint8_t *data_in, input[8];
   86|       |
   87|     89|    if (size < kMinInputLength || size > kMaxInputLength)
  ------------------
  |  |   38|    178|#define kMinInputLength 32
  ------------------
                  if (size < kMinInputLength || size > kMaxInputLength)
  ------------------
  |  |   39|     81|#define kMaxInputLength 128
  ------------------
  |  Branch (87:9): [True: 8, False: 81]
  |  Branch (87:35): [True: 30, False: 51]
  ------------------
   88|     38|        return 0;
   89|       |
   90|     51|    memcpy(input, data, 8);
   91|     51|    ret = mit_des_key_sched(input, sched);
   92|     51|    if (ret)
  ------------------
  |  Branch (92:9): [True: 14, False: 37]
  ------------------
   93|     14|        return 0;
   94|       |
   95|     37|    memcpy(input, data + 8, 8);
   96|     37|    fuzz_des(input, sched);
   97|       |
   98|     37|    memcpy(input, data + 16, 8);
   99|     37|    fuzz_decrypt(input, sched);
  100|       |
  101|     37|    data_in = k5memdup(data + 24, size - 24, &ret);
  102|     37|    if (ret)
  ------------------
  |  Branch (102:9): [True: 0, False: 37]
  ------------------
  103|      0|        return 0;
  104|       |
  105|     37|    fuzz_cksum(data_in, sched);
  106|     37|    free(data_in);
  107|       |
  108|     37|    return 0;
  109|     37|}
fuzz_des.c:fuzz_des:
   47|     37|{
   48|     37|    uint8_t encrypt[8], decrypt[8];
   49|       |
   50|     37|    mit_des_cbc_encrypt((const mit_des_cblock *)input,
   51|     37|                        (mit_des_cblock *)encrypt, 8,
   52|     37|                        sched, default_ivec, MIT_DES_ENCRYPT);
  ------------------
  |  |  123|     37|#define MIT_DES_ENCRYPT 1
  ------------------
   53|       |
   54|     37|    mit_des_cbc_encrypt((const mit_des_cblock *)encrypt,
   55|     37|                        (mit_des_cblock *)decrypt, 8,
   56|     37|                        sched, default_ivec, MIT_DES_DECRYPT);
  ------------------
  |  |  124|     37|#define MIT_DES_DECRYPT 0
  ------------------
   57|       |
   58|     37|    if (memcmp(input, decrypt, 8) != 0)
  ------------------
  |  Branch (58:9): [True: 0, False: 37]
  ------------------
   59|      0|        abort();
   60|     37|}
fuzz_des.c:fuzz_decrypt:
   64|     37|{
   65|     37|    uint8_t output[8];
   66|       |
   67|     37|    mit_des_cbc_encrypt((const mit_des_cblock *)input,
   68|     37|                        (mit_des_cblock *)output, 8,
   69|     37|                        sched, default_ivec, MIT_DES_DECRYPT);
  ------------------
  |  |  124|     37|#define MIT_DES_DECRYPT 0
  ------------------
   70|     37|}
fuzz_des.c:fuzz_cksum:
   74|     37|{
   75|     37|    uint8_t output[8];
   76|       |
   77|     37|    mit_des_cbc_cksum(input, output, 8, sched, default_ivec);
   78|     37|}

