From f0acd61fb7c0b412f330eff267d32f6d8eb0d086 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 5 Dec 2013 15:39:16 +0100 Subject: generate-wireshark-cs: some fixes for CCM This applies some fixes for CCM to the cipher suite generation script. There are some special cases for CCM ciphers: the iv blocksize is always 4, it does not have a digest and the mode should be CCM or CCM_8. [ Peter: basically restructure (indent+case) and fix CCM block size. I removed the digest as that was already covered and diglen=0; is not meaningful ] --- generate-wireshark-cs | 58 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 23 deletions(-) (limited to 'generate-wireshark-cs') diff --git a/generate-wireshark-cs b/generate-wireshark-cs index 5b9a9a4..ad86816 100755 --- a/generate-wireshark-cs +++ b/generate-wireshark-cs @@ -103,20 +103,25 @@ p() { # TLS 1.1: http://tools.ietf.org/html/rfc4346#page-69 # TLS 1.2: http://tools.ietf.org/html/rfc5246#page-84 # GCM's IV size is always 4 regardless of underlying block cipher - [[ $1 == *_GCM_* ]] && blocksize=4 || - case $cipher in - AES|AES256|CAMELLIA128|CAMELLIA256|SEED) - blocksize=16 ;; - DES|3DES|IDEA) - blocksize=8 ;; - RC2) - blocksize=8 ;; - RC4|NULL) - # N/A for stream cipher RC4 - blocksize=0 ;; + case $1 in + *_GCM_*|*_CCM|*_CCM_8) + blocksize=4 ;; *) - warn "Unknown cipher $cipher in $hexid $1" - return + case $cipher in + AES|AES256|CAMELLIA128|CAMELLIA256|SEED) + blocksize=16 ;; + DES|3DES|IDEA) + blocksize=8 ;; + RC2) + blocksize=8 ;; + RC4|NULL) + # N/A for stream cipher RC4 + blocksize=0 ;; + *) + warn "Unknown cipher $cipher in $hexid $1" + return + ;; + esac ;; esac @@ -146,17 +151,24 @@ p() { warn "Export cipher, actual keysize may not be accurate: $hexid $1" fi - [[ $1 == *_GCM_* ]] && mode=GCM || - [[ $1 == *_CCM ]] && mode=CCM || - [[ $1 == *_CCM_8 ]] && mode=CCM_8 || - case $cipher in - AES|AES256|DES|3DES|CAMELLIA128|CAMELLIA256|SEED|IDEA|RC2) - mode=CBC ;; - RC4|NULL) - mode=STREAM ;; + case $1 in + *_GCM_*) + mode=GCM ;; + *_CCM) + mode=CCM ;; + *_CCM_8) + mode=CCM_8 ;; *) - warn "Unknown mode in $hexid $1 (cipher=$cipher)" - return + case $cipher in + AES|AES256|DES|3DES|CAMELLIA128|CAMELLIA256|SEED|IDEA|RC2) + mode=CBC ;; + RC4|NULL) + mode=STREAM ;; + *) + warn "Unknown mode in $hexid $1 (cipher=$cipher)" + return + ;; + esac ;; esac -- cgit v1.2.1