Simple system for testing secure voice communication in wireless networks.
Ionescu, Valeriu ; Sima, Ion ; Sofron, Emil 等
1. INTRODUCTION
The current tendency in communications and especially in mobile
communications is to merge in a single IP-based stream because of
communication efficiency over limited available bandwidth. The behavior
of these systems can be simulated in a software environment that allows
the interaction with real hardware. This paper presents a simple Matlab
Simulink implementation of a communication system, based on
Matlab's ability to interact with external programming languages,
using MELP (Mixed-Excitation Linear Predictive) 2400bps vocoder for good
audio quality at a low bit rate, AES (Advanced Encryption Standard)
encryption in ECB (Electronic Code Book) Mode for communication security
and User Datagram Protocol (UDP) protocol for voice communications. The
system uses the Java Cryptography Architecture (JCA) for encryption
implementation and C Dynamic Link Libraries (DLL) for MELP
implementation and shows that is it easy to design a complex
communication system without having to redesign each of its components.
2. SYSTEM DESIGN AND IMPLEMENTATION
In order to ensure real time simulation, a Real Time Windows Target
implementation was considered, but as some incompatibilities with other
Matlab components were encountered (as outlined in the Matlab
documentation), the final implementation was made in Simulink.
The communication system architecture consists for the transmitting
components in: audio data acquisition block, a MELP encoder block, an
AES encryption block and a UDP data communication block. The receiving
components present the reverse chain as seen in Fig. 1. The disk storage
of the voice data output, needed for later analysis, was implemented via
a controlled (triggered) subsystem. A processing order had to be
established using the "Priority" field of Simulink blocks in
order to respect the correct data processing chain.
--Audio Data Acquisition Block Implementation The audio data
acquisition block can be implemented in Matlab by either using the
"Analog Input" from the Data Acquisition Toolbox, or the
"From Audio Device" from the Signal Processing Toolbox.
We chose the "From Audio Device" block, as it allows data
acquisition at as low as 1000 samples/sec compared to 5000 samples/sec
for "Analog Input", necessary in early stages of AES testing
(when the MELP encoding block was not implemented). For the audio
output, the "To Audio Device" was used. When Simulink cannot
keep up with an audio device that is operating in real time, some audio
data will be skipped.
--MELP Vocoder Implementation
The MELP (Mixed-Excitation Linear Predictive) standard was released
in 1999 and specified only the 2400 bps mode of operation, but further
enhancements in 2001 allowed 1200bps and 600bps, known as MELPe.
While an implementation of the MELP Algorithm has recently become
available for Matlab (Basov, 2008), for this system was used initially
the output of the executable implementation of MELP from Texas
Instruments (TI, 1998). By using the commands: "melp -a -i infile
-o bitstream" for the encoding and "melp -s -i bitstream -o
outfile" for the synthesis if was possible convert data to MELP and
load it for the encryption stage by using temporary hard disk storage
for audio bitstream. For real time operation the time spent in the
execution of the external program (much time is lost with disk access)
has to be lower than the real speech time in order not lead to delays in
data processing. By measuring "melp.exe" program execution
time was determined for 3 seconds of real time data processing with
different storage media. The results showed that the implementation is
adequate for faster than real time data acquisition using a fast storage
media.
In order to reduce the time lost due to hard-disk access, and still
use the C functions, the MELP functions were integrated in a dynamic
link library (DLL): Matlabmelp_dll that was called from Matlab. As a
guidance for the DLL implementation and function export/import were used
the tutorials available at (Webb, 2003) along with the MELP
implementation from Texas Instruments (TI, 1998). The library was loaded
with: loadlibrary('Matlabmelp_dll', 'melp_dll.h').
The functions exported from the dynamic link library (EXPORT void
melp_ana_init();), can be listed in Matlab by using the command:
libfunctions Matlabmelp_dll -full:
voidPtr feccode(voidPtr)
[int32, voidPtr] fec_decode(voidPtr, int32)
[singlePtr, voidPtr] melp_ana(singlePtr, voidPtr)
melp_ana_init
[int32, voidPtr, voidPtr] melp_chn_read(voidPtr, voidPtr)
voidPtr melp_chn_write(voidPtr)
[voidPtr, singlePtr] melp_syn(voidPtr, singlePtr)
melp_syn_init
These speech processing functions are called with calllib and will
read and write data into/from arrays resulting in an important advantage
over the previous implementation as there is no more dependence on the
file system performance. The communication was completed successfully as
the system was able to process the audio data in real time.
--Encryption/Decryption Block implementation
The encryption implementation used JCA (Sun, 2006), with the
extensive use of extrinsic functions for Simulink implementation. The
JCA has support for cryptographic services such as AES, DES, DESede,
Blowfish, IDEA, etc. The AES encryption was chosen because it is widely
used. NIST has defined 5 modes of operation for AES and other FIPS approved ciphers (Dworkin, 2001). Because of the problem of frequent
data loss in mobile communications, in this implementation the
Electronic Codebook Mode (ECB) was chosen with a 128 bit key (16 octets)
so that the loss of a block will have no impact on the decryption of the
following ones. However this mode of operation is not very secure, as
encrypting identical data blocks lead to identical encrypted blocks. The
encryption used the following code sequence:
k=javax.crypto.spec.SecretKeySpec(key, 'AES');
c=javax. crypto. Cipher.getInstance ('AES');
c.init(ENCRYPT_MODE,k)
The above Matlab functions were then called from the Embedded block
with: eml.extrinsic('encryption').We also analyzed the
implementation using the "feval" Matlab function but the
resulted program complexity was very high.
[FIGURE 1 OMITTED]
3. IMPLEMENTATION RESULTS
The implementation was first tested on a single computer using the
loopback adapter (with WireShark monitoring loopback packets in the
Windows operating system, through the Microsoft Loopback Adapter), then
in a real wireless 802.11g network with 4 computers (2.4GHz Core Duo) as
seen in Fig. 2: two were participating in the Matlab communication
(computers 1 and 2) and two helped simulate high network traffic in
order to insure datagram drop (computers 3 and 4). The number of dropped
packets was below 1%.
During the simulation and real wireless network communication
testing the memory used by the simulator varied rapidly 30MB to 240MB
and after about 15 minutes of simulation it has stabilized to
approximately 240 MB, for all the rest of the simulation.
The output of the MELP coder compared to the input uncompressed
signal is presented in figure 3. The received speech quality was good,
with small moments of silence when the datagrams were dropped.
[FIGURE 2 OMITTED]
[FIGURE 3 OMITTED]
The lag in voice communication (due to both network latency and
data processing) increased in the first 5 minutes of the simulation to 4
seconds and then stabilized to about 4 seconds for the rest of the
simulation (more than 30 minutes). No such latency increase pattern was
detected in the simulation on a single computer, via loopback address.
4. CONCLUSION
The results show that a real time implementation of a communication
system testbead is possible using only existing external
functions/programs for component implementation. This may be necessary
when there is not enough time or enough information for a detailed
system implementation.
The current simple implementation showed good tolerance to dropped
datagrams, even if the resulted audio message becomes hard to understand
as the number of dropped datagrams grows. The visual implementation in
Simulink, even if it proved to be a challenging task, it is flexible
enough to allow future optimizations such as external function
integration through the use of MEX files or by using the memory mapping
feature of Matlab for disk access. The encryption strength can be
improved by using AES - CBC (Cipher Block Chaining) mode but the
communication protocol will have to recover the lost data.
In the future the system will be modified for other audio encoders
and encryption standards.
5. REFERENCES
Basov O. (2008). MELP encoder and decoder in Matlab, 01/07/2008,
Available from: http://www.mathworks.com/
matlabcentral/fileexchange/20530, Accessed: 2009-02-02
Dworkin M. (2001). Recommendation for Block Cipher Modes of
Operation, National Institute of Standards and Technology--NIST Special
Publication 800-38A, 2001 Edition, Available from:
http://csrc.nist.gov/publications/ nistpubs/800-38a/sp800-38a.pdf,
Accessed: 2009-02-02
Sun Microsystems. (2006). Class MessageDigest, Available from:
http://java. sun. com/javase/6/docs/technotes/guides/
security/crypto/CryptoSpec.html, Accessed: 2009-02-02
TI--Texas Instruments Inc. (1998). Specifications for the Analog to
Digital Conversion of Voice by 2,400 Bit/Second Mixed Excitation Linear
Prediction, Available from:
http://health.tau.ac.il/Communication%20Disorders/noam/
speech/melp/Download/, Accessed: 2009-02-02
Webb P. (2003). Programming Patterns: Calling Generic DLL Functions
From MATLAB, The MathWorks Inc., Available from:
http://www.mathworks.com/company/newsletters/
news_notes/win03/patterns.html, Accessed: 2009-02-02
Tab. 1. External program processing time is lower that the time
being analyzed, therefore real time simulation is possible
Action Storage Program Execution Simulated
Media Time+Disk access Real Time
Encoding HDD 7200RPM 0.802 seconds 3 seconds
Synthesis HDD 7200RPM 1.324 seconds 3 seconds
Encoding USB 2.0 Stick 2.255 seconds 3 seconds
Synthesis USB 2.0 Stick 2.785 seconds 3 seconds
Encoding SD Card 2.562 seconds 3 seconds
Synthesis SD Card 2.219 seconds 3 seconds
Tab. 2. Evolution of the voice delay with simulation time
Simulation time (min) 1 2 3 4 5 6 7
Delay (s) 1.0 2.1 3.4 4.1 4.2 4.2 4.3