AES 9/09/2014

AES is a popular encryption algorithm with symmetric keys. If you are looking for open source AES implementions, Ref [1] is one of them.

To verify the AES implementation is in line with National Standard, use the test vectors from Ref[2] as passing criteria.

BTW,  China has its own flavor of encryption product regulation (Ref[3][4][5][6][7][8]). Ask Office of Security Commercial Code Administration (OSCCA) before the police knocking on your door. I'm not kidding, and HP knows it all well :-( (Ref[3]).

[1] Ilya Levin, a byte-oriented aes-256 implementation
[2] Morris Dworkin, Recommendation for Block Cipher Modes of Operation, Methods and Techniques, NIST, 2001
[3] Xia Yu and Matthew Murphy, The Regulation of Encryption Products in China, MMLC Group
[5] 商用密码产品使用管理规定
[6] 境外组织和个人在华使用密码产品管理办法
[7] Mr.王掌柜, 中国有趣的“商用密码管理”
[8] 个人使用密码产品,例如 OpenSSL,是否属于违法行为?

Labels: ,

    Posted by HAx4 at 8:20 PM 0 Comments  

 Lab Notes - Regression Sim on Modelsim 8/26/2014

During regression simulation, more often than not you find yourself in a situation where you need to run a long list of test cases. And here is something that might be useful:

*) For the same .do or .tcl file, use "source xxx.do" will run it in batch mode, while use "do xxx.do" will run it in command line mode. The difference in those two modes is how the break is treated. For "source xxx.do", you can view it as run with "onbreak {resume}". i.e, if you use $stop in your code, you current simulation will resume and continue on, and the command that follows the "vsim xxx: will be executed.  While for "do xxx.do", the action after $stop will depend on the onbreak setting. You can set "onbreak {pause}" to pause the simulation and let you check the wave, or you can use onbreak{resume}, which will execute the next command that follows "vsim xxx" in the do file.

*) For regress test, you would kind like to let the simulation move on to the next case if everything works out, otherwise you might prefer to pause the simulation at the point where it fails. However, just by setting onbreak {pause} is not enough under this circumstance. If you simply calling $stop for the passing case, the simulation will still pause and balk the simulation flow. One way to exit the current simulation gracefully is to shut off the clock and all other active signals, so the Modelsim will quit naturally due to the lack of active events (Ref [1])

*) Ref[1] also showed some other tips that are worth noting for regression test simulation.

So the do file for your regression test might look like the following:

set total_num_of_cases 1000;list

for {set i 0} {$i < $total_num_of_cases} {incr i} {
    vsim xxxxxxx
    add log -r sim:/tb_xxx/*
    onbreak {pause}
    run -all
    quit -sim
    puts "Hi, Test case $i is done"

*) BTW, on a different note, Prof Harris rocks! (Ref[2])

 [1] Modelsim Tips & Tricks

 [2] Fredric J. Harris, Multirate Signal Processing for Communication Systems, May 2004

Labels: , , ,

    Posted by HAx4 at 12:20 AM 0 Comments  

 Lab Notes - Build boost library for old version VC 6/09/2014

If you are like me, who has installed both VC Express 10.0 and VC Express 12.0 on the same PC, and you want to build boost library for the old version VC Express (10.0 in this case), this post is for you:

Now by default, all the boost build will go for ver 12.0. If you want to build for ver 10.0, do as following:

*) open command prompt 

*) run vcvarsall.bat from VC Express 10.0 installation directory

*) go to boost folder, and do "bootstrap.bat vc10"

*) edit project-config.jam, change the relevant line to "using msvc : 10.0 ; "

*) type in ".\b2" to start the building processing

Good Luck!

Labels: , , ,

    Posted by HAx4 at 12:20 AM 0 Comments  

 Can’t Find Script Engine “VBScript” 4/04/2014

To keep an eye on Windows Script Host, some Anti-Virus software will play tricks in Windows Registry by replacing the default vbscript.dll with their own hooks. And these hooks might become the source of trouble.

One thing puzzles me lately is that I start to see the message  Can’t Find Script Engine “VBScript” quite often. And my PC is running Windows 7 64 bit. After some googling, I found a solution as in Ref [1]. However, the job is only half done. Although I can now run the VB Script in Windows Command Prompt, the same script will fail if I run it in Visual Studio Express as Build Script.

And after some head scratching, I found that there is another Registry Entry for VBScript Engine on 64 bit Windows 7, which is


And it should be modified to "C:\Windows\SysWOW64\vbscript.dll". Please see Ref[1] for more detail on how to bypass the secure protection when modifying the Registry key.

References :
[1] How To Fix The Error: Can’t Find Script Engine “VBScript” For Script

Labels: , ,

    Posted by HAx4 at 3:15 AM 0 Comments  

 Lab Notes - Lmutil Kill License 3/06/2014

Every engineer needs to make a living, so is every software engineer. And license is an important piece of that big pie. Often times, FLEXlm is used to manage the license.

Occasionally, the license hangs due to crash on the client side. And here is how to kill a zombie license:

Use lmutil stat -a 

to find out that hanging license, which includes:

port_number on the license server

And use the following to remove the hanging license:

lmutil lmremove -c port_num@server_name license_name user_name user_computer display

*) Sometimes "display" is the same as user_computer, sometimes it is just a number. (probably with an underscore in the middle)

Labels: , , ,

    Posted by HAx4 at 10:39 PM 0 Comments  

 Quote from House of Cards 2/24/2014

Opening Scene:

There are two kinds of pain. The sort of pain that makes you strong, or useless pain... the sort of pain that is only suffering. I have no patience for useless things. Moments like this require someone who can act, or do the unpleasant things, or the necessary thing.

PS: You can use http://cn-proxy.com to get a Chinese IP address. Don't ask me why I need a Chinese IP address. :-)


    Posted by HAx4 at 12:31 AM 0 Comments  

 Lab Notes - FPGA Sample Dump 2/08/2014

Adopting FPGA for digital signal processing is a hard job. Often times the implementation behaves far differently than the Matlab simulation. And being able to dump samples in large buffer is vital under such unfortunate circumstance. For Altera FPGA, there are mainly 3 ways to dump samples in large quantity:

(1)    Using sigtap. To save buffer space, storage qualifier or segmented buffer should be used if necessary.  The downside of sigtap is that its maximum depth is always 128K in spite of buffer width, so some extra shift register or script post-processing is needed to accommodate large sample buffers.

(2)    Using In System Memory Editor and In System Probe and Source. Tcl script can be used with quartus_stp. The help under quartus_sh –qhelp does provide nice examples and templates for script to work. A sample Tcl script might be something like the following:

# hardware and device detection
puts "Programming Hardware:"
foreach hardware_name [get_hardware_names] {
                puts $hardware_name
                if { [string match "USB-Blaster*" $hardware_name] } {
                                set usbblaster_name $hardware_name
puts "\nSelect JTAG chain connected to $usbblaster_name.\n";

puts "\nDevices on the JTAG chain:"
foreach device_name [get_device_names -hardware_name $usbblaster_name] {
                puts $device_name
                if { [string match "@1*" $device_name] } {
                                set test_device $device_name
puts "\nSelect device: $test_device.\n";

set probe_instance_info [get_insystem_source_probe_instance_info -hardware_name $usbblaster_name -device_name $test_device]

puts "Select Probe $probe_instance_info"

puts [get_editable_mem_instances -hardware_name $usbblaster_name -device_name $test_device]


start_insystem_source_probe -hardware_name $usbblaster_name -device_name $test_device
begin_memory_edit -hardware_name $usbblaster_name -device_name $test_device

save_content_from_memory_to_file -instance_index 0 ….


##… script post processing for exported files

(3)    Hardware in the loop, with Matlab. The matlab will use the systemconsole object to talk to the FPGA and get sample dumps through system console.

Labels: ,

    Posted by HAx4 at 12:10 AM 0 Comments  




Follow hahahaha_hax4 on Twitter


*) Grand Opening
*) Stay Foolish
*) Rabbit Hole
*) Sharepoint
*) Blotter
*) Notebook


*) Limerick
*) Movie
*) Tech
 +) Embedded Systems
 +) Linux
 +) Software
 +) Windows


*) Blotter (Obsolete)
*) Notebook
*) Rabbit Hole
*) New Sharepoint

*) China Blog List

*) FCC Wireless

  • May 2004
  • November 2004
  • December 2004
  • January 2005
  • February 2005
  • March 2005
  • April 2005
  • May 2005
  • June 2005
  • July 2005
  • August 2005
  • September 2005
  • October 2005
  • November 2005
  • December 2005
  • January 2006
  • February 2006
  • March 2006
  • April 2006
  • May 2006
  • June 2006
  • July 2006
  • August 2006
  • September 2006
  • October 2006
  • December 2006
  • January 2007
  • February 2007
  • March 2007
  • April 2007
  • May 2007
  • June 2007
  • July 2007
  • August 2007
  • September 2007
  • October 2007
  • November 2007
  • December 2007
  • February 2008
  • March 2008
  • April 2008
  • June 2008
  • August 2008
  • January 2009
  • February 2009
  • March 2009
  • May 2009
  • June 2009
  • July 2009
  • October 2009
  • November 2009
  • December 2009
  • January 2010
  • February 2010
  • April 2010
  • May 2010
  • June 2010
  • July 2010
  • September 2010
  • January 2011
  • May 2011
  • June 2011
  • August 2011
  • October 2011
  • November 2011
  • April 2012
  • May 2012
  • June 2012
  • August 2012
  • September 2012
  • April 2013
  • May 2013
  • August 2013
  • February 2014
  • March 2014
  • April 2014
  • June 2014
  • August 2014
  • September 2014