anchor.diff:      | _ -> unexpectedError "[block_decrypt] invoked with a non BlockCipherState" 
   
   
  -
   let decrypt conn_state (payload:bytes) =
       (* Assume payload has correct maximum length.
  -       Check that the compressed fragment has the correct
  -       maximum length *)
  +       Check that the compressed fragment has the correct maximum length *)
       let sp = conn_state.sparams in
       match sp.cipher_type with
       | CT_stream ->
  
positive.code: 
  let encrypt_fun bca key iv data =
      match bca with
      | BCA_des -> des_encrypt_wiv_nopad key iv data
      | BCA_aes_128 -> aes_encrypt_wiv_nopad key iv data
      | BCA_aes_256 -> aes_encrypt_wiv_nopad key iv data
      | _ -> Error (Encryption, Unsupported)
  
  let encrypt_block conn_state data =
      match conn_state.cipher_state with
  
negative.code:  
  let recv conn =
      let net = conn.net_conn in
  //Cedric: we need refinements to keep track of lengths, starting from TCP.read etc
      match Tcp.read net 5 with
      | Error (x,y) -> Error (x,y)
      | Correct header ->
      let (ct,pv,len) = parse_header header in
      if   (  conn.protocol_version <> ProtocolVersionType.UnknownPV 
           && pv <> conn.protocol_version)
        || pv = ProtocolVersionType.UnknownPV 
      then Error (RecordVersion,CheckFailed)
      else
          (* We commit to the received protocol version.
             In fact, this only changes the protcol version when receiving the first fragment *)
          let conn = {conn with protocol_version = pv} in
          (* No need to check len, since it's on 2 bytes and the max allowed value
             is 2^16. So, here len is always safe *)
          match Tcp.read net len with 
          | Error (x,y) -> Error (x,y) 
          | Correct payload ->
          match decrypt conn payload with
          | Error (x,y) -> Error (x,y)
  