anchor.diff:  						more = false, pwd_exch = confirm, data = ConfirmBodyData},
   				ConfirmEAPData = ocs_eap_codec:eap_pwd(ConfirmHeader),
   				NewEAPID = EapID + 1,
  -				ConfirmPacket = #eap_packet{code = ?Request, identifier = NewEAPID, data = ConfirmEAPData},
  -				ConfirmEAPPacketData = ocs_eap_codec:eap_packet(ConfirmPacket),
  -				AttributeList0 = radius_attributes:new(),
  -				AttributeList1 = radius_attributes:store(?EAPMessage,
  -						ConfirmEAPPacketData, AttributeList0),
  -				AttributeList2 = radius_attributes:store(?MessageAuthenticator,
  -						<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>, AttributeList1),
  -				AttrList2bin = radius_attributes:codec(AttributeList2),
  -				Response1 = #radius{code = ?AccessChallenge, id = RadiusID,
  -						authenticator = RequestAuthenticator, attributes = AttrList2bin},
  -				ResponsePacket1 = radius:codec(Response1),
  -				MessageAuthenticator = crypto:hmac(md5, Secret, ResponsePacket1),
  -				AttributeList3 = radius_attributes:store(?MessageAuthenticator,
  -						MessageAuthenticator, AttributeList1),
  -				AttributeData = radius_attributes:codec(AttributeList3),
  -				Length = size(AttributeData) + 20,
  -				ResponseAuthenticator = crypto:hash(md5,[<<?AccessChallenge, RadiusID,
  -				Length:16>>, RequestAuthenticator, AttributeData, Secret]),
  -				Response = #radius{code = ?AccessChallenge, id = RadiusID,
  -						authenticator = ResponseAuthenticator, attributes = AttributeData},
  -				ResponsePacket = radius:codec(Response),
  -				radius:response(RadiusFsm, {response, ResponsePacket}),
  +				send_radius_challenge(NewEAPID, ConfirmEAPData, RadiusID, RequestAuthenticator, Secret, RadiusFsm),
   				NewStateData = StateData#statedata{eap_id = NewEAPID, ks = Ks,
   						confirm_s = ConfirmS},
   				{next_state, wait_for_confirm, StateData, ?TIMEOUT};
  
positive.code: 					case MK_S of
  						MK_P ->
  							NewEapID = EapID + 1,
  							Packet = #eap_packet{code = ?Success, identifier = NewEapID, data = <<>>},
  							EAPPacketData = ocs_eap_codec:eap_packet(Packet),
  							AttributeList0 = radius_attributes:new(),
  							AttributeList1 = radius_attributes:store(?MessageAuthenticator,
  									<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>, AttributeList0),
  							AttributeList2 = radius_attributes:store(?EAPMessage,
  									EAPPacketData, AttributeList1),
  							AttrList2bin = radius_attributes:codec(AttributeList2),
  							Response1 = #radius{code = ?AccessAccept, id = RadiusID,
  								authenticator = RequestAuthenticator, attributes = AttrList2bin},
  							ResponsePacket1 = radius:codec(Response1),
  							MessageAuthenticator = crypto:hmac(md5, Secret, ResponsePacket1),
  							AttributeList3 = radius_attributes:store(?MessageAuthenticator,
  								MessageAuthenticator, AttributeList2),
  							AttributeData = radius_attributes:codec(AttributeList3),
  							Length = size(AttributeData) + 20,
  							ResponseAuthenticator = crypto:hash(md5,[<<?AccessChallenge, RadiusID,
  								Length:16>>, RequestAuthenticator, AttributeData, Secret]),
  							Response = #radius{code = ?AccessAccept, id = RadiusID,
  								authenticator = ResponseAuthenticator, attributes = AttributeData},
  							ResponsePacket = radius:codec(Response),
  							radius:response(RadiusFsm, {response, ResponsePacket}),
  							{next_state, wait_for_confirm, StateData, ?TIMEOUT};
  						_ ->
  							NewEapID = EapID + 1,
  
negative.code: 	radius:response(RadiusFsm, {response, ResponsePacket}),
  	ok.
  
  %% @doc Sends an RADIUS-Access/Challenge packet to peer
  %% @hidden
  send_radius_success(NewEAPID, EAPData, RadiusID, RequestAuthenticator, Secret, RadiusFsm) ->
  	Packet = #eap_packet{code = ?Success, identifier = NewEAPID, data = EAPData},
  	EAPPacketData = ocs_eap_codec:eap_packet(Packet),
  	AttributeList0 = radius_attributes:new(),
  	AttributeList1 = radius_attributes:store(?MessageAuthenticator,
  			<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>, AttributeList0),
  	AttributeList2 = radius_attributes:store(?EAPMessage,
  			EAPPacketData, AttributeList1),	
  	AttrList2bin = radius_attributes:codec(AttributeList2),
  	Response1 = #radius{code = ?AccessAccept, id = RadiusID,
  			authenticator = RequestAuthenticator, attributes = AttrList2bin},
  	ResponsePacket1 = radius:codec(Response1),
  	MessageAuthenticator = crypto:hmac(md5, Secret, ResponsePacket1),
  	AttributeList3 = radius_attributes:store(?MessageAuthenticator,
  			MessageAuthenticator, AttributeList2),
  	AttributeData = radius_attributes:codec(AttributeList3),
  	Length = size(AttributeData) + 20,
  	ResponseAuthenticator = crypto:hash(md5,[<<?AccessChallenge, RadiusID,
  			Length:16>>, RequestAuthenticator, AttributeData, Secret]),
  	Response = #radius{code = ?AccessAccept, id = RadiusID,
  			authenticator = ResponseAuthenticator, attributes = AttributeData},
  	ResponsePacket = radius:codec(Response),
  	radius:response(RadiusFsm, {response, ResponsePacket}).
  