1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1526670..48e7880 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,7 +94,7 @@ find_package(GnuradioOsmosdr)
find_package(Uhd)
find_package(LibbladeRF)
find_package(FFTW3F)
-find_package(Polarssl)
+find_package(MbedTLS)
if(NOT GNURADIO_RUNTIME_FOUND)
message(FATAL_ERROR "GNURadio required to compile openLTE")
diff --git a/LTE_fdd_enodeb/CMakeLists.txt b/LTE_fdd_enodeb/CMakeLists.txt
index 176bac2..ac71479 100755
--- a/LTE_fdd_enodeb/CMakeLists.txt
+++ b/LTE_fdd_enodeb/CMakeLists.txt
@@ -24,7 +24,7 @@ add_executable(LTE_fdd_enodeb
src/LTE_fdd_enb_mme.cc
src/LTE_fdd_enb_gw.cc
)
-target_link_libraries(LTE_fdd_enodeb lte fftw3f tools pthread rt ${POLARSSL_LIBRARIES} ${UHD_LIBRARIES} ${LIBBLADERF_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_PMT_LIBRARIES})
+target_link_libraries(LTE_fdd_enodeb lte fftw3f tools pthread rt ${MBEDTLS_LIBRARIES} ${UHD_LIBRARIES} ${LIBBLADERF_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_PMT_LIBRARIES})
install(TARGETS LTE_fdd_enodeb DESTINATION bin)
install(CODE "execute_process(COMMAND chmod +x \"${CMAKE_SOURCE_DIR}/enodeb_nat_script.sh\")")
-install(CODE "execute_process(COMMAND \"${CMAKE_SOURCE_DIR}/enodeb_nat_script.sh\")")
+#install(CODE "execute_process(COMMAND \"${CMAKE_SOURCE_DIR}/enodeb_nat_script.sh\")")
diff --git a/README b/README
index 169e9ad..81ff3d3 100755
--- a/README
+++ b/README
@@ -25,7 +25,7 @@ openLTE is dependant on the following:
4) UHD
5) HackRF
6) bladeRF
-7) polarssl
+7) mbedtls
8) iptables
To build the C++ and python code use the following:
diff --git a/cmake/Modules/FindMbedTLS.cmake b/cmake/Modules/FindMbedTLS.cmake
new file mode 100755
index 0000000..5f9ab86
--- /dev/null
+++ b/cmake/Modules/FindMbedTLS.cmake
@@ -0,0 +1,47 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_MBEDTLS mbedtls)
+
+FIND_PATH(
+ MBEDTLS_INCLUDE_DIRS
+ NAMES mbedtls/version.h
+ HINTS $ENV{MBEDTLS_DIR}/include
+ ${PC_MBEDTLS_INCLUDEDIR}
+ ${CMAKE_INSTALL_PREFIX}/include
+ PATHS /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ MBEDTLS_LIBRARY
+ NAMES mbedtls
+ HINTS $ENV{MBEDTLS_DIR}/lib
+ ${PC_MBEDTLS_LIBDIR}
+ ${CMAKE_INSTALL_PREFIX}/lib
+ ${CMAKE_INSTALL_PREFIX}/lib64
+ PATHS /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+)
+
+FIND_LIBRARY(
+ MBEDCRYPTO_LIBRARY
+ NAMES mbedcrypto
+ HINTS $ENV{MBEDTLS_DIR}/lib
+ ${PC_MBEDTLS_LIBDIR}
+ ${CMAKE_INSTALL_PREFIX}/lib
+ ${CMAKE_INSTALL_PREFIX}/lib64
+ PATHS /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+)
+
+set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARY} ${MBEDCRYPTO_LIBRARY})
+
+message(STATUS "MBEDTLS LIBRARIES " ${MBEDTLS_LIBRARIES})
+message(STATUS "MBEDTLS INCLUDE DIRS " ${MBEDTLS_INCLUDE_DIRS})
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MBEDTLS DEFAULT_MSG MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS)
+MARK_AS_ADVANCED(MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS)
diff --git a/cmake/Modules/FindPolarssl.cmake b/cmake/Modules/FindPolarssl.cmake
deleted file mode 100755
index 40f1f7b..0000000
--- a/cmake/Modules/FindPolarssl.cmake
+++ /dev/null
@@ -1,32 +0,0 @@
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PC_POLARSSL polarssl)
-
-FIND_PATH(
- POLARSSL_INCLUDE_DIRS
- NAMES polarssl/version.h
- HINTS $ENV{POLARSSL_DIR}/include
- ${PC_POLARSSL_INCLUDEDIR}
- ${CMAKE_INSTALL_PREFIX}/include
- PATHS /usr/local/include
- /usr/include
-)
-
-FIND_LIBRARY(
- POLARSSL_LIBRARIES
- NAMES polarssl
- HINTS $ENV{POLARSSL_DIR}/lib
- ${PC_POLARSSL_LIBDIR}
- ${CMAKE_INSTALL_PREFIX}/lib
- ${CMAKE_INSTALL_PREFIX}/lib64
- PATHS /usr/local/lib
- /usr/local/lib64
- /usr/lib
- /usr/lib64
-)
-
-message(STATUS "POLARSSL LIBRARIES " ${POLARSSL_LIBRARIES})
-message(STATUS "POLARSSL INCLUDE DIRS " ${POLARSSL_INCLUDE_DIRS})
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(POLARSSL DEFAULT_MSG POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)
-MARK_AS_ADVANCED(POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)
diff --git a/liblte/src/liblte_security.cc b/liblte/src/liblte_security.cc
index 7f968b8..2b320e5 100755
--- a/liblte/src/liblte_security.cc
+++ b/liblte/src/liblte_security.cc
@@ -35,8 +35,9 @@
*******************************************************************************/
#include "liblte_security.h"
-#include "polarssl/compat-1.2.h"
-#include "polarssl/aes.h"
+#include "mbedtls/aes.h"
+#include "mbedtls/compat-1.3.h"
+#include "mbedtls/ssl.h"
#include "math.h"
/*******************************************************************************
@@ -257,7 +258,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_asme(uint8 *ck,
}
// Derive Kasme
- sha2_hmac(key, 32, s, 14, k_asme, 0);
+ //sha2_hmac(key, 32, s, 14, k_asme, 0);
+ md_hmac(md_info_from_type(MBEDTLS_MD_SHA256), key, 32, s, 14, k_asme);
err = LIBLTE_SUCCESS;
}
@@ -292,7 +294,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_enb(uint8 *k_asme,
s[6] = 0x04; // Second byte of L0
// Derive Kenb
- sha2_hmac(k_asme, 32, s, 7, k_enb, 0);
+ //sha2_hmac(k_asme, 32, s, 7, k_enb, 0);
+ md_hmac(md_info_from_type(MBEDTLS_MD_SHA256), k_asme, 32, s, 7, k_enb);
err = LIBLTE_SUCCESS;
}
@@ -330,7 +333,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8
s[6] = 0x01; // Second byte of L1
// Derive KNASenc
- sha2_hmac(k_asme, 32, s, 7, k_nas_enc, 0);
+ //sha2_hmac(k_asme, 32, s, 7, k_nas_enc, 0);
+ md_hmac(md_info_from_type(MBEDTLS_MD_SHA256), k_asme, 32, s, 7, k_nas_enc);
// Construct S for KNASint
s[0] = 0x15; // FC
@@ -342,7 +346,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8
s[6] = 0x01; // Second byte of L1
// Derive KNASint
- sha2_hmac(k_asme, 32, s, 7, k_nas_int, 0);
+ //sha2_hmac(k_asme, 32, s, 7, k_nas_int, 0);
+ md_hmac(md_info_from_type(MBEDTLS_MD_SHA256), k_asme, 32, s, 7, k_nas_int);
err = LIBLTE_SUCCESS;
}
@@ -380,7 +385,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_rrc(uint8
s[6] = 0x01; // Second byte of L1
// Derive KRRCenc
- sha2_hmac(k_enb, 32, s, 7, k_rrc_enc, 0);
+ //sha2_hmac(k_enb, 32, s, 7, k_rrc_enc, 0);
+ md_hmac(md_info_from_type(MBEDTLS_MD_SHA256), k_enb, 32, s, 7, k_rrc_enc);
// Construct S for KRRCint
s[0] = 0x15; // FC
@@ -392,7 +398,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_rrc(uint8
s[6] = 0x01; // Second byte of L1
// Derive KRRCint
- sha2_hmac(k_enb, 32, s, 7, k_rrc_int, 0);
+ //sha2_hmac(k_enb, 32, s, 7, k_rrc_int, 0);
+ md_hmac(md_info_from_type(MBEDTLS_MD_SHA256), k_enb, 32, s, 7, k_rrc_int);
err = LIBLTE_SUCCESS;
}
@@ -431,7 +438,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_up(uint8
s[6] = 0x01; // Second byte of L1
// Derive KUPenc
- sha2_hmac(k_enb, 32, s, 7, k_up_enc, 0);
+ //sha2_hmac(k_enb, 32, s, 7, k_up_enc, 0);
+ md_hmac(md_info_from_type(MBEDTLS_MD_SHA256), k_enb, 32, s, 7, k_up_enc);
// Construct S for KUPint
s[0] = 0x15; // FC
@@ -443,7 +451,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_up(uint8
s[6] = 0x01; // Second byte of L1
// Derive KUPint
- sha2_hmac(k_enb, 32, s, 7, k_up_int, 0);
+ //sha2_hmac(k_enb, 32, s, 7, k_up_int, 0);
+ md_hmac(md_info_from_type(MBEDTLS_MD_SHA256), k_enb, 32, s, 7, k_up_int);
err = LIBLTE_SUCCESS;
}
|