From 803fec91c8f25f85abafc823e858f2815b2adc63 Mon Sep 17 00:00:00 2001 From: Kishen Maloor Date: Sun, 29 Sep 2019 18:18:08 -0700 Subject: [PATCH] Minor cleanup Change-Id: I4e5c96472460ecf9c23c3f03ab7e0d9559f8eaab Signed-off-by: Kishen Maloor --- api/oc_network_events.c | 2 +- apps/cloud_certification_tests.c | 1 + include/oc_acl_common.h | 2 +- include/oc_api.h | 2 +- include/oc_collection.h | 2 +- include/oc_cred_common.h | 2 +- include/oc_network_events.h | 2 +- include/oc_rep.h | 2 +- include/oc_ri.h | 2 +- port/linux/Makefile | 5 +++-- security/oc_acl.c | 2 +- security/oc_acl.h | 4 ++-- security/oc_certs.c | 2 +- security/oc_certs.h | 5 +++-- security/oc_cred.c | 2 +- security/oc_cred.h | 2 +- security/oc_csr.c | 2 +- security/oc_csr.h | 5 +++-- security/oc_doxm.c | 4 ++-- security/oc_doxm.h | 5 +++-- security/oc_keypair.c | 4 ++-- security/oc_keypair.h | 5 +++-- security/oc_obt_otm_cert.c | 2 +- security/oc_pstat.c | 2 +- security/oc_pstat.h | 2 +- security/oc_roles.c | 2 +- security/oc_roles.h | 5 +++-- security/oc_sp.c | 2 +- security/oc_sp.h | 5 +++-- security/oc_store.c | 2 +- security/oc_store.h | 2 +- security/oc_svr.c | 2 +- security/oc_svr.h | 2 +- security/oc_tls.c | 14 ++++++-------- security/oc_tls.h | 2 +- 35 files changed, 57 insertions(+), 51 deletions(-) diff --git a/api/oc_network_events.c b/api/oc_network_events.c index f7e82fc92..26c9df8ef 100644 --- a/api/oc_network_events.c +++ b/api/oc_network_events.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2016 Intel Corporation +// Copyright (c) 2016-2018 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/apps/cloud_certification_tests.c b/apps/cloud_certification_tests.c index e39bb8295..fecf0bd08 100644 --- a/apps/cloud_certification_tests.c +++ b/apps/cloud_certification_tests.c @@ -441,6 +441,7 @@ ocf_event_thread(void *data) printf("pthread_mutex_init failed!\n"); return NULL; } + oc_set_con_res_announced(false); oc_set_max_app_data_size(6000); int init = oc_main_init(&handler); if (init < 0) diff --git a/include/oc_acl_common.h b/include/oc_acl_common.h index 6fb836d78..7a2f9af11 100644 --- a/include/oc_acl_common.h +++ b/include/oc_acl_common.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017-2019 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/include/oc_api.h b/include/oc_api.h index 9fcf0cab8..f062518d1 100644 --- a/include/oc_api.h +++ b/include/oc_api.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2016 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/include/oc_collection.h b/include/oc_collection.h index 49e3ca6c0..ca875cfef 100644 --- a/include/oc_collection.h +++ b/include/oc_collection.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2016 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/include/oc_cred_common.h b/include/oc_cred_common.h index cf138f140..24e0e998b 100644 --- a/include/oc_cred_common.h +++ b/include/oc_cred_common.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017-2019 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/include/oc_network_events.h b/include/oc_network_events.h index 701729fe5..e119f9541 100644 --- a/include/oc_network_events.h +++ b/include/oc_network_events.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2016 Intel Corporation +// Copyright (c) 2016-2018 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/include/oc_rep.h b/include/oc_rep.h index 80e6c0979..969c22aac 100644 --- a/include/oc_rep.h +++ b/include/oc_rep.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2016 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/include/oc_ri.h b/include/oc_ri.h index 2ba193455..51aae0b8d 100644 --- a/include/oc_ri.h +++ b/include/oc_ri.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2016 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/port/linux/Makefile b/port/linux/Makefile index 152921c2b..4d9c134f8 100644 --- a/port/linux/Makefile +++ b/port/linux/Makefile @@ -130,12 +130,13 @@ endif OBT = onboarding_tool ifeq ($(DEBUG),1) - CFLAGS += -DOC_DEBUG -g -O0 + EXTRA_CFLAGS += -DOC_DEBUG -g -O0 ifeq ($(DEBUG_TLS),1) - CFLAGS += -DOC_DEBUG_TLS + EXTRA_CFLAGS += -DOC_DEBUG_TLS endif else CFLAGS += -Wl,--gc-sections + CXXFLAGS += -Wl,--gc-sections endif ifeq ($(PKI),1) diff --git a/security/oc_acl.c b/security/oc_acl.c index 3f90917cc..b81b55b4b 100644 --- a/security/oc_acl.c +++ b/security/oc_acl.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017-2019 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_acl.h b/security/oc_acl.h index 6de7f297c..13cf854d4 100644 --- a/security/oc_acl.h +++ b/security/oc_acl.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ #ifndef OC_ACL_H #define OC_ACL_H -#include "oc_obt.h" +#include "oc_acl_common.h" #include "oc_ri.h" #include "oc_uuid.h" #include "port/oc_log.h" diff --git a/security/oc_certs.c b/security/oc_certs.c index a3c4fcff9..fb8e19f22 100644 --- a/security/oc_certs.c +++ b/security/oc_certs.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2018-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_certs.h b/security/oc_certs.h index 373704bfc..aa73a6ee8 100644 --- a/security/oc_certs.h +++ b/security/oc_certs.h @@ -23,13 +23,14 @@ #include "security/oc_cred.h" #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif int oc_certs_parse_CN_for_UUID(const mbedtls_x509_crt *cert, oc_string_t *subjectuuid); int oc_certs_parse_CN_for_UUID_raw(const unsigned char *cert, size_t cert_size, - oc_string_t *uuid); + oc_string_t *uuid); int oc_certs_encode_CN_with_UUID(oc_uuid_t *uuid, char *buf, size_t buf_len); int oc_certs_serialize_chain_to_pem(const mbedtls_x509_crt *cert_chain, char *output_buffer, diff --git a/security/oc_cred.c b/security/oc_cred.c index 6e3218b98..18fb455a6 100644 --- a/security/oc_cred.c +++ b/security/oc_cred.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017-2019 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_cred.h b/security/oc_cred.h index 8e0d7796c..13c6055de 100644 --- a/security/oc_cred.h +++ b/security/oc_cred.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017-2019 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_csr.c b/security/oc_csr.c index 31f7d742f..4928d28c7 100644 --- a/security/oc_csr.c +++ b/security/oc_csr.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2018-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_csr.h b/security/oc_csr.h index ed8658994..5fdffbd79 100644 --- a/security/oc_csr.h +++ b/security/oc_csr.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2018-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,7 +25,8 @@ #include "oc_ri.h" #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif void get_csr(oc_request_t *request, oc_interface_mask_t iface_mask, void *data); diff --git a/security/oc_doxm.c b/security/oc_doxm.c index 41904c2d7..685c044bb 100644 --- a/security/oc_doxm.c +++ b/security/oc_doxm.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ oc_sec_doxm_init(void) void oc_sec_doxm_default(size_t device) { - doxm[device].oxmsel = -1; + doxm[device].oxmsel = 0; #ifdef OC_PKI doxm[device].sct = 9; #else /* OC_PKI */ diff --git a/security/oc_doxm.h b/security/oc_doxm.h index c6f52858d..fee744bf2 100644 --- a/security/oc_doxm.h +++ b/security/oc_doxm.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -52,7 +52,8 @@ bool oc_sec_decode_doxm(oc_rep_t *rep, bool from_storage, size_t device); void oc_sec_encode_doxm(size_t device); oc_sec_doxm_t *oc_sec_get_doxm(size_t device); void oc_sec_doxm_default(size_t device); -void get_doxm(oc_request_t *request, oc_interface_mask_t iface_mask, void *data); +void get_doxm(oc_request_t *request, oc_interface_mask_t iface_mask, + void *data); void post_doxm(oc_request_t *request, oc_interface_mask_t iface_mask, void *data); diff --git a/security/oc_keypair.c b/security/oc_keypair.c index 9f4b8a94f..e0b32a885 100644 --- a/security/oc_keypair.c +++ b/security/oc_keypair.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2018-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -207,7 +207,7 @@ oc_generate_ecdsa_keypair_for_device(size_t device) return 0; } -#else /* OC_PKI */ +#else /* OC_PKI */ typedef int dummy_declaration; #endif /* !OC_PKI */ #endif /* OC_SECURITY */ diff --git a/security/oc_keypair.h b/security/oc_keypair.h index 967685856..0dcaee205 100644 --- a/security/oc_keypair.h +++ b/security/oc_keypair.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2018-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,8 @@ #include #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif #define OC_KEYPAIR_PUBKEY_SIZE (91) diff --git a/security/oc_obt_otm_cert.c b/security/oc_obt_otm_cert.c index 31fe24a20..66e2ef890 100644 --- a/security/oc_obt_otm_cert.c +++ b/security/oc_obt_otm_cert.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017-2019 Intel Corporation +// Copyright (c) 2019 Intel Corporation // // Li!censed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_pstat.c b/security/oc_pstat.c index bf2303d35..69c4dc1c9 100644 --- a/security/oc_pstat.c +++ b/security/oc_pstat.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_pstat.h b/security/oc_pstat.h index ec0cc8d40..97c34e124 100644 --- a/security/oc_pstat.h +++ b/security/oc_pstat.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_roles.c b/security/oc_roles.c index 2f2815539..767a592b3 100644 --- a/security/oc_roles.c +++ b/security/oc_roles.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2018-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_roles.h b/security/oc_roles.h index f35762169..4e010c4b9 100644 --- a/security/oc_roles.h +++ b/security/oc_roles.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2018-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,8 @@ #include "security/oc_tls.h" #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif /* Used on the server-side for handling role assertions via /oic/sec/roles */ diff --git a/security/oc_sp.c b/security/oc_sp.c index 3c6178156..76b76f5ec 100644 --- a/security/oc_sp.c +++ b/security/oc_sp.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2018-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_sp.h b/security/oc_sp.h index 471f1e3b3..42c43dd7e 100644 --- a/security/oc_sp.h +++ b/security/oc_sp.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2018-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,7 +21,8 @@ #include "oc_pki.h" #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif typedef struct diff --git a/security/oc_store.c b/security/oc_store.c index c8c764d31..7d4a4e329 100644 --- a/security/oc_store.c +++ b/security/oc_store.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_store.h b/security/oc_store.h index 0afd4766c..4f5eee531 100644 --- a/security/oc_store.h +++ b/security/oc_store.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_svr.c b/security/oc_svr.c index b849499f0..ed193f9ee 100644 --- a/security/oc_svr.c +++ b/security/oc_svr.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_svr.h b/security/oc_svr.h index daa45d00e..182cbf40f 100644 --- a/security/oc_svr.h +++ b/security/oc_svr.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/security/oc_tls.c b/security/oc_tls.c index 1e8328fa8..a816adeff 100644 --- a/security/oc_tls.c +++ b/security/oc_tls.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -139,13 +139,6 @@ static int *ciphers = NULL; #ifdef OC_PKI static int selected_mfg_cred = -1; static int selected_id_cred = -1; - -#ifdef OC_CLIENT -static const int psk_priority[2] = { - MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256, 0 -}; -#endif /* OC_CLIENT */ - static const int default_priority[8] = { #else /* OC_PKI */ static const int default_priority[2] = { @@ -163,6 +156,10 @@ static const int default_priority[2] = { }; #ifdef OC_CLIENT +static const int psk_priority[2] = { + MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256, 0 +}; + static const int anon_ecdh_priority[2] = { MBEDTLS_TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256, 0 }; @@ -188,6 +185,7 @@ static const int otm_priority[3] = { #ifdef OC_CLIENT #ifdef OC_PKI + static const int cloud_priority[3] = { MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, 0 diff --git a/security/oc_tls.h b/security/oc_tls.h index c8a29c6f3..76d28e70b 100644 --- a/security/oc_tls.h +++ b/security/oc_tls.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2018 Intel Corporation +// Copyright (c) 2016-2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. -- GitLab