anchor.diff:  		#diameter_caps{origin_host = {OHost, _DHost},
   		origin_realm = {ORealm, _DRealm}} = Capabilities,
   		#'3gpp_s6a_AIR'{'Session-Id' = SId} = Request) ->
  -erlang:display({?MODULE, ?LINE, Request}),
   	try
   		authentication_information(ServiceName, Capabilities, Request)
   	catch
   		_:_Reason ->
   			{reply, #'3gpp_s6a_AIA'{'Session-Id' = SId,
  -					'Result-Code' = ?'DIAMETER_BASE_RESULT-CODE_INVALID_AVP_BITS',
  +					'Result-Code' = [?'DIAMETER_BASE_RESULT-CODE_INVALID_AVP_BITS'],
   					'Auth-Session-State' =  ?'3GPP_S6A_AUTH-SESSION-STATE_NO_STATE_MAINTAINED',
   					'Origin-Host' = OHost, 'Origin-Realm' = ORealm}}
   	end;
  
positive.code: 							MAC_A = ocs_milenage:f1(OPc, K, RAND, <<SQNhe:48>>, AMF),
  							AUTN = autn(SQNhe, AK, AMF, MAC_A),
  							KASME = kdf(CK, IK, SN, SQNhe, AK),
  							EutranVector = #'3gpp_s6a_E-UTRAN-Vector'{'Item-Number' = 1,
  									'RAND' = RAND, 'XRES' = XRES, 'AUTN' = AUTN,
  									'KASME' = KASME},
  							AuthInfo = #'3gpp_s6a_Authentication-Info'{'E-UTRAN-Vector' = EutranVector},
  							{reply, #'3gpp_s6a_AIA'{'Session-Id' = SId,
  									'Result-Code' = ?'DIAMETER_BASE_RESULT-CODE_SUCCESS',
  									'Auth-Session-State' =  ?'3GPP_S6A_AUTH-SESSION-STATE_NO_STATE_MAINTAINED',
  									'Origin-Host' = OHost, 'Origin-Realm' = ORealm,
  									'Authentication-Info' = AuthInfo}};
  						_ ->
  							case ocs_milenage:'f1*'(OPc, K, RAND, <<SQNms:48>>, AMF) of
  								MAC_S ->
  									MAC_A = ocs_milenage:f1(OPc, K, RAND, <<SQNms:48>>, AMF),
  									AUTN = autn(SQNms, AK, AMF, MAC_A),
  									KASME = kdf(CK, IK, SN, SQNms, AK),
  									save_dif(IMSI, dif(SQNms)),
  									EutranVector = #'3gpp_s6a_E-UTRAN-Vector'{'Item-Number' = 1,
  											'RAND' = RAND, 'XRES' = XRES, 'AUTN' = AUTN,
  											'KASME' = KASME},
  									AuthInfo = #'3gpp_s6a_Authentication-Info'{'E-UTRAN-Vector' = EutranVector},
  									{reply, #'3gpp_s6a_AIA'{'Session-Id' = SId,
  											'Result-Code' = ?'DIAMETER_BASE_RESULT-CODE_SUCCESS',
  											'Auth-Session-State' =  ?'3GPP_S6A_AUTH-SESSION-STATE_NO_STATE_MAINTAINED',
  											'Origin-Host' = OHost, 'Origin-Realm' = ORealm,
  											'Authentication-Info' = AuthInfo}};
  								_ ->
  									error_logger:error_report(["AUTS verification failed",
  											{service, ServiceName}, {identity, IMSI},
  											{auts, <<SQN:48, MAC_S/binary>>}]),
  									{reply, #'3gpp_s6a_AIA'{'Session-Id' = SId,
  											'Experimental-Result' = #'3gpp_s6a_Experimental-Result'{
  											'Vendor-Id' = ?IANA_PEN_3GPP,
  											'Experimental-Result-Code' = ?'DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE'},
  											'Auth-Session-State' =  ?'3GPP_S6A_AUTH-SESSION-STATE_NO_STATE_MAINTAINED',
  											'Origin-Host' = OHost, 'Origin-Realm' = ORealm}}
  							end
  					end;
  				[] ->
  					{reply, #'3gpp_s6a_AIA'{'Session-Id' = SId,
  							'Result-Code' = ?'DIAMETER_BASE_RESULT-CODE_SUCCESS',
  							'Auth-Session-State' =  ?'3GPP_S6A_AUTH-SESSION-STATE_NO_STATE_MAINTAINED',
  							'Origin-Host' = OHost, 'Origin-Realm' = ORealm}}
  			end;
  		{error, not_found} ->
  			{reply, #'3gpp_s6a_AIA'{'Session-Id' = SId,
  					'Experimental-Result' = #'3gpp_s6a_Experimental-Result'{
  					'Vendor-Id' = ?IANA_PEN_3GPP,
  					'Experimental-Result-Code' = ?'DIAMETER_ERROR_USER_UNKNOWN'},
  					'Auth-Session-State' =  ?'3GPP_S6A_AUTH-SESSION-STATE_NO_STATE_MAINTAINED',
  					'Origin-Host' = OHost, 'Origin-Realm' = ORealm}};
  		{error, Reason} ->
  			error_logger:error_report(["Service lookup failure",
  					{service, ServiceName}, {module, ?MODULE}, {error, Reason}]),
  			{reply, #'3gpp_s6a_AIA'{'Session-Id' = SId,
  					'Result-Code' = ?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY',
  					'Auth-Session-State' =  ?'3GPP_S6A_AUTH-SESSION-STATE_NO_STATE_MAINTAINED',
  					'Origin-Host' = OHost, 'Origin-Realm' = ORealm}}
  	end.
  
negative.code: 					MAC = ocs_milenage:f1(OPc, K, RAND, <<SQN:48>>, AMF),
  					AUTN = autn(SQN, AK, AMF, MAC),
  					KASME = kdf(CK, IK, SN, SQN, AK),
  					EutranVector = #'3gpp_s6a_E-UTRAN-Vector'{'Item-Number' = [1],
  							'RAND' = RAND, 'XRES' = XRES, 'AUTN' = AUTN, 'KASME' = KASME},
  					AuthInfo = #'3gpp_s6a_Authentication-Info'{'E-UTRAN-Vector' = [EutranVector]},
  					{reply, #'3gpp_s6a_AIA'{'Session-Id' = SId,
  							'Result-Code' = [?'DIAMETER_BASE_RESULT-CODE_SUCCESS'],
  							'Auth-Session-State' = ?'3GPP_S6A_AUTH-SESSION-STATE_NO_STATE_MAINTAINED',
  							'Origin-Host' = OHost, 'Origin-Realm' = ORealm,
  							'Authentication-Info' = [AuthInfo]}};
  				[#'3gpp_s6a_Requested-EUTRAN-Authentication-Info'{
  						'Re-Synchronization-Info' = [<<RAND:16/binary, SQN:48, MAC_S:8/binary>>]}] ->
  					{XRES, CK, IK, <<AK:48>>} = ocs_milenage:f2345(OPc, K, RAND),
  					SQNhe = sqn(DIF),
  					SQNms = sqn_ms(SQN, OPc, K, RAND),
  