istgtcontrolの対応をしているわけだけど、少し余力があるので、
前回は仕様にしてしまった制御用の認証機能をつけました。
現在のMCS Extra 20090125ではCHAPのチャレンジデータ長として
iSCSI規格上の最大値である1024バイト、すなわち16進数文字列で
“0x”+2048バイトの構成になっています。
これを制御用コネクションでも確認しようと思ったら、
作業バッファが少なく(すぐに気が付かず)なっていたので、
何度やっても認証エラーになって頭抱えてました(汗)
CHAPアルゴリズムは、1オクテットの識別子、シークレット、チャレンジ
(可変長オクテット)の3個を並べてハッシュを計算した値でチェックします。
ハッシュ関数がバグってない限り間違えようのない単純なアルゴリズムです。
CHAPについて詳細はRFC1994を参照してください。
iSCSIの制限についてはRFC3720を参照してください。
以下RFC1994より引用
The Challenge Value is a variable stream of octets. The importance of the uniqueness of the Challenge Value and its relationship to the secret is described above. The Challenge Value MUST be changed each time a Challenge is sent. The length of the Challenge Value depends upon the method used to generate the octets, and is independent of the hash algorithm used. The Response Value is the one-way hash calculated over a stream of octets consisting of the Identifier, followed by (concatenated with) the "secret", followed by (concatenated with) the Challenge Value. The length of the Response Value depends upon the hash algorithm used (16 octets for MD5).