Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14238

Re: compilation error

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: compilation error
Date 2014-09-16 08:26 -0400
Organization A noiseless patient Spider
Message-ID <lv9a8v$bav$1@dont-email.me> (permalink)
References <eaf080e1-1192-4632-a320-89f9b021e24b@googlegroups.com> <df51d36e-095e-4dbd-a5ea-755de41e25d9@googlegroups.com>

Show all headers | View raw


On 9/16/2014 3:06 AM, Babu wrote:
> On Tuesday, September 16, 2014 12:34:58 PM UTC+5:30, Babu wrote:
>> Hello All,
>>
>>
>>
>>  I am running the aes256 program on ubuntu 12.04 , while compilation getting error, don't know weather header file is missing or what actually it requires to feed. can anyone help me out of this error that really makes helpful. 
>>
>> i have runned "apt-get install libssl-dev"
> 
> Here is the program :-
> 
> #include <stdlib.h>
> #include <time.h>
> #include <stdio.h>
> #include "aes.h"
>  
>  
> void encrypt(const char *fileIn, const char *fileOut,
>     const unsigned char *key);
> void decrypt(const char *fileIn, const char *fileOut,
>     const unsigned char *key);
>  
> int main() {
>   const unsigned char key[] = "my key";
>  
>   srand(time(NULL));
>  
>   aes_init();
>   encrypt("main.c", "main.c.encrypted", key);
>   decrypt("main.c.encrypted", "main.c.decrypted", key);
>  
>   return 0;
> }
>  
> void encrypt(const char *fileIn, const char *fileOut, 
>     const unsigned char *key) {
>   int i;
>   aes_encrypt_ctx ctx[1];
>   unsigned char iv[16]; /* initialisation vector */
>   unsigned char inBuffer[200], outBuffer[200];
>   FILE *inFile = fopen(fileIn, "rb");
>   FILE *outFile = fopen(fileOut, "wb");
>  
>   /* pick a random initialisation vector */
>   for(i = 0; i < 16; ++i)
>     iv[i] = rand() & 0xFF;
>   fwrite(iv, 1, 16, outFile);
>  
>   aes_encrypt_key256(key, ctx);
>   while((i = fread(inBuffer, 1, sizeof(inBuffer), inFile)) > 0) {
>     aes_ofb_crypt(inBuffer, outBuffer, i, iv, ctx);
>     fwrite(outBuffer, 1, i, outFile);
>   }
>  
>   fclose(inFile);
>   fclose(outFile);
> }
>  
> void decrypt(const char *fileIn, const char *fileOut, 
>     const unsigned char *key) {
>   int i;
>   aes_encrypt_ctx ctx[1];
>   unsigned char iv[16]; /* initialisation vector */
>   unsigned char inBuffer[200], outBuffer[200];
>   FILE *inFile = fopen(fileIn, "rb");
>   FILE *outFile = fopen(fileOut, "wb");
>  
>   /* read initialization vector from file */
>   if(fread(iv, 1, 16, inFile) < 16) {
>     fclose(inFile);
>     fclose(outFile);
>     return; /* error: file doesn't even contain an initialisation vector */
>   }
>  
>   aes_encrypt_key256(key, ctx);
>   while((i = fread(inBuffer, 1, sizeof(inBuffer), inFile)) > 0) {
>     aes_ofb_crypt(inBuffer, outBuffer, i, iv, ctx);
>     fwrite(outBuffer, 1, i, outFile);
>   }
>  
>   fclose(inFile);
>   fclose(outFile);
> }
> 

Try asking in a C newsgroup.  This one is for PHP - hence the "PHP" in
its name.

When you ask in the correct place, you get better answers.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

compilation error Babu <babugirisu@gmail.com> - 2014-09-16 00:04 -0700
  Re: compilation error Babu <babugirisu@gmail.com> - 2014-09-16 00:06 -0700
    Re: compilation error Markus Grob <snoopy@ilnet.ch> - 2014-09-16 09:57 +0200
      Re: compilation error Babu <babugirisu@gmail.com> - 2014-09-16 01:12 -0700
        Re: compilation error Babu <babugirisu@gmail.com> - 2014-09-16 02:42 -0700
        Re: compilation error Markus Grob <snoopy@ilnet.ch> - 2014-09-16 12:04 +0200
    Re: compilation error Jerry Stuckle <jstucklex@attglobal.net> - 2014-09-16 08:26 -0400
    Re: compilation error Denis McMahon <denismfmcmahon@gmail.com> - 2014-09-16 14:43 +0000

csiph-web