LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C dll invoking in LabView_Crashes

I've problem regarding the invoking of C dll in LabVIEW using Call Library Function.
 
I cudn't post my query as it exceeds 5000 chars So  i've attached my query in query.doc
 
Pls find the attached vis and dll
 
 
Thanks & Regards
Supriya..
Download All
0 Kudos
Message 1 of 2
(2,646 Views)
Hello,

First of all it looks like the function your call to AES_set_encrypt_key is working.  I'm guessing that you send in some array representing the key, then inside the dll you are calculating a new key based on the value of the first (based on AES).  I have had no problems sending or receiving the data from this call.  I'm guessing that you want to first compute a key value, then call the AES_encrypt function with a byte[] and the key to encrypt a string of data.  The error is occurring inside of the dll, and my guess is that you are improperly accessing memory from an array.  If I directly connect the output key value coming from the AES set encrypt key function to the input (of the same datatype) of the encrypt function I can see the crash you are talking about.  I notice that you do not have any elements in your "out" array (the array being fed to the library node) which could be causing problems if you are trying to access or add those elements in the dll.  If you want to return an array of data from a dll to use in LabVIEW you will either need to pass in an appropriately sized array (almost certainly something larger than 0 elements), or you will need to use CIN functions found prototyped in extcode.h.  I believe you are attempting to go with the first (and easiest) strategy.  First double check that you are not accessing data that is no longer valid -- make sure that you use the data that you pass directly into the dll and perform no allocations in the dll that might be returned to LabVIEW.  Next you will want to make sure that your structs are being passed properly.  The links below discuss some of those issues.

 

http://digital.ni.com/manuals.nsf/websearch/8D930295FFBF9F7686256D2C00624728

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3F05B56A4E034080020E74861&p_...

http://digital.ni.com/public.nsf/websearch/3FF4805467498BA986256CB80082FED8?OpenDocument

http://digital.ni.com/public.nsf/websearch/F7E5C9169D09E98586256AF300717B33?OpenDocument

http://digital.ni.com/public.nsf/websearch/5F94E0FD2BD4732786256547007D8EBB?OpenDocument

http://forums.ni.com/ni/board/message?board.id=170&message.id=22134

 

Hopefully this helps.  Incidentally if you aren’t specifically dedicated to the AES cryptosystem there are easy to use alternatives!  One is ready to use and can be found here:  http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=CC84926E4DB6109EE034080020E74861&p_....

 

Thanks for posting, and good luck!



Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 2 of 2
(2,619 Views)