jump to navigation

大男人小料理(7) – 西洋芹炒肉片 March 31, 2007

Posted by TSAI HONG-BIN in cuisine.
add a comment



1. 西洋芹
2. 肉片
3. 豆干

1. 豆干切絲,西洋芹切段 (有網站強調去粗纖維…我在找文章前壓根兒不知道還要去粗纖維…)
2. 肉片醃一下醬油
3. 爆蒜,肉片先下鍋,炒到熟再把西洋芹和豆干丟下鍋
5. 翻炒一下,熟了就起鍋

因為肉片醃過醬油,就沒有再加調味料了,還滿香的 (阿Q必勝法) @@



linux kernel source tracing (crypto) part 2 March 28, 2007

Posted by TSAI HONG-BIN in Linux.
add a comment

If you remember, back in the trace of function __crypto_alloc_tfm() in api.c, a new instance of struct crypto_tfm is created, and the parameter alg is assigned to tfm->__crt_alg. And if we further review the struct of crypto_tfm, you can see that through this interface, the cryptographic algorithm is separated from transform. Crypto_tfm is an integrated interface that encapsulates algorithm and one of the cryptographic transforms. See the definition below.

struct crypto_tfm {

u32 crt_flags;

union {
struct blkcipher_tfm blkcipher;
struct cipher_tfm cipher;
struct hash_tfm hash;
struct compress_tfm compress;
} crt_u;

struct crypto_alg *__crt_alg;

void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;

For different cryptographic target (cipher, hash … blah), several different transforms are defined. At current stage, we don’t have to dig-in here. So, back to tcrypt.c. We’re now sure what the variable tfm here stands for, but how about the next? See

struct blkcipher_desc desc;

desc.tfm = tfm;
desc.flags = 0;

Oops, what’s blkcipher_desc? don’t panic, it’s main part is crypto_blkcipher, which could be seen as an alias of crypto_tfm. The following loop is not scaring either, it just starts to run the test cases. No matter how many times this loop is executed, all we have to do is look into the loop body. Because that’s somewhere the encryption/decryption is done. First it clears and sets a WEAK_KEY flag for test purpose. The flags are defined in ~linux/include/linux/crypto.h

* Transform masks and values (for crt_flags).
#define CRYPTO_TFM_MODE_MASK 0x000000ff
#define CRYPTO_TFM_REQ_MASK 0x000fff00
#define CRYPTO_TFM_RES_MASK 0xfff00000

#define CRYPTO_TFM_MODE_ECB 0x00000001
#define CRYPTO_TFM_MODE_CBC 0x00000002
#define CRYPTO_TFM_MODE_CFB 0x00000004
#define CRYPTO_TFM_MODE_CTR 0x00000008

#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100
#define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200
#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000
#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000
#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000
#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000
#define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000

Then, crypto_blkcipher_setkey(). Each cryptographic algorithm has different design of key scheduling, so this routine is essential. However, if you follow the crypto_blkcipher_setkey(), you’ll again find that this function is merely an interface for running crypto_blkcipher_crt(tfm)->setkey(). What is crypto_blkcipher_crt!? Its return data type is blkcipher_tfm (recall the definition of crypto_tfm). So, now we know that by calling crypto_blkcipher_setkey() in tcrypt.c, it calls the setkey() routine in ~linux/crypto/blkcipher.c. Yes, likewise, you can find the definitions of operations of hash_tfm and cipher_tfm in ~linux/crypto/hash.c and ~linux/crypto/cipher.c. If you want to dig in these transforms, you may want to start from crypto_init_cipher_ops(), crypto_init_blkcipher_ops(), or crypto_init_hash_ops().


linux kernel source tracing (crypto) part 1 March 28, 2007

Posted by TSAI HONG-BIN in Linux.
add a comment

If you check ~linux/Documentation/crypto, you’ll find a api-intro.txt. It’s a good place to start. In the document you’re told that crypto API, “ITSELF”, is divided into 3 different layers, transform API, transform ops and algorithm API. Further information? please read the source (ya, the document guide you to tcrypt.c)… or my diary-style post =P

Let’s start from ~linux/crypto/tcrypt.c

tcrypt is designed as a module, so, if you want to see how it works by running it, a correct kernel configuration is required. Check either Cryptographic options -> Testing module is marked [M], or grep .config for CONFIG_CRYPTO_TEST=m.

I prefer to follow the source, so I start from digging into tcrypt.c init function. It merely calls do_test(), and do_test() calls test_hash(), test_cipher()…etc. one after one. After checking the definition of test_cipher(), resided in tcrypt.c as well, you find that the first suspect function call in test_cipher() is crypto_alloc_blkcipher(). Remember the lxr website I mentioned? (http://lxr.linux.no/) Now you see that crypto_alloc_blkcipher() is defined in ~linux/include/linux/crypto.h. The return value is the return of another function call __crypto_blkcipher_cast (crypto_alloc_base()). Be good, follow me on this path of no return. Check the definition of crypto_alloc_base(), it’s in ~linux/crypto/api.c, don’t be afraid, the function has less than 40 lines. Check the first thing it does, crypto_alg_mod_lookup(). Oh well, it first checks if the crypto-algorithm module is loaded. (literally, it says so.) If there is an error returned, it goes to error handle process. If the algorithm module is located, it the goes to __crypto_alloc_tfm(). By seeing “__” prefix you must have known that this function is invoked privately.

Without digging into the function calls within __crypto_alloc_tfm(), you may have an instinct that this function is doing nothing more than initializing the object crypto_tfm. If the object is successfully initialized, it then returns a crypto_tfm pointer.

Let’s take a short break and take a look at what we have treaded.

in tcrypt.c: init() –> do_test() –> test_cipher() –> crypto_alloc_blkcipher()

crypto_alloc_blkcipher() is defined in crypto.h and its return value is the return of function __crypto_blkcipher_cast (crypto_alloc_base()). the return value of crypto_alloc_base is a crypto_tfm (if no error,) so now let’s check what is __crypto_blkcipher_cast() doing. Remember, a “__” prefix means it is defined and invoked locally. The definition of __crypto_blkcipher_cast() is nothing more than casting structure type crypto_tfm to crypto_blkcipher. So, you may want to see how these structs are defined.


Renee Fleming and Evergreen Sym. Orch. March 27, 2007

Posted by TSAI HONG-BIN in Music.
add a comment

It was March 24. The world-famous soprano, Renee Fleming, was having a concert in National Concert Hall, Taipei, Taiwan. We know Fleming by her “extremely expressive” voice and “dramatical” ways of “shaping her sound”. It’s quite difficult to be judgmental, some appreciate, others don’t, that’s how we treat art – by personal tastes.

We all looked forward to the concert, until we saw the programme. “NUTS!” the very first reaction, by me, when seeing her repertoire. 7 songs. ya, she sings only 7 songs in a 2 hours long concert! What’s worse! the last two are “O Mio Babbino Caro” (from Gianni Schicchi) and “Vissi D’arte” (from Tosca). Rest of the concert is made up by Evergreen Sym. Orch.. I won’t say those two are easy pieces, but they’re definitely not challenging ones, especially for a “world’s greatest soprano”. Gosh, I paid $2400 for this? what a robbery…

In the first part, she sang Strauss’ “four last songs.” It was … definitely NOT OK!!!! I don’t care it’s Fleming’s problem or the conductor should bear the responsibility. I can hear only vowels louder than mezzo forte!! All of the four songs!! Where are piano lines?? where are consonants?? Ma’am! it’s German! it’s Deutsch, you are supposed to pronounce a clear and sustaining “-tsch,” instead of a long, beautiful and full “-eu-” with disappearing “-tsch.” I know they are tranquil songs, but tranquility is by no means silence, mute. Charles Huang gave a good reason that the orchestra was making too much noise that covered Fleming’s singing, but not good enough, because after what had done had done, reasons are merely excuses (http://hcharles.blogspot.com/2007/03/blog-post_9040.html). Besides, there are out-of-controlled audience. Some people just can’t wait till the rest. They kept clapping at each stop of the four songs. Just awkward.

The second part, Fleming did a great job in “Bel raggio lusinghier” (from Semiramide) (finally). Her coloratura was running smoothly, accurately and brightly. I was pretty satisfied with this song, and the “Overture of Romeo and Juliet” after that. Obviously these two songs were my favorites, and unfortunately only these two were pleasing, in that concert. The conductor 王雅惠 had really beautiful and expressive gestures while conducting. She was able to give exact, clear, powerful cue for percussion, but in the opposite, a smooth, soft, tender waves for strings. Her conducting is already an art.

What happened afterward was so …hackneyed… I don’t even want to remember. “Somewhere over the rainbow?” “Summertime?” Oh my god, 徐以琳 is doing so much better than her. Undoubtedly Fleming got skills, but by singing “somewhere..” and “summertime” she just got too much show-off. Well, at least, in my opinion, songs have no way to be naturally beautiful. It is the lyrics, melody, and acting and singing of the singer and the accompanist, all above appropriately mixed together that makes a song beautiful. In other words, if the singer expresses himself/herself too much in a song, the song will lose its focus and become meaningless. That how I felt at the end of that day, Renee Fleming’s concert in Taipei, Taiwan.

In my experience of going to soprano concerts in Taipei, Sumi Jo is the best. Her coloratura is just so magic, like angel, naturally flowed from her throat like she was born and nurtured by a nightingale. Especially when she encored ” Les Oiseaux dans la Charmille,” just lovely! Bravo! Kiwiciao wrote a log (http://kiwiciao.spaces.live.com/blog/cns!FF6ACF2404C56C6D!1046.entry)

Last thing, French horn, go kill yourself!

MSN messenger phishing attack!! March 23, 2007

Posted by TSAI HONG-BIN in Diary.

各位好友,如果你看到我傳送訊息,指向一個網址 http://www.get-messenger.com/
它會記住你的密碼,並以你的名義大量傳送 spam-message
如果登入了,請趕快上 http://accountservices.passport.net 修改密碼


Dear friends, if you see my msn account sending message to you and asking you to login http://www.get-messenger.com. Please DO NOT LOGIN!!!
It will save your password and automatically login your account and send multiple spam-message to your contact list. If you unfortunately login that website, please go to http://accountservices.passport.net to change your password ASAP.

My apology for causing all the inconvenience.

Tsai, Hong-Bin


After I fixed the fxxking spam-bot and sent this letter, many of my friends replying to me. I repeatedly said sorry and asked them not to follow the link I sent. Minutes later, Frank sent me a message “shame on you! don’t tell anyone that you graduated from security lab.” Well, I won’t deny my carelessness. But it’s a message I received from someone I know! I thought it was a “tested” amusing, recreational tool. *sigh*, what a sad thing, now I can’t trust messages received from a friend before he/she completes an authentication process, like “hi, do you know that I change my cell phone number?” “really? isn’t it 09xx…?” “oh, so you’re updated, nothing more.”. … *sob*