blob: 0c8fbf73772ac82a84331b4c75acf94976415352 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2019 Ericsson Telecom AB Telecom AB
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
//
///////////////////////////////////////////////////////////////////////////////
//
// File: TLS_Types.ttcn
// Description: TLS Types
// Rev: R4A
// Prodnr: CNL 113 806
// Updated: 2014-06-13
// Contact: http://ttcn.ericsson.se
// Reference: http://tools.ietf.org/html/rfc4346
//
//
module TLS_Types {
external function enc_TLS_TLSPlaintexts(in TLSPlaintexts pl_texts) return octetstring;
external function dec_TLS_TLSPlaintexts(in octetstring pl_stream, out TLSPlaintexts pl_texts, in KeyExchangeAlgorithm pl_kea:=null_) return integer;
external function enc_TLS_TLSCompressed( in TLSCompressed pl_cmpd) return octetstring;
external function dec_TLS_TLSCompressed( in octetstring pl_stream, out TLSCompressed pl_decoded, in KeyExchangeAlgorithm pl_kea:=null_) return integer;
external function enc_TLS_SecurityParameters( in SecurityParameters pl_sp) return octetstring;
external function dec_TLS_SecurityParameters( in octetstring pl_stream, out SecurityParameters pl_decoded) return integer;
external function enc_TLS_TLSCiphertext( in TLSCiphertext pl_text, in TLSCompressed pl_cmpd, in SecurityParameters pl_sp) return octetstring;
external function dec_TLS_TLSCiphertext( in octetstring pl_stream, in TLSCompressed pl_cmpd, in SecurityParameters pl_sp, in KeyExchangeAlgorithm pl_kea, out TLSCiphertext pl_decoded) return integer;
external function enc_TLS_Extensions( in TLS_Extensions pl_ext ) return octetstring;
external function dec_TLS_Extensions( in octetstring pl_stream, out TLS_Extensions pl_ext ) return integer;
import from General_Types all;
type octetstring OCT1_16 length(1..16);
type octetstring OCT23 length(23);
type octetstring OCT24 length(24);
type octetstring OCT28 length(28);
type octetstring OCT0_32 length(0..32);
type octetstring OCT48 length(48);
type integer LIN3 (0..16777216);
type integer LIN4 (0..4294967295);
/**********************************************************************/
/**********Begining of the type definitions of Record Layer************/
/**********************************************************************/
type record ProtocolVersion {
LIN1 major_,
LIN1 minor_
}
type enumerated ContentType{
change_cipher_spec (20),
alert (21),
handshake (22),
application_data (23)
}
type record of Handshake MultipleHandshake;
type union Content {
ChangeCipherSpec change_cipher_spec,
Alert alert,
MultipleHandshake multiple_handshake,
octetstring application_data
}
type record TLSPlaintext {
ContentType type_,
ProtocolVersion version,
LIN2 length_,
Content fragment
}
type record of TLSPlaintext TLSPlaintexts;
type record TLSCompressed {
ContentType type_,
ProtocolVersion version,
LIN2 length_,
Content fragment
}
type record TLSCiphertext {
ContentType type_,
ProtocolVersion version,
LIN2 length_,
CipherSpecType fragment
}
type record GenericStreamCipher {
Content content,
octetstring mac
}
type record GenericBlockCipher {
octetstring iv,
Content content,
octetstring mac,
LIN1 padding,
LIN1 padding_length
}
type union CipherSpecType {
GenericStreamCipher stream,
GenericBlockCipher block
}
/**********************************************************************/
/************End of the type definitions of Record Layer***************/
/**********************************************************************/
/***********************************************************************/
/****Begining of the type definitions of Change Cipher Specs Message****/
/***********************************************************************/
type record ChangeCipherSpec {
ChangeCipherSpecEnum type_
}
type enumerated ChangeCipherSpecEnum {
change_cipher_spec (1)
}
/***********************************************************************/
/******End of the Change Cipher Specs Message's type definitions********/
/***********************************************************************/
/***********************************************************************/
/**********Begining of the type definitions of Alert Messages***********/
/***********************************************************************/
type enumerated AlertLevel {
warning (1),
fatal (2)
}
type enumerated AlertDescription {
close_notify (0),
unexpected_message (10),
bad_record_mac (20),
decryption_failed (21),
record_overflow (22),
decompression_failure (30),
handshake_failure (40),
no_certificate_RESERVED (41),
bad_certificate (42),
unsupported_certificate (43),
certificate_revoked (44),
certificate_expired (45),
certificate_unknown (46),
illegar_parameter (47),
unknown_ca (48),
access_denied (49),
decode_error (50),
decrypt_error (51),
export_restriction_RESERVED (60),
protocol_version (70),
insufficient_security (71),
internal_error (80),
user_canceled (90),
no_renegotiation (100)
}
type record Alert{
AlertLevel level,
AlertDescription description
}
/***********************************************************************/
/*************End of the type definitions of Alert Messages*************/
/***********************************************************************/
/***********************************************************************/
/********Begining of the type definitions of Handshake Protocol*********/
/***********************************************************************/
type enumerated HandshakeType {
hello_request (0),
client_hello (1),
server_hello (2),
certificate (11),
server_key_exchange (12),
certificate_request (13),
server_hello_done (14),
certificate_verify (15),
client_key_exchange (16),
finished (20)
};
type union HandshakeBody {
HelloRequest hello_request,
ClientHello client_hello,
ServerHello server_hello,
Certificate certificate,
ServerKeyExchange server_key_exchange,
CertificateRequest certificate_request,
ServerHelloDone server_hello_done,
CertificateVerify certificate_verify,
ClientKeyExchange client_key_exchange,
Finished finished,
octetstring encrypted
}
type record Handshake {
HandshakeType msg_type optional,
LIN3 length_ optional,
HandshakeBody body
}
/*---------------------------------------------------------------------*/
/*---------Begining of the type definitions of Hello messages----------*/
/*---------------------------------------------------------------------*/
type record HelloRequest {}
type record Random {
LIN4 gmt_unix_time,
OCT28 random_bytes
}
type OCT0_32 SessionID;
type record CipherSuite {
OCT1 field1,
OCT1 field2
};
type enumerated CompressionMethod {
null_ (0)
}
type set length (1..32768) of CipherSuite CipherSuiteList;
type set length (1..255) of CompressionMethod CompressionMethodList;
type record ClientHello {
ProtocolVersion client_version,
Random random,
SessionID session_id optional,
CipherSuiteList cipher_suites,
CompressionMethodList compression_methods,
octetstring extension_ optional
}
type record ServerHello {
ProtocolVersion server_version,
Random random,
SessionID session_id optional,
CipherSuite cipher_suite,
CompressionMethod compression_method,
octetstring extension_ optional
}
/*---------------------------------------------------------------------*/
/*-----------End of the type definitions of Hello messages-------------*/
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
/*---------Begining of the type definitions of Extensions ----------*/
/*---------------------------------------------------------------------*/
type union ServerName { //RFC6066
charstring hostname
}
type record of ServerName ServerNameList;
type record of octetstring ProtocolNameList; //RFC7301
type union TLS_Extension {
ProtocolNameList protocol_name_list,
ServerNameList server_name_list,
octetstring future_extensions
}
type record of TLS_Extension TLS_Extensions
/*---------------------------------------------------------------------*/
/*-----------End of the type definitions of Extensions -------------*/
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
/*-------Begining of the type definitions of SA and Key Exchange-------*/
/*---------------------------------------------------------------------*/
type octetstring ASN_1Cert length (1..16777215);
type set length (1..16777215) of ASN_1Cert CertificateList;
type record Certificate {
CertificateList certificate_list optional
}
type enumerated KeyExchangeAlgorithm {
rsa,
diffie_hellman,
null_ (255)
}
type record ServerRSAParams {
OCT1_16 rsa_modulus,
OCT1_16 rsa_exponent
}
type record ServerDHParams {
OCT1_16 dh_p,
OCT1_16 dh_g,
OCT1_16 dh_Ys
}
type record ServerKeyExchange {
ServerParams params,
Signature signed_params
}
type enumerated SignatureAlgorithm {
anonymous,
rsa,
dsa
}
type union ServerParams {
ServerDHParams dh_params,
ServerRSAParams rsa_params
}
type record AnonymSignature {
}
type record RSASignature {
OCT16 md5_hash,
OCT20 sha_hash
}
type record DSASignature {
OCT20 sha_hash
}
type union Signature {
AnonymSignature anonym,
RSASignature rsa,
DSASignature dsa,
octetstring sign
}
type enumerated ClientCertificateType{
rsa_sign (1),
dss_sign (2),
rsa_fixed_dh (3),
dss_fixed_dh (4),
rsa_ephemeral_dh_RESERVED (5),
dss_ephemeral_dh_RESERVED (6),
fortezza_dms_RESERVED (20)
}
type OCT1_16 DistinguishedName;
type set length (1..255) of ClientCertificateType ClientCertificateTypeList;
type record CertificateRequest {
ClientCertificateTypeList certificate_types,
DistinguishedName certificate_authorities optional
}
type record ServerHelloDone {}
/*---------------------------------------------------------------------*/
/*---------End of the type definitions of SA and Key Exchange----------*/
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
/*-------Begining of the type definitions of CA and Key Exchange-------*/
/*---------------------------------------------------------------------*/
type union ClientKeyExchangeKeys {
EncryptedPreMasterSecret rsa,
ClientDiffieHellmanPublic diffie_hellman
}
type record ClientKeyExchange {
ClientKeyExchangeKeys exchange_keys
}
type enumerated PublicValueEncoding {
implicit,
explicit_
}
type record ClientDiffieHellmanPublicImplicit {}
type record ClientDiffieHellmanPublicExplicit {
OCT1_16 DH_Yc
}
type union ClientDiffieHellmanPublicValues {
ClientDiffieHellmanPublicImplicit implicit,
ClientDiffieHellmanPublicExplicit explicit_
}
type record ClientDiffieHellmanPublic {
ClientDiffieHellmanPublicValues dh_public
}
type record PreMasterSecret {
ProtocolVersion client_version,
OCT46 random
}
type record EncryptedPreMasterSecret {
PreMasterSecret pre_master_secret
}
type record CertificateVerify {
Signature signature_
}
/*---------------------------------------------------------------------*/
/*---------End of the type definitions of CA and Key Exchange----------*/
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
/*--Begining of the type definitions of Handshake Finalization Message-*/
/*---------------------------------------------------------------------*/
type record Finished {
OCT12 verify_data
}
/*---------------------------------------------------------------------*/
/*----End of the type definitions of Handshake Finalization Message----*/
/*---------------------------------------------------------------------*/
/***********************************************************************/
/**********End of the type definitions of Handshake Protocol************/
/***********************************************************************/
/***********************************************************************/
/*******Begining of the type definitions of The Security Parameters*****/
/***********************************************************************/
type enumerated ConnectionEnd {
server,
client
}
type enumerated BulkCipherAlgorithm {
null_,
rc4,
rc2,
des,
three_des,
des40,
aes,
idea
}
type enumerated CipherType {
stream,
block
}
type enumerated MACAlgorithm {
null_,
md5,
sha
}
type record SecurityParameters {
ConnectionEnd entity,
BulkCipherAlgorithm bulk_cipher_algorithm,
CipherType cipher_type,
LIN1 key_size,
LIN1 key_material_length,
MACAlgorithm mac_algorithm,
LIN1 hash_size,
CompressionMethod compression_algorithm,
OCT48 master_secret,
OCT32 client_random,
OCT32 server_random
}
/***********************************************************************/
/********End of the type definitions of The Security Parameters*********/
/***********************************************************************/
} //end of module