/* chmod - Change file modes Author: V. Archer */ /* Copyright 1991 by Vincent Archer * You may freely redistribute this software, in source or binary * form, provided that you do not alter this copyright mention in any * way. */ #include #include #include #include #include #include #include #include #include #include #include #include #define MAXBC 256 #ifndef S_ISLNK #define S_ISLNK(mode) 0 #define lstat stat #endif #define USR_MODES (S_ISUID|S_IRWXU) #define GRP_MODES (S_ISGID|S_IRWXG) #define EXE_MODES (S_IXUSR|S_IXGRP|S_IXOTH) #ifdef S_ISVTX #define ALL_MODES (USR_MODES|GRP_MODES|S_IRWXO|S_ISVTX) #else #define ALL_MODES (USR_MODES|GRP_MODES|S_IRWXO) #endif /* Common variables */ char *symbolic; mode_t new_mode, u_mask; int rflag, errors; struct stat st; char path[PATH_MAX + 1]; /* Main module. The single option possible (-R) does not warrant a call to * the getopt() stuff. */ int main(argc, argv) int argc; char *argv[]; { AES_BYTE inBlock[4*MAXBC], outBlock[4*MAXBC],outBlock1[4*MAXBC], binKey[4*MAXKC]; AES_BYTE direction,keyMaterial[32]; keyInstance keyInst; cipherInstance cipherInst; FILE *fp; int i,j,k,keyLength,blockLength; char *test11, *test22,*initBlock,*initKey; char test1[1024], test2[1024]; int x; int flag = 0; direction =0; //char data[20]="DATATOENCRPT"; initKey = "abcdeabcdeabcdeaabcdeabcdeabcdea"; //initKey2 = "foofoofooofoofoofoofoofoofoofoof"; keyLength = 128; blockLength = 8192; fp = fopen("test.txt","r"); if(fp == NULL) { printf(" file not found \n"); return; } else { printf("file opened, going on\n"); while(fgets(test1,1024,fp) != NULL || flag != 1) { printf("copied some characters and am going to encrypt"); flag = 1; // printf("%s\n", test1); // printf("iteration number: %d\n"); test1[strlen(test1) -1] = '\0'; test11 = test1; j = 4*MAXBC; for(i=0;i %x and outblock => %x\n\n",inBlock,outBlock); memcpy (outBlock, inBlock, blockLength/8); blockEncrypt(&cipherInst, &keyInst, inBlock, blockLength, outBlock); printf("\n finish encrypt inblock is => %x and outblock is => %x \n",inBlock,outBlock); } direction = 1; keyMaterial[keyLength/4] = 0; //keyInst.blockLen = blockLength; makeKey(&keyInst, direction, keyLength, keyMaterial); //cipherInst.blockLen = blockLength; cipherInit (&cipherInst, MODE_ECB, NULL); printf("outblock => %x and outblock1 = %x \n",outBlock,outBlock1); blockDecrypt(&cipherInst, &keyInst, outBlock, blockLength, outBlock1); printf("\n decrypt outBlock is => %x and outBlock1 => %s \n",outBlock,outBlock1); } } fclose(fp); return; }