The series LGTM, great to see chacha support!

One nit here, and when you post v2 would you mind ccing crypto?

From TLS perspective I think this code is ready to be merged, but
my crypto knowledge is close to none, so best if we give crypto
folks a chance to take a look.

On Sun, 22 Nov 2020 04:57:44 +0300 Vadim Fedorenko wrote:
> +     case TLS_CIPHER_CHACHA20_POLY1305: {
> +             nonce_size = 0;
> +             tag_size = TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE;
> +             iv_size = TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE;
> +             iv = ((struct tls12_crypto_info_chacha20_poly1305 
> *)crypto_info)->iv;

[1]

> +             rec_seq_size = TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE;
> +             rec_seq =
> +             ((struct tls12_crypto_info_chacha20_poly1305 
> *)crypto_info)->rec_seq;

[2]

> +             chacha20_poly1305_info =
> +             (struct tls12_crypto_info_chacha20_poly1305 *)crypto_info;

Move this line up, and use it in [1] and [2].

You can also make it:

        chacha20_poly1305_info = (void *)crypto_info;

> +             keysize = TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE;
> +             key = chacha20_poly1305_info->key;
> +             salt = chacha20_poly1305_info->salt;
> +             salt_size = TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE;
> +             cipher_name = "rfc7539(chacha20,poly1305)";
> +             break;
> +     }

Reply via email to