Thread: About aes

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    8
    Quote Originally Posted by BobS0327
    Code:
    //Module name test.c
    //Compile:
    //cl /DINTERMEDIATE_VALUE_KAT /DTRACE_KAT_MCT test.c rijndael-alg-fst.c rijndael-api-fst.c
    
    #include <stdio.h>
    #include <string.h>
    #include "rijndael-api-fst.h"
    
    int main(void) {
        u8 input[16];
        u8 output[16];
        int i, keyLength = 128;
        keyInstance keyInst;
        BYTE keyMaterial[320];
        cipherInstance cipherInst;
        memset(keyMaterial, 0, sizeof (keyMaterial));
        for (i = 0; i < keyLength/8; i++) {
            sprintf(&keyMaterial[2*i], "%02X", i);
        }
        sprintf(input, "Gumit was here!!");
        /* encryption */
        makeKey(&keyInst, DIR_ENCRYPT, keyLength, keyMaterial);
        cipherInit(&cipherInst, MODE_ECB, NULL);
        blockEncrypt(&cipherInst, &keyInst, input, 128, output);
        /* decryption: */   
        makeKey(&keyInst, DIR_DECRYPT, keyLength, keyMaterial);
        cipherInit(&cipherInst, MODE_ECB, NULL);
        memset(input, 0, sizeof input);
        blockDecrypt(&cipherInst, &keyInst, output, 128, input);
        for (i = 0; i < 16; i++)
            printf("%c",input[i]);
        printf("\n");
        return 0;
    }
    Hi,
    first so thanks for your helps.
    i have a question;
    Is the test.c that my sent file or your code? Are they same?

    Best regards...

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Is the test.c that my sent file or your code? Are they same?
    No, they are not the same. I have taken the author's test file named Rijndael-test-fst.c and removed all the unecessary functions etc. This test file was just their proof that their implementation of Rijndael was highly optimized by using test vectors. I used what I needed from their various testing methods to do the Rijndael encryption and decryption. In other words, test.c is the "bare bones" version of Rijndael-test.fst.c. You still have to compile test.c with the author's other two Rijndael files, Rijndael-alg-fst.c and rijndael-api-fst.c since I used their implementation in a "bare bones" fashion to do the encrypt/decrypt stuff.
    Last edited by BobS0327; 10-21-2006 at 07:33 PM.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    8
    Hi,

    Finally I have worked the code, .

    But I have a problem . I am trying upload the code to ST72f63BU6 microcontrollers that has 1k RAM. When I try working the code, it gives me overflow error. I don`t think so, that it costs much storage.

    How can i solve this problem?

    Regards...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. AES SubBytes step
    By zxcv in forum Tech Board
    Replies: 7
    Last Post: 11-02-2010, 12:22 PM
  2. AES Encryption error code.
    By deevrielk in forum C++ Programming
    Replies: 1
    Last Post: 06-30-2008, 08:37 PM
  3. aes mix columns
    By zxcv in forum C Programming
    Replies: 8
    Last Post: 01-04-2008, 03:28 PM
  4. OpenSSL AES library documentation
    By kronixx in forum C Programming
    Replies: 1
    Last Post: 11-21-2005, 12:24 PM
  5. AES encryption limitation
    By willc0de4food in forum C Programming
    Replies: 2
    Last Post: 10-20-2005, 01:48 PM