Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

2nd block data truncated during encryption using PIC16f877

Status
Not open for further replies.

ganavel9783

Member level 1
Joined
Sep 6, 2005
Messages
38
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
2,257
p16_tiri.asm

Hi every1,

Recently i posted a thread regarding text file encryption implementation in PIC16f877 using the AES algorithm.I was advised by ric to work with block of 16 bytes first before i could proceed with encryption.Eventually, i manage to send block of 16 byte serially by using my own PC application.The serial code that i'm using in the PIC is adapted from AN774(P16_tiri.asm:Use interrupts for transmit and receive,circular buffer,eight bit data).For ur information,my PC application sends data by this manner:

<8 byte data+ 8 byte data> + <carriage return byte>

So, when the PIC buffer is full(i set the buffer at 16 byte) the PIC will test the next byte from the RCREG to detect whether the carriage return byte is received or not before its being discarded.Once the carriage return is received the 16 byte data in RxBuffer will be copied to TxBuffer before its transmited back to PC.Thats generally how the 16 byte data transfer works for my application.Having this done, i thought of encrypting the 16 byte data in the RxBuffer before its copied to the TxBuffer.

So, i included the AES implementation from AN821 to add the encryption subrountine to p16_tiri.asm.I upgraged my pc application so that i could send data in this manner:

<8 byte data+ 8 byte data + <carriage return byte> ===>for encryption
<8 byte data+ 8 byte data + <line feed byte> ===>for decryption


Pls, note that i'm using a fixed key for both encryption & decryption.Whenever the buffer is full, the PIC will try to detect the next byte to distiguish whether the data in the buffer is for encrypting or decrypting.However, i noticed that everytime i tried to send a text file larger than 16 byte the encryption result gets truncated after the first block of 16 byte.Same thing happens when i tried to decrypt a text file more than 16 byte.

So, should i place a delay in my pc application so that it sends blocks of 16 bytes to PIC16f877 until the block before is encryptd and send back to PC??
 

data encryption&decryption using microcontroller

hi every1,

Just to make sure, i only make comparison with data in the RCREG once the RxBuffer is full with 16 bytes.So, the data in the RX Buffer is not compared to <CR> or <LF> characters.Only the byte that comes after the 16 byte is compared to the value of 0x0d(to encrypt) or 0x0a(to decrypt) and discarded later.

So how can i solve the problem i posted in my previous thread?
 

Re: p16_tiri.asm

Hi every1,

Recently i posted a thread regarding text file encryption implementation in PIC16f877 using the AES algorithm.I was advised by ric to work with block of 16 bytes first before i could proceed with encryption.Eventually, i manage to send block of 16 byte serially by using my own PC application.The serial code that i'm using in the PIC is adapted from AN774(P16_tiri.asm:Use interrupts for transmit and receive,circular buffer,eight bit data).For ur information,my PC application sends data by this manner:



So, when the PIC buffer is full(i set the buffer at 16 byte) the PIC will test the next byte from the RCREG to detect whether the carriage return byte is received or not before its being discarded.Once the carriage return is received the 16 byte data in RxBuffer will be copied to TxBuffer before its transmited back to PC.Thats generally how the 16 byte data transfer works for my application.Having this done, i thought of encrypting the 16 byte data in the RxBuffer before its copied to the TxBuffer.

So, i included the AES implementation from AN821 to add the encryption subrountine to p16_tiri.asm.I upgraged my pc application so that i could send data in this manner:





Pls, note that i'm using a fixed key for both encryption & decryption.Whenever the buffer is full, the PIC will try to detect the next byte to distiguish whether the data in the buffer is for encrypting or decrypting.However, i noticed that everytime i tried to send a text file larger than 16 byte the encryption result gets truncated after the first block of 16 byte.Same thing happens when i tried to decrypt a text file more than 16 byte.

So, should i place a delay in my pc application so that it sends blocks of 16 bytes to PIC16f877 until the block before is encryptd and send back to PC??


Hi Sir,

I should do the same project that you did above, could you send me if you still have the code, I really have no time to do project from the beginning, so I really need your help. Could you help me? I also will use 16F877 in my project and send-receive 16byte encrypted-decrypted data from PIC16F877 to PC, I really need your help, please help me Sir.

Thanks for your help Sir,
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top