Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-AMF
Commits
044ed83d
Commit
044ed83d
authored
Jun 17, 2022
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete useless prints
parent
126a1c6e
Changes
47
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
88 additions
and
89 deletions
+88
-89
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+13
-13
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+1
-1
src/nas/msgs/RegistrationAccept.cpp
src/nas/msgs/RegistrationAccept.cpp
+1
-1
src/ngap/libngap/OPEN_TYPE.c
src/ngap/libngap/OPEN_TYPE.c
+1
-1
src/ngap/ngapIEs/AMFSetID.cpp
src/ngap/ngapIEs/AMFSetID.cpp
+5
-5
src/ngap/ngapIEs/AllowedNssai.cpp
src/ngap/ngapIEs/AllowedNssai.cpp
+1
-1
src/ngap/ngapIEs/PDUSessionResourceHandoverCommandTransfer.cpp
...gap/ngapIEs/PDUSessionResourceHandoverCommandTransfer.cpp
+1
-1
src/ngap/ngapIEs/PDUSessionResourceHandoverRequiredTransfer.cpp
...ap/ngapIEs/PDUSessionResourceHandoverRequiredTransfer.cpp
+1
-1
src/ngap/ngapIEs/PDUSessionResourceReleaseCommandTransfer.cpp
...ngap/ngapIEs/PDUSessionResourceReleaseCommandTransfer.cpp
+1
-1
src/ngap/ngapIEs/PDUSessionResourceSetupRequestTransfer.cpp
src/ngap/ngapIEs/PDUSessionResourceSetupRequestTransfer.cpp
+1
-1
src/ngap/ngapIEs/PDUSessionResourceSetupResponseTransfer.cpp
src/ngap/ngapIEs/PDUSessionResourceSetupResponseTransfer.cpp
+1
-1
src/ngap/ngapIEs/PDUSessionResourceSetupUnsuccessfulTransfer.cpp
...p/ngapIEs/PDUSessionResourceSetupUnsuccessfulTransfer.cpp
+1
-1
src/ngap/ngapIEs/PLMNSupportItem.cpp
src/ngap/ngapIEs/PLMNSupportItem.cpp
+1
-1
src/ngap/ngapIEs/PLMNSupportList.cpp
src/ngap/ngapIEs/PLMNSupportList.cpp
+2
-2
src/ngap/ngapIEs/QosFlowItemWithDataForwarding.cpp
src/ngap/ngapIEs/QosFlowItemWithDataForwarding.cpp
+6
-6
src/ngap/ngapIEs/RAN-UE-NGAP-ID.cpp
src/ngap/ngapIEs/RAN-UE-NGAP-ID.cpp
+1
-1
src/ngap/ngapIEs/ServedGUAMIList.cpp
src/ngap/ngapIEs/ServedGUAMIList.cpp
+2
-2
src/ngap/ngapIEs/Tac.cpp
src/ngap/ngapIEs/Tac.cpp
+1
-1
src/ngap/ngapMsgs/DownLinkNasTransport.cpp
src/ngap/ngapMsgs/DownLinkNasTransport.cpp
+1
-1
src/ngap/ngapMsgs/DownlinkRANStatusTransfer.cpp
src/ngap/ngapMsgs/DownlinkRANStatusTransfer.cpp
+1
-1
src/ngap/ngapMsgs/HandoverCommandMsg.cpp
src/ngap/ngapMsgs/HandoverCommandMsg.cpp
+1
-1
src/ngap/ngapMsgs/HandoverNotifyMsg.cpp
src/ngap/ngapMsgs/HandoverNotifyMsg.cpp
+1
-1
src/ngap/ngapMsgs/HandoverRequest.cpp
src/ngap/ngapMsgs/HandoverRequest.cpp
+1
-1
src/ngap/ngapMsgs/HandoverRequestAck.cpp
src/ngap/ngapMsgs/HandoverRequestAck.cpp
+1
-1
src/ngap/ngapMsgs/HandoverRequiredMsg.cpp
src/ngap/ngapMsgs/HandoverRequiredMsg.cpp
+1
-1
src/ngap/ngapMsgs/InitialContextSetupFailure.cpp
src/ngap/ngapMsgs/InitialContextSetupFailure.cpp
+1
-1
src/ngap/ngapMsgs/InitialContextSetupRequest.cpp
src/ngap/ngapMsgs/InitialContextSetupRequest.cpp
+1
-1
src/ngap/ngapMsgs/InitialContextSetupResponse.cpp
src/ngap/ngapMsgs/InitialContextSetupResponse.cpp
+1
-1
src/ngap/ngapMsgs/InitialUEMessage.cpp
src/ngap/ngapMsgs/InitialUEMessage.cpp
+3
-3
src/ngap/ngapMsgs/NGSetupFailure.cpp
src/ngap/ngapMsgs/NGSetupFailure.cpp
+1
-1
src/ngap/ngapMsgs/NGSetupRequest.cpp
src/ngap/ngapMsgs/NGSetupRequest.cpp
+1
-1
src/ngap/ngapMsgs/NGSetupResponse.cpp
src/ngap/ngapMsgs/NGSetupResponse.cpp
+2
-2
src/ngap/ngapMsgs/Paging.cpp
src/ngap/ngapMsgs/Paging.cpp
+1
-1
src/ngap/ngapMsgs/PduSessionResourceReleaseCommand.cpp
src/ngap/ngapMsgs/PduSessionResourceReleaseCommand.cpp
+1
-1
src/ngap/ngapMsgs/PduSessionResourceReleaseResponse.cpp
src/ngap/ngapMsgs/PduSessionResourceReleaseResponse.cpp
+1
-1
src/ngap/ngapMsgs/PduSessionResourceSetupRequest.cpp
src/ngap/ngapMsgs/PduSessionResourceSetupRequest.cpp
+2
-2
src/ngap/ngapMsgs/PduSessionResourceSetupResponse.cpp
src/ngap/ngapMsgs/PduSessionResourceSetupResponse.cpp
+1
-1
src/ngap/ngapMsgs/UEContextReleaseCommand.cpp
src/ngap/ngapMsgs/UEContextReleaseCommand.cpp
+1
-1
src/ngap/ngapMsgs/UEContextReleaseComplete.cpp
src/ngap/ngapMsgs/UEContextReleaseComplete.cpp
+1
-1
src/ngap/ngapMsgs/UEContextReleaseRequest.cpp
src/ngap/ngapMsgs/UEContextReleaseRequest.cpp
+1
-1
src/ngap/ngapMsgs/UERadioCapabilityInfoIndication.cpp
src/ngap/ngapMsgs/UERadioCapabilityInfoIndication.cpp
+1
-1
src/ngap/ngapMsgs/UplinkNASTransport.cpp
src/ngap/ngapMsgs/UplinkNASTransport.cpp
+1
-1
src/ngap/ngap_app/ngap_app.cpp
src/ngap/ngap_app/ngap_app.cpp
+2
-2
src/ngap/ngap_app/ngap_message_callback.hpp
src/ngap/ngap_app/ngap_message_callback.hpp
+2
-3
src/secu_algorithms/5gaka/algorithm_from_spec/f12345.h
src/secu_algorithms/5gaka/algorithm_from_spec/f12345.h
+3
-3
src/secu_algorithms/5gaka/rijndael.cpp
src/secu_algorithms/5gaka/rijndael.cpp
+2
-2
src/utils/hex_string_convert.cpp
src/utils/hex_string_convert.cpp
+10
-10
No files found.
src/amf-app/amf_n1.cpp
View file @
044ed83d
...
...
@@ -303,7 +303,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind &nas_data_ind) {
mac32_recv
);
if
(
mac32
==
mac32_recv
)
{
isMatched
=
true
;
Logger
::
amf_n1
().
info
(
"Integrity matched"
);
Logger
::
amf_n1
().
debug
(
"Integrity matched"
);
// nc.get()->security_ctx->ul_count.seq_num ++;
}
if
(
!
isMatched
)
{
...
...
@@ -1521,7 +1521,7 @@ bool amf_n1::authentication_vectors_from_ausf(
iter
=
ueauthenticationctx
.
getLinks
().
find
(
"5G_AKA"
);
if
(
iter
!=
ueauthenticationctx
.
getLinks
().
end
())
{
nc
.
get
()
->
Href
=
iter
->
second
.
getHref
();
Logger
::
amf_n1
().
info
(
"Links is: "
,
nc
.
get
()
->
Href
);
Logger
::
amf_n1
().
debug
(
"Links is: "
,
nc
.
get
()
->
Href
);
}
else
{
Logger
::
amf_n1
().
error
(
"Not found 5G_AKA"
);
}
...
...
@@ -1556,7 +1556,7 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(std::shared_ptr<nas_context> &nc,
resStar_string
=
resStar_s
;
print_buffer
(
"amf_n1"
,
"********** resStar ***********"
,
resStar_value
,
resStar_len
);
Logger
::
amf_n1
().
info
(
"********** resStar_s (%s) ***********"
,
resStar_s
);
Logger
::
amf_n1
().
debug
(
"********** resStar_s (%s) ***********"
,
resStar_s
);
nlohmann
::
json
confirmationdata_j
;
ConfirmationData
confirmationdata
;
...
...
@@ -1894,10 +1894,10 @@ bool amf_n1::start_authentication_procedure(std::shared_ptr<nas_context> nc,
if
(
rand
)
authReq
->
setAuthentication_Parameter_RAND
(
rand
);
Logger
::
amf_n1
().
debug
(
"Sending Authentication request with rand"
);
printf
(
"0x"
);
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"%x"
,
rand
[
i
]);
printf
(
"
\n
"
);
//
printf("0x");
//
for (int i = 0; i < 16; i++)
//
printf("%x", rand[i]);
//
printf("\n");
uint8_t
*
autn
=
nc
.
get
()
->
_5g_av
[
vindex
].
autn
;
if
(
autn
)
...
...
@@ -2063,10 +2063,10 @@ void amf_n1::authentication_failure_handle(uint32_t ran_ue_ngap_id,
"IE Authentication Failure Parameter (auts) not received"
);
}
nc
.
get
()
->
auts
=
auts
;
printf
(
"Received auts: 0x "
);
for
(
int
i
=
0
;
i
<
blength
(
auts
);
i
++
)
printf
(
"%x "
,
((
uint8_t
*
)
bdata
(
auts
))[
i
]);
printf
(
"
\n
"
);
//
printf("Received auts: 0x ");
//
for (int i = 0; i < blength(auts); i++)
//
printf("%x ", ((uint8_t *)bdata(auts))[i]);
//
printf("\n");
if
(
auth_vectors_generator
(
nc
))
{
// all authentication in one(AMF)
handle_auth_vector_successful_result
(
nc
);
}
else
{
...
...
@@ -2181,14 +2181,14 @@ int amf_n1::security_select_algorithms(uint8_t nea, uint8_t nia,
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
if
(
nea
&
(
0x80
>>
amf_cfg
.
nas_cfg
.
prefered_ciphering_algorithm
[
i
]))
{
amf_nea
=
amf_cfg
.
nas_cfg
.
prefered_ciphering_algorithm
[
i
];
printf
(
"amf_nea: 0x%x
\n
"
,
amf_nea
);
//
printf("amf_nea: 0x%x\n", amf_nea);
break
;
}
}
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
if
(
nia
&
(
0x80
>>
amf_cfg
.
nas_cfg
.
prefered_integrity_algorithm
[
i
]))
{
amf_nia
=
amf_cfg
.
nas_cfg
.
prefered_integrity_algorithm
[
i
];
printf
(
"amf_nia: 0x%x
\n
"
,
amf_nia
);
//
printf("amf_nia: 0x%x\n", amf_nia);
break
;
}
}
...
...
src/amf-app/amf_n11.cpp
View file @
044ed83d
...
...
@@ -89,7 +89,7 @@ void octet_stream_2_hex_stream(uint8_t* buf, int len, std::string& out) {
}
tmp
[
2
*
len
]
=
'\0'
;
out
=
tmp
;
printf
(
"n1sm buffer: %s
\n
"
,
out
.
c_str
());
//
printf("n1sm buffer: %s\n", out.c_str());
}
/****************************************************/
...
...
src/nas/msgs/RegistrationAccept.cpp
View file @
044ed83d
...
...
@@ -111,7 +111,7 @@ void RegistrationAccept::set5G_GUTI(
int
regionId
=
fromString
<
int
>
(
amfRegionId
);
int
setId
=
fromString
<
int
>
(
amfSetId
);
int
pointer
=
fromString
<
int
>
(
amfPointer
);
cout
<<
"amfRegionID: "
<<
amfRegionId
.
c_str
()
<<
endl
;
//
cout << "amfRegionID: " << amfRegionId.c_str() << endl;
ie_5g_guti
->
set5GGUTI
(
mcc
,
mnc
,
(
uint8_t
)
regionId
,
(
uint16_t
)
setId
,
(
uint8_t
)
pointer
,
tmsi
);
ie_5g_guti
->
setIEI
(
0x77
);
...
...
src/ngap/libngap/OPEN_TYPE.c
View file @
044ed83d
...
...
@@ -410,7 +410,7 @@ asn_dec_rval_t OPEN_TYPE_aper_get(
}
selected
=
elm
->
type_selector
(
td
,
sptr
);
printf
(
"element selected %d
\n
"
,
selected
.
presence_index
);
//
printf("element selected %d \n", selected.presence_index);
if
(
!
selected
.
presence_index
)
{
ASN__DECODE_FAILED
;
printf
(
"element ASN DECODE FAILED"
);
...
...
src/ngap/ngapIEs/AMFSetID.cpp
View file @
044ed83d
...
...
@@ -67,11 +67,11 @@ bool AMFSetID::encode2bitstring(Ngap_AMFSetID_t& amfsetid) {
//------------------------------------------------------------------------------
bool
AMFSetID
::
decodefrombitstring
(
Ngap_AMFSetID_t
&
amfsetid
)
{
if
(
!
amfsetid
.
buf
)
return
false
;
printf
(
"test for amfsetid
\n
"
);
for
(
int
i
=
0
;
i
<
amfsetid
.
size
;
i
++
)
{
printf
(
"%x "
,
amfsetid
.
buf
[
i
]);
}
printf
(
"
\n
"
);
//
printf("test for amfsetid\n");
//
for (int i = 0; i < amfsetid.size; i++) {
//
printf("%x ", amfsetid.buf[i]);
//
}
//
printf("\n");
uint16_t
temp
=
0
;
temp
|=
amfsetid
.
buf
[
0
]
<<
8
;
temp
|=
amfsetid
.
buf
[
1
];
...
...
src/ngap/ngapIEs/AllowedNssai.cpp
View file @
044ed83d
...
...
@@ -66,7 +66,7 @@ bool AllowedNSSAI::getAllowedNSSAI(S_NSSAI*& m_snssai, int& m_numofsnssai) {
//------------------------------------------------------------------------------
bool
AllowedNSSAI
::
encode2AllowedNSSAI
(
Ngap_AllowedNSSAI_t
*
allowedNssaiList
)
{
cout
<<
"AllowedNSSAI::numOfSnssai "
<<
numofSnssai
<<
endl
;
//
cout << "AllowedNSSAI::numOfSnssai " << numofSnssai << endl;
for
(
int
i
=
0
;
i
<
numofSnssai
;
i
++
)
{
Ngap_AllowedNSSAI_Item_t
*
allowednssaiitem
=
(
Ngap_AllowedNSSAI_Item_t
*
)
calloc
(
1
,
sizeof
(
Ngap_AllowedNSSAI_Item_t
));
...
...
src/ngap/ngapIEs/PDUSessionResourceHandoverCommandTransfer.cpp
View file @
044ed83d
...
...
@@ -85,7 +85,7 @@ int PDUSessionResourceHandoverCommandTransfer::
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_HandoverCommandTransfer
,
NULL
,
handovercommandtransferIE
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapIEs/PDUSessionResourceHandoverRequiredTransfer.cpp
View file @
044ed83d
...
...
@@ -38,7 +38,7 @@ int PDUSessionResourceHandoverRequiredTransfer::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_HandoverRequiredTransfer
,
NULL
,
handoverrquiredTransferIEs
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
// Decapsulation
...
...
src/ngap/ngapIEs/PDUSessionResourceReleaseCommandTransfer.cpp
View file @
044ed83d
...
...
@@ -134,7 +134,7 @@ int PDUSessionResourceReleaseCommandTransfer::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_PDUSessionResourceReleaseCommandTransfer
,
NULL
,
pduSessionResourceReleaseCommandTransferIEs
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
// Decapsulation
...
...
src/ngap/ngapIEs/PDUSessionResourceSetupRequestTransfer.cpp
View file @
044ed83d
...
...
@@ -476,7 +476,7 @@ int PduSessionResourceSetupRequestTransferIE::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_PDUSessionResourceSetupRequestTransfer
,
NULL
,
pduSessionResourceSetupRequestTransferIEs
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
// asn_fprint(stderr, er.failed_type, er.structure_ptr);
return
er
.
encoded
;
}
...
...
src/ngap/ngapIEs/PDUSessionResourceSetupResponseTransfer.cpp
View file @
044ed83d
...
...
@@ -181,7 +181,7 @@ int PduSessionResourceSetupResponseTransferIE::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_PDUSessionResourceSetupResponseTransfer
,
NULL
,
pduSessionResourceSetupResponseTransferIEs
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapIEs/PDUSessionResourceSetupUnsuccessfulTransfer.cpp
View file @
044ed83d
...
...
@@ -143,7 +143,7 @@ int PduSessionResourceSetupUnSuccessfulTransferIE::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_PDUSessionResourceSetupUnsuccessfulTransfer
,
NULL
,
pduSessionResourceSetupUnsuccessfulTransferIEs
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapIEs/PLMNSupportItem.cpp
View file @
044ed83d
...
...
@@ -58,7 +58,7 @@ void PLMNSupportItem::setPlmnSliceSupportList(
bool
PLMNSupportItem
::
encode2PLMNSupportItem
(
Ngap_PLMNSupportItem_t
*
plmnsupportItem
)
{
if
(
!
plmn
->
encode2octetstring
(
plmnsupportItem
->
pLMNIdentity
))
return
false
;
cout
<<
"PLMNSupportItem::numOfSnssai "
<<
numOfSnssai
<<
endl
;
//
cout << "PLMNSupportItem::numOfSnssai " << numOfSnssai << endl;
for
(
int
i
=
0
;
i
<
numOfSnssai
;
i
++
)
{
Ngap_SliceSupportItem_t
*
slice
=
(
Ngap_SliceSupportItem_t
*
)
calloc
(
1
,
sizeof
(
Ngap_SliceSupportItem_t
));
...
...
src/ngap/ngapIEs/PLMNSupportList.cpp
View file @
044ed83d
...
...
@@ -51,8 +51,8 @@ void PLMNSupportList::addPLMNSupportItems(
//------------------------------------------------------------------------------
bool
PLMNSupportList
::
encode2PLMNSupportList
(
Ngap_PLMNSupportList_t
*
plmnsupportList
)
{
cout
<<
"PLMNSupportList::numberOfplmnsupportItemItem ("
<<
numberOfplmnsupportItemItem
<<
")"
<<
endl
;
//
cout << "PLMNSupportList::numberOfplmnsupportItemItem ("
//
<< numberOfplmnsupportItemItem << ")" << endl;
for
(
int
i
=
0
;
i
<
numberOfplmnsupportItemItem
;
i
++
)
{
Ngap_PLMNSupportItem_t
*
supportItem
=
(
Ngap_PLMNSupportItem_t
*
)
calloc
(
1
,
sizeof
(
Ngap_PLMNSupportItem_t
));
...
...
src/ngap/ngapIEs/QosFlowItemWithDataForwarding.cpp
View file @
044ed83d
...
...
@@ -36,10 +36,10 @@ QosFlowItemWithDataForWarding::QosFlowItemWithDataForWarding() {
QosFlowItemWithDataForWarding
::~
QosFlowItemWithDataForWarding
()
{}
void
QosFlowItemWithDataForWarding
::
getQosFlowItemWithDataForWarding
(
Ngap_QosFlowIdentifier_t
&
m_QosFlowIdentifier
)
{
if
(
!
qosFlowIdentifier
)
printf
(
"qosFlowIdentifier null
\n
"
);
else
printf
(
"qosFlowIdentifier
\n
"
);
//
if (!qosFlowIdentifier)
//
printf("qosFlowIdentifier null\n");
//
else
//
printf("qosFlowIdentifier \n");
if
(
qosFlowIdentifier
->
getQosFlowIdentifier
(
value
))
{
m_QosFlowIdentifier
=
(
Ngap_QosFlowIdentifier_t
)
value
;
}
...
...
@@ -49,10 +49,10 @@ bool QosFlowItemWithDataForWarding::decodeformQosFlowItemWithDataForWarding(
qosFlowIdentifier
=
new
QosFlowIdentifier
();
if
(
!
qosFlowIdentifier
->
decodefromQosFlowIdentifier
(
&
(
qosFlowItemWithDataForWarding
->
qosFlowIdentifier
)))
{
printf
(
"false
\n
"
);
//
printf("false\n");
return
false
;
}
printf
(
"true
\n
"
);
//
printf("true\n");
return
true
;
}
}
// namespace ngap
src/ngap/ngapIEs/RAN-UE-NGAP-ID.cpp
View file @
044ed83d
...
...
@@ -60,7 +60,7 @@ bool RAN_UE_NGAP_ID::encode2RAN_UE_NGAP_ID(Ngap_RAN_UE_NGAP_ID_t& ranuengapid) {
bool
RAN_UE_NGAP_ID
::
decodefromRAN_UE_NGAP_ID
(
Ngap_RAN_UE_NGAP_ID_t
&
ranuengapid
)
{
ranUeNgapId
=
ranuengapid
;
cout
<<
"[LibNGAP]Received RanUeNgapId "
<<
ranUeNgapId
<<
endl
;
//
cout << "[LibNGAP]Received RanUeNgapId " << ranUeNgapId << endl;
return
true
;
}
}
// namespace ngap
src/ngap/ngapIEs/ServedGUAMIList.cpp
View file @
044ed83d
...
...
@@ -51,8 +51,8 @@ void ServedGUAMIList::addServedGUAMIItems(
//------------------------------------------------------------------------------
bool
ServedGUAMIList
::
encode2ServedGUAMIList
(
Ngap_ServedGUAMIList_t
*
servedGUAMIList
)
{
cout
<<
"ServedGUAMIList::numberOfservedGUAMIItem ("
<<
numberOfservedGUAMIItem
<<
")"
<<
endl
;
//
cout << "ServedGUAMIList::numberOfservedGUAMIItem ("
//
<< numberOfservedGUAMIItem << ")" << endl;
for
(
int
i
=
0
;
i
<
numberOfservedGUAMIItem
;
i
++
)
{
Ngap_ServedGUAMIItem
*
guamiItem
=
(
Ngap_ServedGUAMIItem
*
)
calloc
(
1
,
sizeof
(
Ngap_ServedGUAMIItem
));
...
...
src/ngap/ngapIEs/Tac.cpp
View file @
044ed83d
...
...
@@ -59,7 +59,7 @@ bool TAC::decodefromoctetstring(Ngap_TAC_t& m_tac) {
for
(
int
i
=
0
;
i
<
m_tac
.
size
;
i
++
)
{
tac
|=
m_tac
.
buf
[
i
]
<<
((
m_tac
.
size
-
1
-
i
)
*
8
);
}
std
::
cout
<<
"Received TAC: "
<<
tac
<<
std
::
endl
;
//
std::cout << "Received TAC: " << tac << std::endl;
return
true
;
}
...
...
src/ngap/ngapMsgs/DownLinkNasTransport.cpp
View file @
044ed83d
...
...
@@ -228,7 +228,7 @@ int DownLinkNasTransportMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
downLinkNasTransportPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
downLinkNasTransportPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/DownlinkRANStatusTransfer.cpp
View file @
044ed83d
...
...
@@ -132,7 +132,7 @@ int DownlinkRANStatusTransfer::encodetobuffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
DownlinkranstatustransferPDU
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
}
// namespace ngap
src/ngap/ngapMsgs/HandoverCommandMsg.cpp
View file @
044ed83d
...
...
@@ -165,7 +165,7 @@ int HandoverCommandMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
handoverCommandPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
handoverCommandPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/HandoverNotifyMsg.cpp
View file @
044ed83d
...
...
@@ -53,7 +53,7 @@ int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
handoverNotifyPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
handoverNotifyPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
bool
HandoverNotifyMsg
::
decodefrompdu
(
Ngap_NGAP_PDU_t
*
ngap_msg_pdu
)
{
...
...
src/ngap/ngapMsgs/HandoverRequest.cpp
View file @
044ed83d
...
...
@@ -197,7 +197,7 @@ int HandoverRequest::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
handoverRequestPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
handoverRequestPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/HandoverRequestAck.cpp
View file @
044ed83d
...
...
@@ -195,7 +195,7 @@ int HandoverRequestAck::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
handoverRequestAckPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
handoverRequestAckPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/HandoverRequiredMsg.cpp
View file @
044ed83d
...
...
@@ -246,7 +246,7 @@ int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
handoverRequiredPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
handoverRequiredPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/InitialContextSetupFailure.cpp
View file @
044ed83d
...
...
@@ -187,7 +187,7 @@ int InitialContextSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
initialContextSetupFailurePdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/InitialContextSetupRequest.cpp
View file @
044ed83d
...
...
@@ -516,7 +516,7 @@ int InitialContextSetupRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
initialContextSetupRequestPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/InitialContextSetupResponse.cpp
View file @
044ed83d
...
...
@@ -231,7 +231,7 @@ int InitialContextSetupResponseMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
initialContextSetupResponsePdu
,
buf
,
buf_size
);
std
::
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
std
::
endl
;
//
std::cout << "er.encoded(" << er.encoded << ")" << std::endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/InitialUEMessage.cpp
View file @
044ed83d
...
...
@@ -228,7 +228,7 @@ int InitialUEMessageMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
initialUEMessagePdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
initialUEMessagePdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
@@ -269,8 +269,8 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
cout
<<
"Decoded NGAP RAN_UE_NGAP_ID IE error"
<<
endl
;
return
false
;
}
cout
<<
"[InitialUeMessage] Received RanUeNgapId "
<<
ranUeNgapId
->
getRanUeNgapId
()
<<
endl
;
//
cout << "[InitialUeMessage] Received RanUeNgapId "
//
<< ranUeNgapId->getRanUeNgapId() << endl;
}
else
{
cout
<<
"Decoded NGAP RAN_UE_NGAP_ID IE error"
<<
endl
;
return
false
;
...
...
src/ngap/ngapMsgs/NGSetupFailure.cpp
View file @
044ed83d
...
...
@@ -219,7 +219,7 @@ int NGSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
ngSetupFailurePdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
ngSetupFailurePdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/NGSetupRequest.cpp
View file @
044ed83d
...
...
@@ -215,7 +215,7 @@ int NGSetupRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
ngSetupRequestPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
ngSetupRequestPdu
,
buf
,
buf_size
);
printf
(
"er.encoded(%ld)
\n
"
,
er
.
encoded
);
//
printf("er.encoded(%ld)\n", er.encoded);
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/NGSetupResponse.cpp
View file @
044ed83d
...
...
@@ -168,7 +168,7 @@ void NGSetupResponseMsg::setPlmnSupportList(
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++
)
{
PlmnId
*
plmn
=
new
PlmnId
();
plmn
->
setMccMnc
(
list
[
i
].
mcc
,
list
[
i
].
mnc
);
cout
<<
"mcc = "
<<
list
[
i
].
mcc
<<
" mnc = "
<<
list
[
i
].
mnc
<<
endl
;
//
cout << "mcc = " << list[i].mcc << " mnc = " << list[i].mnc << endl;
S_NSSAI
*
snssai
=
new
S_NSSAI
[
list
[
i
].
slice_list
.
size
()]();
for
(
int
j
=
0
;
j
<
list
[
i
].
slice_list
.
size
();
j
++
)
{
snssai
[
j
].
setSst
(
list
[
i
].
slice_list
[
j
].
sst
);
...
...
@@ -198,7 +198,7 @@ int NGSetupResponseMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
ngSetupResponsePdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
ngSetupResponsePdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/Paging.cpp
View file @
044ed83d
...
...
@@ -54,7 +54,7 @@ int PagingMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
pagingPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pagingPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/PduSessionResourceReleaseCommand.cpp
View file @
044ed83d
...
...
@@ -245,7 +245,7 @@ int PduSessionResourceReleaseCommandMsg::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pduSessionResourceReleaseCommandPdu
,
buf
,
buf_size
);
Logger
::
nas_mm
().
debug
(
"er.encoded( %d)"
,
er
.
encoded
);
//
Logger::nas_mm().debug("er.encoded( %d)", er.encoded);
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/PduSessionResourceReleaseResponse.cpp
View file @
044ed83d
...
...
@@ -233,7 +233,7 @@ int PduSessionResourceReleaseResponseMsg::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pduSessionResourceReleaseResponsePdu
,
buf
,
buf_size
);
Logger
::
nas_mm
().
debug
(
"er.encoded( %d)"
,
er
.
encoded
);
//
Logger::nas_mm().debug("er.encoded( %d)", er.encoded);
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/PduSessionResourceSetupRequest.cpp
View file @
044ed83d
...
...
@@ -288,7 +288,7 @@ int PduSessionResourceSetupRequestMsg::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pduSessionResourceSetupRequestPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
@@ -301,7 +301,7 @@ void PduSessionResourceSetupRequestMsg::encode2buffer_new(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pduSessionResourceSetupRequestPdu
,
(
void
**
)
&
buffer
);
cout
<<
"er.encoded("
<<
encoded_size
<<
")"
<<
endl
;
//
cout << "er.encoded(" << encoded_size << ")" << endl;
memcpy
((
void
*
)
buf
,
(
void
*
)
buffer
,
encoded_size
);
free
(
buffer
);
}
...
...
src/ngap/ngapMsgs/PduSessionResourceSetupResponse.cpp
View file @
044ed83d
...
...
@@ -235,7 +235,7 @@ int PduSessionResourceSetupResponseMsg::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pduSessionResourceSetupResponsePdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/UEContextReleaseCommand.cpp
View file @
044ed83d
...
...
@@ -155,7 +155,7 @@ int UEContextReleaseCommandMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
pdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/UEContextReleaseComplete.cpp
View file @
044ed83d
...
...
@@ -149,6 +149,6 @@ int UEContextReleaseCompleteMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
pdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
src/ngap/ngapMsgs/UEContextReleaseRequest.cpp
View file @
044ed83d
...
...
@@ -126,7 +126,7 @@ int UEContextReleaseRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
pdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
pdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/UERadioCapabilityInfoIndication.cpp
View file @
044ed83d
...
...
@@ -213,7 +213,7 @@ int UeRadioCapabilityInfoIndicationMsg::encode2buffer(
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
ueRadioCapabilityInfoIndicationPdu
,
buf
,
buf_size
);
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
endl
;
//
cout << "er.encoded(" << er.encoded << ")" << endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngapMsgs/UplinkNASTransport.cpp
View file @
044ed83d
...
...
@@ -196,7 +196,7 @@ int UplinkNASTransportMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
uplinkNASTransportPdu
);
asn_enc_rval_t
er
=
aper_encode_to_buffer
(
&
asn_DEF_Ngap_NGAP_PDU
,
NULL
,
uplinkNASTransportPdu
,
buf
,
buf_size
);
std
::
cout
<<
"er.encoded("
<<
er
.
encoded
<<
")"
<<
std
::
endl
;
//
std::cout << "er.encoded(" << er.encoded << ")" << std::endl;
return
er
.
encoded
;
}
...
...
src/ngap/ngap_app/ngap_app.cpp
View file @
044ed83d
...
...
@@ -77,9 +77,9 @@ void ngap_app::handle_receive(
"Decoded NGAP message, procedure code %d, present %d"
,
ngap_msg_pdu
->
choice
.
initiatingMessage
->
procedureCode
,
ngap_msg_pdu
->
present
);
printf
(
"after decoding ...
\n
"
);
//
printf("after decoding ...\n");
asn_fprint
(
stderr
,
&
asn_DEF_Ngap_NGAP_PDU
,
ngap_msg_pdu
);
printf
(
"end decoding ...
\n
"
);
//
printf("end decoding ...\n");
(
*
messages_callback
[
ngap_msg_pdu
->
choice
.
initiatingMessage
->
procedureCode
]
[
ngap_msg_pdu
->
present
-
1
])(
assoc_id
,
stream
,
ngap_msg_pdu
);
...
...
src/ngap/ngap_app/ngap_message_callback.hpp
View file @
044ed83d
...
...
@@ -151,9 +151,8 @@ int ngap_amf_handle_initial_context_setup_response(
}
std
::
vector
<
PDUSessionResourceSetupResponseItem_t
>
list
;
if
(
!
initCtxResp
->
getPduSessionResourceSetupResponseList
(
list
))
{
Logger
::
ngap
().
error
(
"Decode PduSessionResourceSetupResponseList IE error or this IE is not "
"available"
);
Logger
::
ngap
().
info
(
"Decode PduSessionResourceSetupResponseList IE failure"
);
return
0
;
}
...
...
src/secu_algorithms/5gaka/algorithm_from_spec/f12345.h
View file @
044ed83d
...
...
@@ -48,9 +48,9 @@ void f5star(u8 k[16], u8 rand[16], u8 ak[6]);
*-----------------------------------------------------------------*/
void
f1
(
u8
k
[
16
],
u8
rand
[
16
],
u8
sqn
[
6
],
u8
amf
[
2
],
u8
mac_a
[
8
])
{
printf
(
"opc: "
);
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"0x%x"
,
op_c
[
i
]);
printf
(
"
\n
"
);
//
printf("opc: ");
//
for (int i = 0; i < 16; i++) printf("0x%x", op_c[i]);
//
printf("\n");
// u8 op_c[16];
u8
temp
[
16
];
u8
in1
[
16
];
...
...
src/secu_algorithms/5gaka/rijndael.cpp
View file @
044ed83d
...
...
@@ -194,8 +194,8 @@ void Authentication_5gaka::RijndaelEncrypt(
#if AUTH_ALG_ON
printf
(
"end of round(%d)
\n
0x"
,
0
);
#endif
for
(
int
i
=
0
;
i
<
16
;
i
++
)
printf
(
"%x "
,
state
[
i
&
0x3
][
i
>>
2
]);
printf
(
"
\n
"
);
//
for (int i = 0; i < 16; i++) printf("%x ", state[i & 0x3][i >> 2]);
//
printf("\n");
for
(
r
=
1
;
r
<=
9
;
r
++
)
{
ByteSub
(
state
);
ShiftRow
(
state
);
...
...
src/utils/hex_string_convert.cpp
View file @
044ed83d
...
...
@@ -13,10 +13,10 @@ void convert_string_2_hex(std::string& input_str, std::string& output_str) {
memset
(
data
,
0
,
input_str
.
length
()
+
1
);
memcpy
((
void
*
)
data
,
(
void
*
)
input_str
.
c_str
(),
input_str
.
length
());
for
(
int
i
=
0
;
i
<
input_str
.
length
();
i
++
)
{
printf
(
"%02x "
,
data
[
i
]);
}
printf
(
"
\n
"
);
//
for (int i = 0; i < input_str.length(); i++) {
//
printf("%02x ", data[i]);
//
}
//
printf("\n");
char
*
datahex
=
(
char
*
)
malloc
(
input_str
.
length
()
*
2
+
1
);
memset
(
datahex
,
0
,
input_str
.
length
()
*
2
+
1
);
...
...
@@ -37,9 +37,9 @@ unsigned char* format_string_as_hex(std::string str) {
memcpy
((
void
*
)
data
,
(
void
*
)
str
.
c_str
(),
str_len
);
std
::
cout
<<
"Data: "
<<
data
<<
" ("
<<
str_len
<<
" bytes)"
<<
std
::
endl
;
//
std::cout << "Data: " << data << " (" << str_len << " bytes)" << std::endl;
std
::
cout
<<
"Data (formatted):
\n
"
;
//
std::cout << "Data (formatted): \n";
for
(
int
i
=
0
;
i
<
str_len
;
i
++
)
{
char
datatmp
[
3
]
=
{
0
};
memcpy
(
datatmp
,
&
data
[
i
],
2
);
...
...
@@ -53,14 +53,14 @@ unsigned char* format_string_as_hex(std::string str) {
// Convert two hexadecimal characters into one character
unsigned
int
nAsciiCharacter
;
sscanf
(
datatmp
,
"%x"
,
&
nAsciiCharacter
);
printf
(
"%x "
,
nAsciiCharacter
);
//
printf("%x ", nAsciiCharacter);
// Concatenate this character onto the output
datavalue
[
i
/
2
]
=
(
unsigned
char
)
nAsciiCharacter
;
// Skip the next character
i
++
;
}
printf
(
"
\n
"
);
//
printf("\n");
free_wrapper
((
void
**
)
&
data
);
return
datavalue
;
...
...
@@ -78,12 +78,12 @@ char* bstring2charString(bstring b) {
void
msg_str_2_msg_hex
(
std
::
string
msg
,
bstring
&
b
)
{
std
::
string
msg_hex_str
;
convert_string_2_hex
(
msg
,
msg_hex_str
);
printf
(
"tmp string: %s
\n
"
,
msg_hex_str
.
c_str
());
//
printf("tmp string: %s\n", msg_hex_str.c_str());
unsigned
int
msg_len
=
msg_hex_str
.
length
();
char
*
data
=
(
char
*
)
malloc
(
msg_len
+
1
);
memset
(
data
,
0
,
msg_len
+
1
);
memcpy
((
void
*
)
data
,
(
void
*
)
msg_hex_str
.
c_str
(),
msg_len
);
printf
(
"data: %s
\n
"
,
data
);
//
printf("data: %s\n", data);
uint8_t
*
msg_hex
=
(
uint8_t
*
)
malloc
(
msg_len
/
2
+
1
);
conv
::
ascii_to_hex
(
msg_hex
,
(
const
char
*
)
data
);
b
=
blk2bstr
(
msg_hex
,
(
msg_len
/
2
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment