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

fuzz_des.c:load_32_be:
  596|    432|{
  597|    432|    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|    432|    return GETSWAPPED(32,p);
  ------------------
  |  |  492|    432|# define GETSWAPPED(SIZE,PTR)           SWAP##SIZE(GET(SIZE,PTR))
  |  |  ------------------
  |  |  |  |  505|    432|# 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|    432|}
fuzz_des.c:store_32_be:
  550|     72|{
  551|     72|    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|     72|    PUTSWAPPED(32,p,val);
  ------------------
  |  |  491|     72|# define PUTSWAPPED(SIZE,PTR,VAL)       PUT(SIZE,PTR,SWAP##SIZE(VAL))
  |  |  ------------------
  |  |  |  |  489|     72|# 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|     72|}
f_cksum.c:load_32_be:
  596|    144|{
  597|    144|    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|    144|    return GETSWAPPED(32,p);
  ------------------
  |  |  492|    144|# define GETSWAPPED(SIZE,PTR)           SWAP##SIZE(GET(SIZE,PTR))
  |  |  ------------------
  |  |  |  |  505|    144|# 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|    144|}
f_cksum.c:store_32_be:
  550|     72|{
  551|     72|    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|     72|    PUTSWAPPED(32,p,val);
  ------------------
  |  |  491|     72|# define PUTSWAPPED(SIZE,PTR,VAL)       PUT(SIZE,PTR,SWAP##SIZE(VAL))
  |  |  ------------------
  |  |  |  |  489|     72|# 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|     72|}
f_sched.c:load_32_be:
  596|    100|{
  597|    100|    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|    100|    return GETSWAPPED(32,p);
  ------------------
  |  |  492|    100|# define GETSWAPPED(SIZE,PTR)           SWAP##SIZE(GET(SIZE,PTR))
  |  |  ------------------
  |  |  |  |  505|    100|# 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|    100|}

mit_des_cbc_encrypt:
  247|    108|{
  248|       |    /*
  249|       |     * Deal with encryption and decryption separately.
  250|       |     */
  251|    108|    if (enc)
  ------------------
  |  Branch (251:9): [True: 36, False: 72]
  ------------------
  252|     36|        des_cbc_encrypt(in, out, length, schedule, ivec);
  253|     72|    else
  254|     72|        des_cbc_decrypt(in, out, length, schedule, ivec);
  255|    108|    return 0;
  256|    108|}
fuzz_des.c:des_cbc_encrypt:
   67|     36|{
   68|     36|    unsigned DES_INT32 left, right;
   69|     36|    const unsigned DES_INT32 *kp;
   70|     36|    const unsigned char *ip;
   71|     36|    unsigned char *op;
   72|       |
   73|       |    /*
   74|       |     * Get key pointer here.  This won't need to be reinitialized
   75|       |     */
   76|     36|    kp = (const unsigned DES_INT32 *)schedule;
   77|       |
   78|       |    /*
   79|       |     * Initialize left and right with the contents of the initial
   80|       |     * vector.
   81|       |     */
   82|     36|    ip = ivec;
   83|     36|    GET_HALF_BLOCK(left, ip);
  ------------------
  |  |  278|     36|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   84|     36|    GET_HALF_BLOCK(right, ip);
  ------------------
  |  |  278|     36|#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|     36|    ip = *in;
   91|     36|    op = *out;
   92|     72|    while (length > 0) {
  ------------------
  |  Branch (92:12): [True: 36, False: 36]
  ------------------
   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|     36|        if (length >= 8) {
  ------------------
  |  Branch (98:13): [True: 36, False: 0]
  ------------------
   99|     36|            unsigned DES_INT32 temp;
  100|     36|            GET_HALF_BLOCK(temp, ip);
  ------------------
  |  |  278|     36|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  101|     36|            left  ^= temp;
  102|     36|            GET_HALF_BLOCK(temp, ip);
  ------------------
  |  |  278|     36|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  103|     36|            right ^= temp;
  104|     36|            length -= 8;
  105|     36|        } 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|     36|        DES_DO_ENCRYPT(left, right, kp);
  ------------------
  |  |  270|     36|#define DES_DO_ENCRYPT DES_DO_ENCRYPT_1
  |  |  ------------------
  |  |  |  |  230|     36|    do {                                                                \
  |  |  |  |  231|     36|        int i;                                                          \
  |  |  |  |  232|     36|        unsigned DES_INT32 temp1;                                       \
  |  |  |  |  233|     36|        DEB (("do_encrypt %8lX %8lX \n", left, right));                 \
  |  |  |  |  234|     36|        DES_INITIAL_PERM((left), (right), (temp1));                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  161|     36|#define DES_INITIAL_PERM(left, right, temp) do {        \
  |  |  |  |  |  |  162|     36|        (temp) = DES_IP_RIGHT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|     36|    (((left) & 0xaaaaaaaa) |                                    \
  |  |  |  |  |  |  |  |  151|     36|     ( ( (unsigned DES_INT32) ((right) & 0xaaaaaaaa) ) >> 1))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  163|     36|        (right) = DES_IP_LEFT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  148|     36|    ((((left) & 0x55555555) << 1) | ((right) & 0x55555555))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  164|     36|        (left) = IP[((right) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  165|     36|            | (IP[((right) >> 16) & 0xff] << 1)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  166|     36|            | (IP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|     36|            | (IP[(right) & 0xff] << 3);                \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  168|     36|        (right) = IP[((temp) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|     36|            | (IP[((temp) >> 16) & 0xff] << 1)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  170|     36|            | (IP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     36|            | (IP[(temp) & 0xff] << 3);                 \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  172|     36|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (172:13): [Folded, False: 36]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  235|     36|        DEB (("  after IP %8lX %8lX\n", left, right));                  \
  |  |  |  |  236|    324|        for (i = 0; i < 8; i++) {                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:21): [True: 288, False: 36]
  |  |  |  |  ------------------
  |  |  |  |  237|    288|            DES_SP_ENCRYPT_ROUND((left), (right), (temp1), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    288|#define DES_SP_ENCRYPT_ROUND(left, right, temp, kp) do {        \
  |  |  |  |  |  |  105|    288|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(kp)++; \
  |  |  |  |  |  |  106|    288|        (left) ^= SP[0][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    288|            | SP[1][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    288|            | SP[2][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    288|            | SP[3][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    288|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(kp)++;  \
  |  |  |  |  |  |  111|    288|        (left) ^= SP[4][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    288|            | SP[5][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    288|            | SP[6][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    288|            | SP[7][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    288|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (115:13): [Folded, False: 288]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  238|    288|            DEB (("  round %2d %8lX %8lX \n", i*2, left, right));       \
  |  |  |  |  239|    288|            DES_SP_ENCRYPT_ROUND((right), (left), (temp1), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    288|#define DES_SP_ENCRYPT_ROUND(left, right, temp, kp) do {        \
  |  |  |  |  |  |  105|    288|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(kp)++; \
  |  |  |  |  |  |  106|    288|        (left) ^= SP[0][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    288|            | SP[1][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    288|            | SP[2][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    288|            | SP[3][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    288|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(kp)++;  \
  |  |  |  |  |  |  111|    288|        (left) ^= SP[4][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    288|            | SP[5][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    288|            | SP[6][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    288|            | SP[7][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    288|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (115:13): [Folded, False: 288]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  240|    288|            DEB (("  round %2d %8lX %8lX \n", 1+i*2, left, right));     \
  |  |  |  |  241|    288|        }                                                               \
  |  |  |  |  242|     36|        DES_FINAL_PERM((left), (right), (temp1));                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  197|     36|#define DES_FINAL_PERM(left, right, temp) do {          \
  |  |  |  |  |  |  198|     36|        (temp) = DES_FP_RIGHT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  186|     36|    (((left) & 0xf0f0f0f0) |                                    \
  |  |  |  |  |  |  |  |  187|     36|     ( ( (unsigned DES_INT32) ((right) & 0xf0f0f0f0) ) >> 4))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  199|     36|        (right) = DES_FP_LEFT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  184|     36|    ((((left) & 0x0f0f0f0f) << 4) | ((right) & 0x0f0f0f0f))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  200|     36|        (left) = (FP[((right) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  201|     36|            | (FP[((right) >> 16) & 0xff] << 4)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  202|     36|            | (FP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  203|     36|            |  FP[(right) & 0xff];                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     36|        (right) = (FP[((temp) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  205|     36|            | (FP[((temp) >> 16) & 0xff] << 4)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  206|     36|            | (FP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  207|     36|            |  FP[temp & 0xff];                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  208|     36|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (208:13): [Folded, False: 36]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  243|     36|        (kp) -= (2 * 16);                                               \
  |  |  |  |  244|     36|        DEB (("  after FP %8lX %8lX \n", left, right));                 \
  |  |  |  |  245|     36|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (245:14): [Folded, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  136|       |
  137|       |        /*
  138|       |         * Copy the results out
  139|       |         */
  140|     36|        PUT_HALF_BLOCK(left, op);
  ------------------
  |  |  279|     36|#define PUT_HALF_BLOCK(lr, op)  (store_32_be(lr, op), (op) += 4)
  ------------------
  141|     36|        PUT_HALF_BLOCK(right, op);
  ------------------
  |  |  279|     36|#define PUT_HALF_BLOCK(lr, op)  (store_32_be(lr, op), (op) += 4)
  ------------------
  142|     36|    }
  143|     36|}
fuzz_des.c:des_cbc_decrypt:
  149|     72|{
  150|     72|    unsigned DES_INT32 left, right;
  151|     72|    const unsigned DES_INT32 *kp;
  152|     72|    const unsigned char *ip;
  153|     72|    unsigned char *op;
  154|     72|    unsigned DES_INT32 ocipherl, ocipherr;
  155|     72|    unsigned DES_INT32 cipherl, cipherr;
  156|       |
  157|       |    /*
  158|       |     * Get key pointer here.  This won't need to be reinitialized
  159|       |     */
  160|     72|    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|     72|    if (length <= 0)
  ------------------
  |  Branch (168:9): [True: 0, False: 72]
  ------------------
  169|      0|        return;
  170|       |
  171|       |    /*
  172|       |     * Prime the old cipher with ivec.
  173|       |     */
  174|     72|    ip = ivec;
  175|     72|    GET_HALF_BLOCK(ocipherl, ip);
  ------------------
  |  |  278|     72|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  176|     72|    GET_HALF_BLOCK(ocipherr, ip);
  ------------------
  |  |  278|     72|#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|     72|    ip = *in;
  182|     72|    op = *out;
  183|     72|    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|     72|        GET_HALF_BLOCK(left, ip);
  ------------------
  |  |  278|     72|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  189|     72|        GET_HALF_BLOCK(right, ip);
  ------------------
  |  |  278|     72|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
  190|     72|        cipherl = left;
  191|     72|        cipherr = right;
  192|       |
  193|       |        /*
  194|       |         * Decrypt this.
  195|       |         */
  196|     72|        DES_DO_DECRYPT(left, right, kp);
  ------------------
  |  |  271|     72|#define DES_DO_DECRYPT DES_DO_DECRYPT_1
  |  |  ------------------
  |  |  |  |  248|     72|    do {                                                                \
  |  |  |  |  249|     72|        int i;                                                          \
  |  |  |  |  250|     72|        unsigned DES_INT32 temp2;                                       \
  |  |  |  |  251|     72|        DES_INITIAL_PERM((left), (right), (temp2));                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  161|     72|#define DES_INITIAL_PERM(left, right, temp) do {        \
  |  |  |  |  |  |  162|     72|        (temp) = DES_IP_RIGHT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|     72|    (((left) & 0xaaaaaaaa) |                                    \
  |  |  |  |  |  |  |  |  151|     72|     ( ( (unsigned DES_INT32) ((right) & 0xaaaaaaaa) ) >> 1))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  163|     72|        (right) = DES_IP_LEFT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  148|     72|    ((((left) & 0x55555555) << 1) | ((right) & 0x55555555))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  164|     72|        (left) = IP[((right) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     72|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  165|     72|            | (IP[((right) >> 16) & 0xff] << 1)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     72|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  166|     72|            | (IP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     72|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|     72|            | (IP[(right) & 0xff] << 3);                \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     72|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  168|     72|        (right) = IP[((temp) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     72|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|     72|            | (IP[((temp) >> 16) & 0xff] << 1)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     72|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  170|     72|            | (IP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     72|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     72|            | (IP[(temp) & 0xff] << 3);                 \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     72|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  172|     72|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (172:13): [Folded, False: 72]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  252|     72|        (kp) += (2 * 16);                                               \
  |  |  |  |  253|    648|        for (i = 0; i < 8; i++) {                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (253:21): [True: 576, False: 72]
  |  |  |  |  ------------------
  |  |  |  |  254|    576|            DES_SP_DECRYPT_ROUND((left), (right), (temp2), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|    576|#define DES_SP_DECRYPT_ROUND(left, right, temp, kp) do {                \
  |  |  |  |  |  |  118|    576|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(--(kp));        \
  |  |  |  |  |  |  119|    576|        (left) ^= SP[7][((temp)      ) & 0x3f]                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  120|    576|            | SP[6][((temp) >>  8) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  121|    576|            | SP[5][((temp) >> 16) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  122|    576|            | SP[4][((temp) >> 24) & 0x3f];                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  123|    576|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(--(kp));       \
  |  |  |  |  |  |  124|    576|        (left) ^= SP[3][((temp)      ) & 0x3f]                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  125|    576|            | SP[2][((temp) >>  8) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    576|            | SP[1][((temp) >> 16) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  127|    576|            | SP[0][((temp) >> 24) & 0x3f];                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  128|    576|    } while (0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (128:14): [Folded, False: 576]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  255|    576|            DES_SP_DECRYPT_ROUND((right), (left), (temp2), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|    576|#define DES_SP_DECRYPT_ROUND(left, right, temp, kp) do {                \
  |  |  |  |  |  |  118|    576|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(--(kp));        \
  |  |  |  |  |  |  119|    576|        (left) ^= SP[7][((temp)      ) & 0x3f]                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  120|    576|            | SP[6][((temp) >>  8) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  121|    576|            | SP[5][((temp) >> 16) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  122|    576|            | SP[4][((temp) >> 24) & 0x3f];                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  123|    576|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(--(kp));       \
  |  |  |  |  |  |  124|    576|        (left) ^= SP[3][((temp)      ) & 0x3f]                          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  125|    576|            | SP[2][((temp) >>  8) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  126|    576|            | SP[1][((temp) >> 16) & 0x3f]                              \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  127|    576|            | SP[0][((temp) >> 24) & 0x3f];                             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    576|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  128|    576|    } while (0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (128:14): [Folded, False: 576]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  256|    576|        }                                                               \
  |  |  |  |  257|     72|        DES_FINAL_PERM((left), (right), (temp2));                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  197|     72|#define DES_FINAL_PERM(left, right, temp) do {          \
  |  |  |  |  |  |  198|     72|        (temp) = DES_FP_RIGHT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  186|     72|    (((left) & 0xf0f0f0f0) |                                    \
  |  |  |  |  |  |  |  |  187|     72|     ( ( (unsigned DES_INT32) ((right) & 0xf0f0f0f0) ) >> 4))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  199|     72|        (right) = DES_FP_LEFT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  184|     72|    ((((left) & 0x0f0f0f0f) << 4) | ((right) & 0x0f0f0f0f))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  200|     72|        (left) = (FP[((right) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     72|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  201|     72|            | (FP[((right) >> 16) & 0xff] << 4)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     72|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  202|     72|            | (FP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     72|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  203|     72|            |  FP[(right) & 0xff];                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     72|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     72|        (right) = (FP[((temp) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     72|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  205|     72|            | (FP[((temp) >> 16) & 0xff] << 4)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     72|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  206|     72|            | (FP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     72|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  207|     72|            |  FP[temp & 0xff];                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     72|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  208|     72|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (208:13): [Folded, False: 72]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  258|     72|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (258:14): [Folded, False: 72]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  197|       |
  198|       |        /*
  199|       |         * Xor with the old cipher to get plain
  200|       |         * text.  Output 8 or less bytes of this.
  201|       |         */
  202|     72|        left ^= ocipherl;
  203|     72|        right ^= ocipherr;
  204|     72|        if (length > 8) {
  ------------------
  |  Branch (204:13): [True: 0, False: 72]
  ------------------
  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|     72|        } else {
  214|       |            /*
  215|       |             * Trouble here.  Start at end of output,
  216|       |             * work backwards.
  217|       |             */
  218|     72|            op += (int) length;
  219|     72|            switch(length) {
  ------------------
  |  Branch (219:20): [True: 72, False: 0]
  ------------------
  220|     72|            case 8:
  ------------------
  |  Branch (220:13): [True: 72, False: 0]
  ------------------
  221|     72|                *(--op) = (unsigned char) (right & 0xff);
  222|     72|            case 7:
  ------------------
  |  Branch (222:13): [True: 0, False: 72]
  ------------------
  223|     72|                *(--op) = (unsigned char) ((right >> 8) & 0xff);
  224|     72|            case 6:
  ------------------
  |  Branch (224:13): [True: 0, False: 72]
  ------------------
  225|     72|                *(--op) = (unsigned char) ((right >> 16) & 0xff);
  226|     72|            case 5:
  ------------------
  |  Branch (226:13): [True: 0, False: 72]
  ------------------
  227|     72|                *(--op) = (unsigned char) ((right >> 24) & 0xff);
  228|     72|            case 4:
  ------------------
  |  Branch (228:13): [True: 0, False: 72]
  ------------------
  229|     72|                *(--op) = (unsigned char) (left & 0xff);
  230|     72|            case 3:
  ------------------
  |  Branch (230:13): [True: 0, False: 72]
  ------------------
  231|     72|                *(--op) = (unsigned char) ((left >> 8) & 0xff);
  232|     72|            case 2:
  ------------------
  |  Branch (232:13): [True: 0, False: 72]
  ------------------
  233|     72|                *(--op) = (unsigned char) ((left >> 16) & 0xff);
  234|     72|            case 1:
  ------------------
  |  Branch (234:13): [True: 0, False: 72]
  ------------------
  235|     72|                *(--op) = (unsigned char) ((left >> 24) & 0xff);
  236|     72|                break;
  237|     72|            }
  238|     72|            break;          /* we're done */
  239|     72|        }
  240|     72|    }
  241|     72|}

mit_des_cbc_cksum:
   57|     36|{
   58|     36|    unsigned DES_INT32 left, right;
   59|     36|    const unsigned DES_INT32 *kp;
   60|     36|    const unsigned char *ip;
   61|     36|    unsigned char *op;
   62|     36|    DES_INT32 len;
  ------------------
  |  |   85|     36|#define DES_INT32 int
  ------------------
   63|       |
   64|       |    /*
   65|       |     * Initialize left and right with the contents of the initial
   66|       |     * vector.
   67|       |     */
   68|     36|    ip = ivec;
   69|     36|    GET_HALF_BLOCK(left, ip);
  ------------------
  |  |  278|     36|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   70|     36|    GET_HALF_BLOCK(right, ip);
  ------------------
  |  |  278|     36|#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|     36|    ip = in;
   77|     36|    len = length;
   78|     72|    while (len > 0) {
  ------------------
  |  Branch (78:12): [True: 36, False: 36]
  ------------------
   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|     36|        if (len >= 8) {
  ------------------
  |  Branch (84:13): [True: 36, False: 0]
  ------------------
   85|     36|            unsigned DES_INT32 temp;
   86|     36|            GET_HALF_BLOCK(temp, ip);
  ------------------
  |  |  278|     36|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   87|     36|            left  ^= temp;
   88|     36|            GET_HALF_BLOCK(temp, ip);
  ------------------
  |  |  278|     36|#define GET_HALF_BLOCK(lr, ip)  ((lr) = load_32_be(ip), (ip) += 4)
  ------------------
   89|     36|            right ^= temp;
   90|     36|            len -= 8;
   91|     36|        } 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|     36|        kp = (const unsigned DES_INT32 *)schedule;
  122|     36|        DES_DO_ENCRYPT(left, right, kp);
  ------------------
  |  |  270|     36|#define DES_DO_ENCRYPT DES_DO_ENCRYPT_1
  |  |  ------------------
  |  |  |  |  230|     36|    do {                                                                \
  |  |  |  |  231|     36|        int i;                                                          \
  |  |  |  |  232|     36|        unsigned DES_INT32 temp1;                                       \
  |  |  |  |  233|     36|        DEB (("do_encrypt %8lX %8lX \n", left, right));                 \
  |  |  |  |  234|     36|        DES_INITIAL_PERM((left), (right), (temp1));                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  161|     36|#define DES_INITIAL_PERM(left, right, temp) do {        \
  |  |  |  |  |  |  162|     36|        (temp) = DES_IP_RIGHT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  150|     36|    (((left) & 0xaaaaaaaa) |                                    \
  |  |  |  |  |  |  |  |  151|     36|     ( ( (unsigned DES_INT32) ((right) & 0xaaaaaaaa) ) >> 1))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  163|     36|        (right) = DES_IP_LEFT_BITS((left), (right));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  148|     36|    ((((left) & 0x55555555) << 1) | ((right) & 0x55555555))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  164|     36|        (left) = IP[((right) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  165|     36|            | (IP[((right) >> 16) & 0xff] << 1)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  166|     36|            | (IP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|     36|            | (IP[(right) & 0xff] << 3);                \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  168|     36|        (right) = IP[((temp) >> 24) & 0xff]             \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|     36|            | (IP[((temp) >> 16) & 0xff] << 1)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  170|     36|            | (IP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     36|            | (IP[(temp) & 0xff] << 3);                 \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   50|     36|#define IP      des_IP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  172|     36|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (172:13): [Folded, False: 36]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  235|     36|        DEB (("  after IP %8lX %8lX\n", left, right));                  \
  |  |  |  |  236|    324|        for (i = 0; i < 8; i++) {                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:21): [True: 288, False: 36]
  |  |  |  |  ------------------
  |  |  |  |  237|    288|            DES_SP_ENCRYPT_ROUND((left), (right), (temp1), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    288|#define DES_SP_ENCRYPT_ROUND(left, right, temp, kp) do {        \
  |  |  |  |  |  |  105|    288|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(kp)++; \
  |  |  |  |  |  |  106|    288|        (left) ^= SP[0][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    288|            | SP[1][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    288|            | SP[2][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    288|            | SP[3][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    288|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(kp)++;  \
  |  |  |  |  |  |  111|    288|        (left) ^= SP[4][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    288|            | SP[5][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    288|            | SP[6][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    288|            | SP[7][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    288|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (115:13): [Folded, False: 288]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  238|    288|            DEB (("  round %2d %8lX %8lX \n", i*2, left, right));       \
  |  |  |  |  239|    288|            DES_SP_ENCRYPT_ROUND((right), (left), (temp1), (kp));       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|    288|#define DES_SP_ENCRYPT_ROUND(left, right, temp, kp) do {        \
  |  |  |  |  |  |  105|    288|        (temp) = (((right) >> 11) | ((right) << 21)) ^ *(kp)++; \
  |  |  |  |  |  |  106|    288|        (left) ^= SP[0][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  107|    288|            | SP[1][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  108|    288|            | SP[2][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  109|    288|            | SP[3][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    288|        (temp) = (((right) >> 23) | ((right) << 9)) ^ *(kp)++;  \
  |  |  |  |  |  |  111|    288|        (left) ^= SP[4][((temp) >> 24) & 0x3f]                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  112|    288|            | SP[5][((temp) >> 16) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  113|    288|            | SP[6][((temp) >>  8) & 0x3f]                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  114|    288|            | SP[7][((temp)      ) & 0x3f];                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   52|    288|#define SP      des_SP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  115|    288|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (115:13): [Folded, False: 288]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  240|    288|            DEB (("  round %2d %8lX %8lX \n", 1+i*2, left, right));     \
  |  |  |  |  241|    288|        }                                                               \
  |  |  |  |  242|     36|        DES_FINAL_PERM((left), (right), (temp1));                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  197|     36|#define DES_FINAL_PERM(left, right, temp) do {          \
  |  |  |  |  |  |  198|     36|        (temp) = DES_FP_RIGHT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  186|     36|    (((left) & 0xf0f0f0f0) |                                    \
  |  |  |  |  |  |  |  |  187|     36|     ( ( (unsigned DES_INT32) ((right) & 0xf0f0f0f0) ) >> 4))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  199|     36|        (right) = DES_FP_LEFT_BITS((right), (left));    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  184|     36|    ((((left) & 0x0f0f0f0f) << 4) | ((right) & 0x0f0f0f0f))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  200|     36|        (left) = (FP[((right) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  201|     36|            | (FP[((right) >> 16) & 0xff] << 4)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  202|     36|            | (FP[((right) >>  8) & 0xff] << 2)         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  203|     36|            |  FP[(right) & 0xff];                      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  204|     36|        (right) = (FP[((temp) >> 24) & 0xff] << 6)      \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  205|     36|            | (FP[((temp) >> 16) & 0xff] << 4)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  206|     36|            | (FP[((temp) >>  8) & 0xff] << 2)          \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  207|     36|            |  FP[temp & 0xff];                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   51|     36|#define FP      des_FP_table
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  208|     36|    } while(0);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (208:13): [Folded, False: 36]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  243|     36|        (kp) -= (2 * 16);                                               \
  |  |  |  |  244|     36|        DEB (("  after FP %8lX %8lX \n", left, right));                 \
  |  |  |  |  245|     36|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (245:14): [Folded, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  123|     36|    }
  124|       |
  125|       |    /*
  126|       |     * Done.  Left and right have the checksum.  Put it into
  127|       |     * the output.
  128|       |     */
  129|     36|    op = out;
  130|     36|    PUT_HALF_BLOCK(left, op);
  ------------------
  |  |  279|     36|#define PUT_HALF_BLOCK(lr, op)  (store_32_be(lr, op), (op) += 4)
  ------------------
  131|     36|    PUT_HALF_BLOCK(right, op);
  ------------------
  |  |  279|     36|#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|     36|    return right & 0xFFFFFFFFUL;
  139|     36|}

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

mit_des_make_key_sched:
  245|     50|{
  246|     50|    unsigned DES_INT32 c, d;
  247|       |
  248|     50|    {
  249|       |        /*
  250|       |         * Need a pointer for the keys and a temporary DES_INT32
  251|       |         */
  252|     50|        const unsigned char *k;
  253|     50|        unsigned DES_INT32 tmp;
  254|       |
  255|       |        /*
  256|       |         * Fetch the key into something we can work with
  257|       |         */
  258|     50|        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|     50|        tmp = load_32_be(k), k += 4;
  267|       |
  268|     50|        c =  PC1_CL[(tmp >> 29) & 0x7]
  269|     50|            | (PC1_CL[(tmp >> 21) & 0x7] << 1)
  270|     50|            | (PC1_CL[(tmp >> 13) & 0x7] << 2)
  271|     50|            | (PC1_CL[(tmp >>  5) & 0x7] << 3);
  272|     50|        d =  PC1_DL[(tmp >> 25) & 0xf]
  273|     50|            | (PC1_DL[(tmp >> 17) & 0xf] << 1)
  274|     50|            | (PC1_DL[(tmp >>  9) & 0xf] << 2)
  275|     50|            | (PC1_DL[(tmp >>  1) & 0xf] << 3);
  276|       |
  277|     50|        tmp = load_32_be(k), k += 4;
  278|       |
  279|     50|        c |= PC1_CR[(tmp >> 28) & 0xf]
  280|     50|            | (PC1_CR[(tmp >> 20) & 0xf] << 1)
  281|     50|            | (PC1_CR[(tmp >> 12) & 0xf] << 2)
  282|     50|            | (PC1_CR[(tmp >>  4) & 0xf] << 3);
  283|     50|        d |= PC1_DR[(tmp >> 25) & 0x7]
  284|     50|            | (PC1_DR[(tmp >> 17) & 0x7] << 1)
  285|     50|            | (PC1_DR[(tmp >>  9) & 0x7] << 2)
  286|     50|            | (PC1_DR[(tmp >>  1) & 0x7] << 3);
  287|     50|    }
  288|       |
  289|     50|    {
  290|       |        /*
  291|       |         * Need several temporaries in here
  292|       |         */
  293|     50|        unsigned DES_INT32 ltmp, rtmp;
  294|     50|        unsigned DES_INT32 *k;
  295|     50|        int two_bit_shifts;
  296|     50|        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|     50|        k = (unsigned DES_INT32 *)schedule;
  305|     50|        two_bit_shifts = TWO_BIT_SHIFTS;
  ------------------
  |  |   74|     50|#define TWO_BIT_SHIFTS  0x7efc
  ------------------
  306|    850|        for (i = 16; i > 0; i--) {
  ------------------
  |  Branch (306:22): [True: 800, False: 50]
  ------------------
  307|       |            /*
  308|       |             * Do the rotation.  One bit and two bit rotations
  309|       |             * are done separately.  Note C and D are 28 bits.
  310|       |             */
  311|    800|            if (two_bit_shifts & 0x1) {
  ------------------
  |  Branch (311:17): [True: 600, False: 200]
  ------------------
  312|    600|                c = ((c << 2) & 0xffffffc) | (c >> 26);
  313|    600|                d = ((d << 2) & 0xffffffc) | (d >> 26);
  314|    600|            } else {
  315|    200|                c = ((c << 1) & 0xffffffe) | (c >> 27);
  316|    200|                d = ((d << 1) & 0xffffffe) | (d >> 27);
  317|    200|            }
  318|    800|            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|    800|            ltmp = PC2_C[0][((c >> 22) & 0x3f)]
  332|    800|                | PC2_C[1][((c >> 15) & 0xf) | ((c >> 16) & 0x30)]
  333|    800|                | PC2_C[2][((c >>  4) & 0x3) | ((c >>  9) & 0x3c)]
  334|    800|                | 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|    800|            rtmp = PC2_D[0][((d >> 22) & 0x3f)]
  345|    800|                | PC2_D[1][((d >> 14) & 0xf) | ((d >> 15) & 0x30)]
  346|    800|                | PC2_D[2][((d >>  7) & 0x3f)]
  347|    800|                | 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|    800|            *k++ = (ltmp & 0x00ffff00) | (rtmp & 0xff0000ff);
  357|    800|            *k++ = (ltmp & 0xff0000ff) | (rtmp & 0x00ffff00);
  358|    800|        }
  359|     50|    }
  360|     50|    return (0);
  361|     50|}

mit_des_key_sched:
   53|     50|{
   54|     50|    mit_des_make_key_sched(k,schedule);
   55|       |
   56|     50|    if (!mit_des_check_key_parity(k))   /* bad parity --> return -1 */
  ------------------
  |  Branch (56:9): [True: 8, False: 42]
  ------------------
   57|      8|        return(-1);
   58|       |
   59|     42|    if (mit_des_is_weak_key(k))
  ------------------
  |  Branch (59:9): [True: 6, False: 36]
  ------------------
   60|      6|        return(-2);
   61|       |
   62|       |    /* if key was good, return 0 */
   63|     36|    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|    644|    for (i = 0; i < (sizeof(weak)/sizeof(mit_des_cblock)); i++) {
  ------------------
  |  Branch (82:17): [True: 608, False: 36]
  ------------------
   83|    608|        if (!memcmp(weak_p++,key,sizeof(mit_des_cblock)))
  ------------------
  |  Branch (83:13): [True: 6, False: 602]
  ------------------
   84|      6|            return 1;
   85|    608|    }
   86|       |
   87|     36|    return 0;
   88|     42|}

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

