First commit to remove crypt dependency
This commit is contained in:
@@ -300,10 +300,6 @@ target_link_libraries(lte_rrc PRIVATE nr_rrc)
|
|||||||
add_library(nr_rrc ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c)
|
add_library(nr_rrc ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c)
|
||||||
target_link_libraries(nr_rrc PUBLIC asn1_nr_rrc asn1_lte_rrc)
|
target_link_libraries(nr_rrc PUBLIC asn1_nr_rrc asn1_lte_rrc)
|
||||||
|
|
||||||
|
|
||||||
# S1AP and NGAP need crypt library
|
|
||||||
pkg_check_modules(libcrypt REQUIRED libcrypt)
|
|
||||||
|
|
||||||
# S1AP
|
# S1AP
|
||||||
##############
|
##############
|
||||||
set(S1AP_DIR ${OPENAIR3_DIR}/S1AP)
|
set(S1AP_DIR ${OPENAIR3_DIR}/S1AP)
|
||||||
|
|||||||
+13
-10
@@ -33,7 +33,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <crypt.h>
|
#include "openair3/SECU/kdf.h"
|
||||||
|
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
@@ -71,17 +71,20 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *
|
|||||||
|
|
||||||
void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
|
void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
|
||||||
|
|
||||||
uint32_t ngap_generate_gNB_id(void) {
|
uint32_t ngap_generate_gNB_id(void)
|
||||||
char *out;
|
{
|
||||||
char hostname[50];
|
|
||||||
int ret;
|
|
||||||
uint32_t gNB_id;
|
|
||||||
/* Retrieve the host name */
|
/* Retrieve the host name */
|
||||||
ret = gethostname(hostname, sizeof(hostname));
|
char hostname[32] = {0};
|
||||||
|
int const ret = gethostname(hostname, sizeof(hostname));
|
||||||
DevAssert(ret == 0);
|
DevAssert(ret == 0);
|
||||||
out = crypt(hostname, "eurecom");
|
|
||||||
DevAssert(out != NULL);
|
uint8_t key[32] = {"eurecom"};
|
||||||
gNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]);
|
byte_array_t data = {.len = 32, .buf = (uint8_t *)hostname};
|
||||||
|
|
||||||
|
uint8_t out[32] = {0};
|
||||||
|
kdf(key, data, 32, out);
|
||||||
|
|
||||||
|
uint32_t const gNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]);
|
||||||
return gNB_id;
|
return gNB_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-10
@@ -32,7 +32,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <crypt.h>
|
#include "openair3/SECU/kdf.h"
|
||||||
|
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
@@ -108,17 +108,20 @@ int s1ap_timer_remove(long timer_id)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t s1ap_generate_eNB_id(void) {
|
uint32_t s1ap_generate_eNB_id(void)
|
||||||
char *out;
|
{
|
||||||
char hostname[50];
|
|
||||||
int ret;
|
|
||||||
uint32_t eNB_id;
|
|
||||||
/* Retrieve the host name */
|
/* Retrieve the host name */
|
||||||
ret = gethostname(hostname, sizeof(hostname));
|
char hostname[32] = {0};
|
||||||
|
int const ret = gethostname(hostname, sizeof(hostname));
|
||||||
DevAssert(ret == 0);
|
DevAssert(ret == 0);
|
||||||
out = crypt(hostname, "eurecom");
|
|
||||||
DevAssert(out != NULL);
|
uint8_t key[32] = {"eurecom"};
|
||||||
eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]);
|
byte_array_t data = {.len = 32, .buf = (uint8_t *)hostname};
|
||||||
|
|
||||||
|
uint8_t out[32] = {0};
|
||||||
|
kdf(key, data, 32, out);
|
||||||
|
|
||||||
|
uint32_t const eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]);
|
||||||
return eNB_id;
|
return eNB_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "byte_array.h"
|
#include "common/utils/ds/byte_array.h"
|
||||||
|
|
||||||
void kdf(const uint8_t key[32], byte_array_t data, size_t len, uint8_t out[len]);
|
void kdf(const uint8_t key[32], byte_array_t data, size_t len, uint8_t out[len]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user