Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
openairinterface5G
Commits
4ac71a6e
Commit
4ac71a6e
authored
Oct 01, 2016
by
Rohit Gupta
Browse files
fixes for automatic version detection of nettle for 14.04/16.04
parent
bd25e2d9
Changes
4
Hide whitespace changes
Inline
Side-by-side
cmake_targets/CMakeLists.txt
View file @
4ac71a6e
...
...
@@ -186,6 +186,24 @@ set(GIT_BRANCH "UNKNOWN")
set
(
GIT_COMMIT_HASH
"UNKNOWN"
)
set
(
GIT_COMMIT_DATE
"UNKNOWN"
)
#This is to detect nettle version changes between Ubuntu 14.04/16.04
set
(
nettle_cmd
"nettle-hash"
)
set
(
nettle_arg
"-V"
)
execute_process
(
COMMAND
${
nettle_cmd
}
${
nettle_arg
}
RESULT_VARIABLE rv OUTPUT_VARIABLE ov ERROR_VARIABLE ev
)
string
(
REGEX MATCH
"[+-]?[0-9]+([.][0-9]+)?"
nv
${
ov
}
)
message
(
"NETTLE_VERSION =
${
nv
}
"
)
# we need to remove decimal as floating point arithematic does not work properly with C preprocessor
STRING
(
REGEX REPLACE
"[.]"
""
nv
${
nv
}
)
if
(
"
${
nv
}
"
STREQUAL
""
)
message
(
FATAL_ERROR
"The nettle version not detected properly. Try to run build_oai -I again"
)
endif
()
set
(
NETTLE_VERSION
"
${
nv
}
"
)
add_definitions
(
"-DNETTLE_VERSION=
${
NETTLE_VERSION
}
"
)
find_package
(
Git
)
if
(
GIT_FOUND
)
...
...
cmake_targets/tools/build_helper
View file @
4ac71a6e
...
...
@@ -334,17 +334,72 @@ check_install_oai_software() {
wget
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
$SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin
#Remove old gnutls/nettle installation that was done from sources
remove_nettle_from_source
$SUDO apt-get install -y nettle-dev nettle-bin
remove_gnutls_from_source
$SUDO apt-get install -y libgnutls-dev
install_asn1c_from_source
}
### Remove Nettle installation which was done from sources
remove_nettle_from_source() {
nettle_uninstall_log=$OPENAIR_DIR/cmake_targets/log/nettle_uninstall_log.txt
echo_info "\nUn-Installing Nettle from sources. The log file for nettle un-installation is here: $nettle_uninstall_log "
(
$SUDO apt-get remove -y nettle-dev nettle-bin
cd /tmp
echo "Downloading nettle archive"
$SUDO rm -rf /tmp/nettle-2.5.tar.gz* /tmp/nettle-2.5
wget https://ftp.gnu.org/gnu/nettle/nettle-2.5.tar.gz
if [ $? -ne 0 ]; then
wget ftp://ftp.lysator.liu.se/pub/security/lsh/nettle-2.5.tar.gz
fi
if [ ! -f nettle-2.5.tar.gz ]; then
echo_error "Could not download nettle source files"
cd -
return
fi
tar -xzf nettle-2.5.tar.gz
cd nettle-2.5/
./configure --disable-openssl --enable-shared --prefix=/usr
$SUDO make uninstall || true
) >& $nettle_uninstall_log
}
### Remove Gnutls from source
remove_gnutls_from_source(){
gnutls_uninstall_log=$OPENAIR_DIR/cmake_targets/log/gnutls_uninstall_log.txt
echo_info "\nUn-Installing Gnutls. The log file for Gnutls un-installation is here: $gnutls_uninstall_log "
(
$SUDO apt-get remove -y libgnutls-dev
cd /tmp
echo "Downloading gnutls archive"
$SUDO rm -rf /tmp/gnutls-3.1.23.tar.xz* /tmp/gnutls-3.1.23
wget http://mirrors.dotsrc.org/gcrypt/gnutls/v3.1/gnutls-3.1.23.tar.xz || \
wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/gnutls-3.1.23.tar.xz
if [ ! -f gnutls-3.1.23.tar.xz ]; then
echo_error "Could not download gnutls source files"
cd -
return
fi
tar -xJf gnutls-3.1.23.tar.xz
cd gnutls-3.1.23/
./configure --prefix=/usr
$SUDO make uninstall || true
)>& $gnutls_uninstall_log
}
install_asn1c_from_source(){
asn1_install_log=$OPENAIR_DIR/cmake_targets/log/asn1c_install_log.txt
echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log "
(
$SUDO rm -rf /tmp/asn1c
$SUDO
GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
cd /tmp/asn1c
./configure
make -j`nproc`
...
...
openair2/UTIL/OSA/osa_stream_eea.c
View file @
4ac71a6e
...
...
@@ -199,8 +199,13 @@ int stream_encrypt_eea2(stream_cipher_t *stream_cipher, uint8_t **out)
}
#endif
#if NETTLE_VERSION <= 27
nettle_aes128
.
set_encrypt_key
(
ctx
,
stream_cipher
->
key_length
,
stream_cipher
->
key
);
#else
nettle_aes128
.
set_encrypt_key
(
ctx
,
stream_cipher
->
key
);
#endif
nettle_ctr_crypt
(
ctx
,
nettle_aes128
.
encrypt
,
nettle_aes128
.
block_size
,
m
,
...
...
openair3/SECU/nas_stream_eea2.c
View file @
4ac71a6e
...
...
@@ -85,8 +85,13 @@ int nas_stream_encrypt_eea2(nas_stream_cipher_t *stream_cipher, uint8_t *out)
}
#endif
#if NETTLE_VERSION <= 27
nettle_aes128
.
set_encrypt_key
(
ctx
,
stream_cipher
->
key_length
,
stream_cipher
->
key
);
#else
nettle_aes128
.
set_encrypt_key
(
ctx
,
stream_cipher
->
key
);
#endif
nettle_ctr_crypt
(
ctx
,
nettle_aes128
.
encrypt
,
nettle_aes128
.
block_size
,
m
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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