msg_time_sec = (long) msg_time.tv_sec;
msg_time_sec = (int32_t) msg_time.tv_sec;
krb_mk_priv(in, out, length, schedule, key, sender, receiver)	u_char *in;		/* application data */	u_char *out;		/* put msg here, leave room for                                 * header! breaks if in and out                                 * (header stuff) overlap */	u_int32_t length;	/* of in data */	struct des_ks_struct *schedule;	/* precomputed key schedule */	des_cblock *key;	/* encryption key for seed and ivec */	struct sockaddr_in *sender; /* sender address */	struct sockaddr_in *receiver; /* receiver address */{    register u_char     *p,*q;    static       u_char *c_length_ptr;    /*     * get the current time to use instead of a sequence #, since     * process lifetime may be shorter than the lifetime of a session     * key.     */    if (gettimeofday(&msg_time,(struct timezone *)0)) {        return -1;    }    msg_time_sec = (long) msg_time.tv_sec;    msg_time_5ms = msg_time.tv_usec/5000; /* 5ms quanta */    p = out;    *p++ = private_msg_ver;    *p++ = AUTH_MSG_PRIVATE | HOST_BYTE_ORDER;    /* calculate cipher length */    c_length_ptr = p;    p += sizeof(c_length);    q = p;    /* stuff input length */    bcopy((char *)&length,(char *)p,sizeof(length));    p += sizeof(length);#ifdef NOENCRYPTION    /* make all the stuff contiguous for checksum */#else    /* make all the stuff contiguous for checksum and encryption */#endif    bcopy((char *)in,(char *)p,(int) length);    p += length;    /* stuff time 5ms */    bcopy((char *)&msg_time_5ms,(char *)p,sizeof(msg_time_5ms));    p += sizeof(msg_time_5ms);    /* stuff source address */    bcopy((char *)&sender->sin_addr.s_addr,(char *)p,          sizeof(sender->sin_addr.s_addr));    p += sizeof(sender->sin_addr.s_addr);    /*     * direction bit is the sign bit of the timestamp.  Ok     * until 2038??     */    /* For compatibility with broken old code, compares are done in VAX        byte order (LSBFIRST) */     if (lsb_net_ulong_less(sender->sin_addr.s_addr, /* src < recv */ 			  receiver->sin_addr.s_addr)==-1)         msg_time_sec =  -msg_time_sec;     else if (lsb_net_ulong_less(sender->sin_addr.s_addr, 				receiver->sin_addr.s_addr)==0)         if (lsb_net_ushort_less(sender->sin_port,receiver->sin_port) == -1)             msg_time_sec = -msg_time_sec;     /* stuff time sec */    bcopy((char *)&msg_time_sec,(char *)p,sizeof(msg_time_sec));    p += sizeof(msg_time_sec);    /*     * All that for one tiny bit!  Heaven help those that talk to     * themselves.     */#ifdef notdef    /*     * calculate the checksum of the length, address, sequence, and     * inp data     */    cksum =  des_quad_cksum(q,NULL,p-q,0,key);    if (krb_debug)        printf("\ncksum = %u",cksum);    /* stuff checksum */    bcopy((char *) &cksum,(char *) p,sizeof(cksum));    p += sizeof(cksum);#endif    /*     * All the data have been assembled, compute length     */    c_length = p - q;    c_length = ((c_length + sizeof(des_cblock) -1)/sizeof(des_cblock)) *        sizeof(des_cblock);    /* stuff the length */    bcopy((char *) &c_length,(char *)c_length_ptr,sizeof(c_length));#ifndef NOENCRYPTION    des_pcbc_encrypt((des_cblock *)q,(des_cblock *)q,(long)(p-q),schedule,key, DES_ENCRYPT);#endif /* NOENCRYPTION */    return (q - out + c_length);        /* resulting size */}