anchor.diff:  eap_identity(Config) ->
   	MAC = "aa:bb:cc:dd:ee:ff",
   	PeerId = <<"12345678">>,
  -	Socket = ?config(socket, Config), 
  +	Socket = ?config(socket, Config),
   	{ok, Address} = application:get_env(ocs, radius_auth_addr),
   	{ok, Port} = application:get_env(ocs, radius_auth_port),
   	NasId = ?config(nas_id, Config),
  
positive.code: 	[{userdata, [{doc, "Send an EAP-pwd-Confirm/Response to peer"}]}].
  
  pwd_confirm(Config) ->
  	Id = 1,
  	PeerId = ?config(peer_id, Config),
  	{ok, AuthAddress} = application:get_env(ocs, radius_auth_addr),
  	{ok, AuthPort} = application:get_env(ocs, radius_auth_port),
  	Socket = ?config(socket, Config),
  	UserName = ct:get_config(radius_username),
  	SharedSecret = ct:get_config(radius_shared_secret),
  	Authenticator = radius:authenticator(),
  	IDReqAttributeList0 = radius_attributes:new(),
  	IDReqAttributeList1 = radius_attributes:store(?UserName, UserName, IDReqAttributeList0),
  	IDReqAttributeList2 = radius_attributes:store(?NasPort, 2, IDReqAttributeList1),
  	IDReqAttributeList3 = radius_attributes:store(?NasIdentifier, "tomba2", IDReqAttributeList2),
  	IDReqAttributeList4 = radius_attributes:store(?CallingStationId,"de:ad:be:ef:ca:fe",
  		IDReqAttributeList3),
  	IDReqAttributeList5 = radius_attributes:store(?MessageAuthenticator,
  		list_to_binary(lists:duplicate(16,0)), IDReqAttributeList4),
  	IDRequest1 = #radius{code = ?AccessRequest, id = Id, authenticator = Authenticator,
  		attributes = IDReqAttributeList5},
  	IDRequestPacket1 = radius:codec(IDRequest1),
  	IDMsgAuth = crypto:hmac(md5, SharedSecret, IDRequestPacket1),
  	IDReqAttributeList6 = radius_attributes:store(?MessageAuthenticator, IDMsgAuth, IDReqAttributeList5),
  	IDRequest2 = #radius{code = ?AccessRequest, id = Id, authenticator = Authenticator,
  		attributes = IDReqAttributeList6},
  	IDRequestPacket2 = radius:codec(IDRequest2),
  	ok = gen_udp:send(Socket, AuthAddress, AuthPort, IDRequestPacket2),
  	{ok, {AuthAddress, AuthPort, IdReqPacket}} = gen_udp:recv(Socket, 0),
  	#radius{code = ?AccessChallenge, id = Id, authenticator = _IDReqAuthenticator,
  		attributes = BinIDReqAttributes} = radius:codec(IdReqPacket),
  	IDReqAttributes = radius_attributes:codec(BinIDReqAttributes),
  	{ok, IDEAPPacket} = radius_attributes:find(?EAPMessage, IDReqAttributes),
  	#eap_packet{code = request, type = ?PWD, identifier = IDEAPId, data = IDData} =
  		ocs_eap_codec:eap_packet(IDEAPPacket),
  	#eap_pwd{length = false, more = false, pwd_exch = id,
  		data = IDReqData} = ocs_eap_codec:eap_pwd(IDData),
  	#eap_pwd_id{group_desc = 19, random_fun = 16#1, prf = 16#1, token = Token,
  		pwd_prep = none, identity = ServerID} = ocs_eap_codec:eap_pwd_id(IDReqData),
  	IDRespBody = #eap_pwd_id{token = Token, pwd_prep = none, identity = PeerId},
  	IDRespBodyData = ocs_eap_codec:eap_pwd_id(IDRespBody),
  	IDRespHeader = #eap_pwd{length = false, more = false, pwd_exch = id,
  		data = IDRespBodyData},
  	IDEAPData = ocs_eap_codec:eap_pwd(IDRespHeader),
  	IDRespPacket = #eap_packet{code = response, type = ?PWD, identifier = IDEAPId, data = IDEAPData},
  	IDEAPPacketData = ocs_eap_codec:eap_packet(IDRespPacket),
  	IDRespAttributeList1 = radius_attributes:store(?EAPMessage, IDEAPPacketData, IDReqAttributeList5),
  	Authenticator2 = radius:authenticator(),
  	IDResponse1 = #radius{code = ?AccessRequest, id = 2,  authenticator = Authenticator2,
  		attributes = IDRespAttributeList1},
  	IDResPacket1 = radius:codec(IDResponse1),
  	IDRespMsgAuth = crypto:hmac(md5, SharedSecret, IDResPacket1),
  	IDRspAttributeList3 = radius_attributes:store(?MessageAuthenticator,
  		IDRespMsgAuth, IDRespAttributeList1),
  	IDResPacket1 = radius:codec(IDResponse1),
  	IDRespMsgAuth = crypto:hmac(md5, SharedSecret, IDResPacket1),
  	IDRspAttributeList3 = radius_attributes:store(?MessageAuthenticator,
  		IDRespMsgAuth, IDRespAttributeList1),
  	IDResponse2 = #radius{code = ?AccessRequest, id = 2, authenticator = Authenticator2,
  		attributes = IDRspAttributeList3},
  	IDResPacket2 = radius:codec(IDResponse2),
  	ok = gen_udp:send(Socket, AuthAddress, AuthPort, IDResPacket2),
  	{ok, {_Address, _Port, CommitPacket}} = gen_udp:recv(Socket, 0),
  	#radius{code = ?AccessChallenge, id = 2, authenticator = _RAuthenticator,
  		attributes = CommitReqAttributes} = radius:codec(CommitPacket),
  	CommitReqAtt = radius_attributes:codec(CommitReqAttributes),
  	{ok, CommitEAPPacket} = radius_attributes:find(?EAPMessage, CommitReqAtt),
  	#eap_packet{code = request, type = ?PWD, identifier = EAPId2, data = CommitData} =
  		ocs_eap_codec:eap_packet(CommitEAPPacket),
  	#eap_pwd{length = false, more = false, pwd_exch = commit,
  		data = CommitReqData} = ocs_eap_codec:eap_pwd(CommitData),
  	#eap_pwd_commit{element = Element_S, scalar = Scalar_S} = ocs_eap_codec:eap_pwd_commit(CommitReqData),
  	P_Rand = crypto:rand_uniform(1, ?R),
  	{ok, Password, _Attr, _Balancen} = ocs:find_subscriber(PeerId),
  	PWE = ocs_eap_pwd:compute_pwe(Token, PeerId, ServerID, Password),
  	{Scalar_P, Element_P} = ocs_eap_pwd:compute_scalar(<<P_Rand:256>>, PWE),
  	CommitRespBody = #eap_pwd_commit{scalar = Scalar_P, element = Element_P},
  	CommitRespBodyData = ocs_eap_codec:eap_pwd_commit(CommitRespBody),
  	CommitRespHeader = #eap_pwd{length = false, more = false, pwd_exch = commit,
  		data = CommitRespBodyData},
  	CommitEAPData = ocs_eap_codec:eap_pwd(CommitRespHeader),
  	CommitRespPacket = #eap_packet{code = response, type = ?PWD, identifier = EAPId2, data = CommitEAPData},
  	CommitRespPacketData = ocs_eap_codec:eap_packet(CommitRespPacket),
  	CommitAttributeList1 = radius_attributes:store(?EAPMessage,
  	   CommitRespPacketData, IDReqAttributeList5),
  	Authenticator3 = radius:authenticator(),
  	CommitResponse1 = #radius{code = ?AccessRequest, id = 3, authenticator = Authenticator3,
  		attributes = CommitAttributeList1},
  	CommitReqPacket1 = radius:codec(CommitResponse1),
  	CommitRespMsgAuth = crypto:hmac(md5, SharedSecret, CommitReqPacket1),
  	CommitAttributeList3 = radius_attributes:store(?MessageAuthenticator,
  		CommitRespMsgAuth, CommitAttributeList1),
  	CommitResponse2= #radius{code = ?AccessRequest, id = 3, authenticator = Authenticator3,
  		attributes = CommitAttributeList3},
  	CommitReqPacket2 = radius:codec(CommitResponse2),
  	ok = gen_udp:send(Socket, AuthAddress, AuthPort, CommitReqPacket2),
  	{ok, {_Address, _Port, ConfirmPacket}} = gen_udp:recv(Socket, 0),
  	#radius{code = ?AccessChallenge, id = 3, authenticator = _NewAuth,
  		attributes = ConfirmReqAttributes} = radius:codec(ConfirmPacket),
  	ConfirmReqAtt = radius_attributes:codec(ConfirmReqAttributes),
  	{ok, ConfirmEAPPacket} = radius_attributes:find(?EAPMessage, ConfirmReqAtt),
  	#eap_packet{code = request, type = ?PWD, identifier = EAPId3, data = ConfirmData} =
  		ocs_eap_codec:eap_packet(ConfirmEAPPacket),
  	#eap_pwd{length = false, more = false, pwd_exch = confirm,
  		data = _Confirm_S} = ocs_eap_codec:eap_pwd(ConfirmData),
  	Ciphersuite = <<19:16, 1, 1>>,
  	Kp = ocs_eap_pwd:compute_ks(<<P_Rand:256>>, PWE, Scalar_S, Element_S),
  	Input = [Kp, Element_P, Scalar_P, Element_S, Scalar_S, Ciphersuite],
  	Confirm_P = ocs_eap_pwd:h(Input),
  	ConfirmRespHeader = #eap_pwd{length = false, more = false, pwd_exch = confirm,
  		data = Confirm_P},
  	ConfirmEAPData = ocs_eap_codec:eap_pwd(ConfirmRespHeader),
  	ConfirmRespPacket = #eap_packet{code = response, type = ?PWD, identifier = EAPId3,
  		data = ConfirmEAPData},
  	ConfirmRespPacketData = ocs_eap_codec:eap_packet(ConfirmRespPacket),
  	ConfirmAttributeList1 = radius_attributes:store(?EAPMessage,
  	   ConfirmRespPacketData, IDReqAttributeList5),
  	Authenticator4 = radius:authenticator(),
  	ConfirmResponse1 = #radius{code = ?AccessRequest, id = 4, authenticator = Authenticator4,
  		attributes = ConfirmAttributeList1},
  	ConfirmReqPacket1 = radius:codec(ConfirmResponse1),
  	ConfirmRespMsgAuth = crypto:hmac(md5, SharedSecret, ConfirmReqPacket1),
  	ConfirmAttributeList3 = radius_attributes:store(?MessageAuthenticator,
  		ConfirmRespMsgAuth, ConfirmAttributeList1),
  	ConfirmResponse2= #radius{code = ?AccessRequest, id = 4, authenticator = Authenticator4,
  		attributes = ConfirmAttributeList3},
  	ConfirmReqPacket2 = radius:codec(ConfirmResponse2),
  	ok = gen_udp:send(Socket, AuthAddress, AuthPort, ConfirmReqPacket2),
  	{ok, {_Address, _Port, SuccessPacket}} = gen_udp:recv(Socket, 0),
  	#radius{code = ?AccessAccept, id = 4, authenticator = _NewAuthe,
  		attributes = SucReqAttributes} = radius:codec(SuccessPacket),
  	SucReqAtt = radius_attributes:codec(SucReqAttributes),
  	{ok, SucEAPPacket} = radius_attributes:find(?EAPMessage, SucReqAtt),
  	#eap_packet{code = success, identifier = _EAPId} =
  		ocs_eap_codec:eap_packet(SucEAPPacket).
  
  unknown_authenticator() ->
  	[{userdata, [{doc, "Unauthorised access request"}]}].
  
negative.code: 	MAC = "cc:dd:ee:ff:aa:bb",
  	PeerAuth = list_to_binary(ocs:generate_password()),
  	ok = ocs:add_subscriber(PeerId, PeerAuth, []),
  	Socket = ?config(socket, Config),
  	{ok, Address} = application:get_env(ocs, radius_auth_addr),
  	{ok, Port} = application:get_env(ocs, radius_auth_port),
  	NasId = ?config(nas_id, Config),
  