*/
static void
rij_salt_and_iv(RIJNDAEL_context *ctx, const char *key,
- const int key_len, const unsigned char *data, const int legacy_enc_mode)
+ const int key_len, const unsigned char *data, const int mode_flag)
{
char pw_buf[RIJNDAEL_MAX_KEYSIZE];
unsigned char tmp_buf[MD5_DIGEST_LEN+RIJNDAEL_MAX_KEYSIZE+RIJNDAEL_BLOCKSIZE];
memset(kiv_buf, 0x00, RIJNDAEL_MAX_KEYSIZE+RIJNDAEL_BLOCKSIZE);
memset(md5_buf, 0x00, MD5_DIGEST_LEN);
- if(legacy_enc_mode == 1)
+ if(mode_flag == FKO_ENC_MODE_CBC_LEGACY_IV)
{
- /* First make pw 32 bytes (pad with "0" (ascii 0x30)) or truncate.
- * Note: pw_buf was initialized with '0' chars (again, not the value
- * 0, but the digit '0' character).
+ /* Pad the pw with '0' chars up to the minimum Rijndael key size.
*
* This maintains compatibility with the old perl code if absolutely
* necessary in some scenarios, but is not recommended to use since it
- * breaks compatibility with how OpenSSL implements AES. This code
- * will be removed altogether in a future version of fwknop.
+ * breaks compatibility with how OpenSSL implements AES and introduces
+ * other problems. This code will be removed altogether in a future
+ * version of fwknop.
*/
if(key_len < RIJNDAEL_MIN_KEYSIZE)
{
/* The default (set in fko.h) is CBC mode
*/
- ctx->mode = encryption_mode;
+ if(encryption_mode == FKO_ENC_MODE_CBC_LEGACY_IV)
+ ctx->mode = FKO_ENC_MODE_CBC;
+ else
+ ctx->mode = encryption_mode;
/* Generate the salt and initialization vector.
*/
- rij_salt_and_iv(ctx, key, key_len, data, 0);
+ rij_salt_and_iv(ctx, key, key_len, data, encryption_mode);
/* Intialize our Rijndael context.
*/
'local_nat' => "$conf_dir/local_nat_fwknopd.conf",
'ipfw_active_expire' => "$conf_dir/ipfw_active_expire_equal_fwknopd.conf",
'android_access' => "$conf_dir/android_access.conf",
+ 'android_legacy_iv_access' => "$conf_dir/android_legacy_iv_access.conf",
'dual_key_access' => "$conf_dir/dual_key_usage_access.conf",
'gpg_access' => "$conf_dir/gpg_access.conf",
+ 'legacy_iv_access' => "$conf_dir/legacy_iv_access.conf",
'gpg_no_pw_access' => "$conf_dir/gpg_no_pw_access.conf",
'tcp_server' => "$conf_dir/tcp_server_fwknopd.conf",
'tcp_pcap_filter' => "$conf_dir/tcp_pcap_filter_fwknopd.conf",
'function' => \&process_pcap_file_directly,
'cmdline' => '',
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd $default_server_conf_args " .
+ "$fwknopdCmd -c $cf{'def'} -a $cf{'legacy_iv_access'} " .
+ "-d $default_digest_file -p $default_pid_file " .
"--pcap-file $replay_pcap_file --foreground --verbose --verbose " .
"--verbose",
'server_positive_output_matches' => [qr/Replay\sdetected/i,
'55krFt+1B2TtNSAH005kyDEZEOIGoY9Q/iU',
'server_positive_output_matches' => [qr/with expire time/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'Hhro2tH34nqfTRIpevfLTMx7r+N8ZQ4V8',
'server_positive_output_matches' => [qr/with expire time/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'Vw2/Va/aUjvEvNPtwuipQS6DLTzOw/qy+/g',
'server_positive_output_matches' => [qr/with expire time/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'M+GledHfz2d49aYThoQ2Cr8Iw1ycViawY',
'server_positive_output_matches' => [qr/with expire time/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'XZMcWgMsIzhpprJ7JX41DrWd0OtBnE3rVwsN0',
'server_positive_output_matches' => [qr/with expire time/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'DJR92YhjYtL4Q',
'server_positive_output_matches' => [qr/with expire time/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'android_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'android_legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'ZUYoCaJ7X78ULyJTi5eT7nug',
'server_positive_output_matches' => [qr/Args\scontain\sinvalid\sdata/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'oGnOXu3/DeWHJAwtSeh7EAr4',
'server_positive_output_matches' => [qr/Args\scontain\sinvalid\sdata/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'8lGrxcPSfbCOW61k0MP+q1EhLZkc1qAm5g2+2cLNZcoBNEdh3yj8OTPZJyBVw',
'server_positive_output_matches' => [qr/Args\scontain\sinvalid\sdata/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'iGXWxSL4u+AWSSePK3qiiYoRQVw',
'server_positive_output_matches' => [qr/Args\scontain\sinvalid\sdata/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'ekw+EUscVvUkrsRcVtSvOm+fCNo',
'server_positive_output_matches' => [qr/Args\scontain\sinvalid\sdata/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'rPAEnw',
'server_positive_output_matches' => [qr/No\sstanza\sencryption\smode\smatch/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'MKY',
'server_positive_output_matches' => [qr/Args\scontain\sinvalid\sdata/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'hW04WpY8mdUNu9i+PrfPr7/KxqU',
'server_positive_output_matches' => [qr/Args\scontain\sinvalid\sdata/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
'yEkDgP5+f49xrRA',
'server_positive_output_matches' => [qr/Args\scontain\sinvalid\sdata/],
'fwknopd_cmdline' => "LD_LIBRARY_PATH=$lib_dir $valgrind_str " .
- "$fwknopdCmd -c $cf{'disable_aging_nat'} -a $cf{'def_access'} " .
+ "$fwknopdCmd -c $cf{'disable_aging_nat'} -a $cf{'legacy_iv_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fatal' => $NO
},
$rv = 0 unless &file_find_regex([qr/final\spacked/i],
$MATCH_ALL, $curr_test_file);
- if ($enable_openssl_compatibility_tests) {
+ if ($enable_openssl_compatibility_tests
+ and $test_hr->{'detail'} !~ /iptables.*not\sduplicated/) {
### extract the SPA packet from the cmd tmp file before
### openssl command execution overwrites it