Annotation of researchv10no/ipc/mgrs/oauthmgr/atalla.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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