Annotation of researchv10no/ipc/mgrs/authmgr/atalla.c, revision 1.1

1.1     ! root        1: static unsigned response = 0;
        !             2: 
        !             3: char*
        !             4: atallachal(kp)
        !             5:        struct keyinfo *kp;
        !             6: {
        !             7:        static char buf[12];
        !             8:        static int inited = 0;
        !             9:        int i, j;
        !            10:        char b[64], k[12];
        !            11: 
        !            12:        if(!inited)
        !            13:                srand((int)time((long*)0));
        !            14:        /* make a random data */
        !            15:        for(i=0; i<8; buf[i++] = 0)
        !            16:                ;
        !            17:        sprintf(buf, "%d", nrand(100000000-1000)+1000);
        !            18: 
        !            19:        /* make and save the response */
        !            20:        sscanf(kp->key, "%o %o %o %o %o %o %o %o",
        !            21:                &k[0], &k[1], &k[2], &k[3], &k[4], &k[5], &k[6], &k[7]);
        !            22:        for(i=0; i<8; i++)
        !            23:                for(j=0; j<8; j++)
        !            24:                        b[8*i+j] = (k[i]>>(7-j))&1;
        !            25:        setkey(b);
        !            26: 
        !            27:        for(i=0; i<8; i++)
        !            28:                for(j=0; j<8; j++)
        !            29:                        b[8*i+j] = (buf[i]>>(7-j))&1;
        !            30:        encrypt(b, 0);
        !            31:        for(i=0; i<32; i++) {
        !            32:                response = (response<<1) | b[i];
        !            33:        }
        !            34: 
        !            35:        return buf;
        !            36: }
        !            37: 
        !            38: int
        !            39: atallacomp(kp, s)
        !            40:        struct keyinfo *kp;
        !            41:        char *s;
        !            42: {
        !            43:        unsigned r = 0;
        !            44: 
        !            45:        sscanf(s, "%x", &r);
        !            46:        if(strlen(kp->key) > 16 && r == response)
        !            47:                return 0;
        !            48:        return 1;
        !            49: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.