You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2017/03/30 21:12:23 UTC

[06/37] incubator-mynewt-core git commit: net/oic; use hal_bsp_dev_id() to generate platform uuid.

net/oic; use hal_bsp_dev_id() to generate platform uuid.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/e62a2458
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e62a2458
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e62a2458

Branch: refs/heads/nrf_cputime
Commit: e62a2458c2d8835bd8f5c532573ece4534532f57
Parents: 9d8c6f2
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Mon Mar 27 15:22:59 2017 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Mar 27 15:22:59 2017 -0700

----------------------------------------------------------------------
 net/oic/src/api/oc_uuid.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e62a2458/net/oic/src/api/oc_uuid.c
----------------------------------------------------------------------
diff --git a/net/oic/src/api/oc_uuid.c b/net/oic/src/api/oc_uuid.c
index 2ceaf7a..e0244fb 100644
--- a/net/oic/src/api/oc_uuid.c
+++ b/net/oic/src/api/oc_uuid.c
@@ -15,12 +15,13 @@
 */
 
 #include "oc_uuid.h"
-#include "port/oc_random.h"
 #include <ctype.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
 
+#include <hal/hal_bsp.h>
+
 void
 oc_str_to_uuid(const char *str, oc_uuid_t *uuid)
 {
@@ -92,17 +93,11 @@ oc_uuid_to_str(const oc_uuid_t *uuid, char *buffer, int buflen)
 void
 oc_gen_uuid(oc_uuid_t *uuid)
 {
-  int i;
-  uint16_t r;
-
-  for (i = 0; i < 8; i++) {
-    r = oc_random_rand();
-    memcpy((uint8_t *)&uuid->id[i * 2], (uint8_t *)&r, sizeof(r));
-  }
+  hal_bsp_hw_id(&uuid->id[0], sizeof(uuid->id));
 
   /*  From RFC 4122
       Set the two most significant bits of the
-      clock_seq_hi_and_reserved (8th octect) to
+      clock_seq_hi_and_reserved (8th octet) to
       zero and one, respectively.
   */
   uuid->id[8] &= 0x3f;