see also t/ directory
my $pattern = noise_pattern($pattern_name);
noise_hkdf( $cnf, $chaining_key, $input_key_material, $num_outputs );
$hs = init_symmetric_state($cnf, $hs);
$ss = mix_key( $cnf, $ss, $dh );
$ss = mix_hash( $cnf, $ss, $data );
$ss = init_key($ss, $k);
my $is_has_key = has_key($ss);
$ss = set_nonce($ss, $n);
$ss = mix_keyandhash( $cnf, $ss, $data );
my ($c1, $c2) = noise_split( $cnf, $ss );
my $ciphersuite_name = init_ciphersuite_name($cnf);
my $pattern = init_handshake_pattern($hs);
my $protocol_name = init_protocol_name( $cnf, $hs );
$hs = new_handshake_state( $cnf, $hs );
my $k = rekey( $cnf, $hs );
my $cipher_info = encrypt_with_ad( $cnf, $ss, $ad, $plaintext );
my $plaintext = decrypt_with_ad($cnf, $ss, $ad, $cipher_info);
my $out = encrypt_and_hash( $cnf, $out, $ss, $plaintext );
my $out = decrypt_and_hash( $cnf, $out, $ss, $cipher_info );
my $out_msg_pack = write_message( $cnf, $hs, $out, $payload );
my $out = read_message( $cnf, $hs, $out, $recv_message_pack );
use c1/c2 with nonce directly
or
derive sub { key, iv } from c1/c2, and calc iv' = iv xor current_time, to make sure iv' is not resuse
my ($sk, $siv) = derive_session_key_iv($cnf, $k, $salt);
my $cipher_info = session_encrypt( $cnf, $key, $iv, $aad, $plaintext );
my $plaintext = session_decrypt( $cnf, $key, $iv, $aad, $cipher_info );