From: Brad Moore <brad.moore@shaw.ca>
Subject: Re: Type Transcriptions
Date: Mon, 21 Apr 2014 10:54:23 -0600
Date: 2014-04-21T10:54:23-06:00 [thread overview]
Message-ID: <53554D3F.8050009@shaw.ca> (raw)
In-Reply-To: <JF35v.73812$%x6.48858@fx16.iad>
On 14-04-21 01:21 AM, Shark8 wrote:
> I recently started a little project intended to implement TLS 1.2 in Ada
> 2012 and SPARK; reading through the RFC and transcribing the types has
> been relatively straightforward.
>
> However there is one hiccup; a certain class of record-type is dependent
> on the values in another record, yet distinctly separate; ex:
>
>
> struct {
> opaque nonce_explicit[SecurityParameters.record_iv_length];
> aead-ciphered struct {
> opaque content[TLSCompressed.length];
> };
> } GenericAEADCipher;
>
> where SecurityParameters is
>
> struct {
> ConnectionEnd entity;
> PRFAlgorithm prf_algorithm;
> BulkCipherAlgorithm bulk_cipher_algorithm;
> CipherType cipher_type;
> uint8 enc_key_length;
> uint8 block_length;
> uint8 fixed_iv_length;
> uint8 record_iv_length;
> MACAlgorithm mac_algorithm;
> uint8 mac_length;
> uint8 mac_key_length;
> CompressionMethod compression_algorithm;
> opaque master_secret[48];
> opaque client_random[32];
> opaque server_random[32];
> } SecurityParameters;
>
> Now I've already transcribed the SecurityParameters parameters record,
> but it seems to me that since these other types are dependent on the
> SecurityParameters, I could change it into a generic package with the
> record's current components being input parameters.
>
> Any advice on which route to take would be greatly appreciated.
I'd suggest trying to make GenericAEADCipher a discriminated record
type, with the two length values as the discriminants, and then the
arrays are sized using the discriminants. No Generics needed.
Brad
next prev parent reply other threads:[~2014-04-21 16:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 7:21 Type Transcriptions Shark8
2014-04-21 16:54 ` Brad Moore [this message]
2014-04-21 18:11 ` Yannick Duchêne (Hibou57)
2014-04-21 18:51 ` Shark8
2014-04-21 19:42 ` Jeffrey Carter
2014-04-22 6:06 ` Shark8
2014-04-21 20:33 ` Ludovic Brenta
2014-04-21 22:46 ` Adam Beneschan
2014-04-22 8:57 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox