[GitHub] [mynewt-core] nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware entropy config hooks

2020-02-25 Thread GitBox
nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware 
entropy config hooks
URL: https://github.com/apache/mynewt-core/pull/2184#discussion_r384019471
 
 

 ##
 File path: crypto/mbedtls/include/mbedtls/config_mynewt.h
 ##
 @@ -292,6 +293,10 @@ extern "C" {
 #undef MBEDTLS_ENTROPY_C
 #endif
 
+#if MYNEWT_VAL(MBEDTLS_ENTROPY_HARDWARE_ALT) == 0
 
 Review comment:
   Though not used now, keeping this for completeness.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware entropy config hooks

2020-02-25 Thread GitBox
nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware 
entropy config hooks
URL: https://github.com/apache/mynewt-core/pull/2184#discussion_r384019327
 
 

 ##
 File path: crypto/mbedtls/include/mbedtls/config_mynewt.h
 ##
 @@ -292,6 +293,10 @@ extern "C" {
 #undef MBEDTLS_ENTROPY_C
 #endif
 
+#if MYNEWT_VAL(MBEDTLS_ENTROPY_HARDWARE_ALT) == 0
 
 Review comment:
   Though not used now, keeping this for completeness.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware entropy config hooks

2020-02-25 Thread GitBox
nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware 
entropy config hooks
URL: https://github.com/apache/mynewt-core/pull/2184#discussion_r384018867
 
 

 ##
 File path: hw/drivers/trng/src/mbed_entropy_alt.c
 ##
 @@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include 
+#include "mbedtls/config_mynewt.h"
+
+#ifdef MBEDTLS_ENTROPY_HARDWARE_ALT
+int
+mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t 
*olen)
+{
+struct trng_dev *trng;
+int ret;
+
+trng = (struct trng_dev *)os_dev_lookup("trng");
+ret = trng_read(trng, output, len);
+if (ret == len) {
+*olen = len;
+} else {
+*olen = 0;
+}
 
 Review comment:
   done.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware entropy config hooks

2020-02-25 Thread GitBox
nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware 
entropy config hooks
URL: https://github.com/apache/mynewt-core/pull/2184#discussion_r384011864
 
 

 ##
 File path: hw/drivers/trng/src/mbed_entropy_alt.c
 ##
 @@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include 
+#include "mbedtls/config_mynewt.h"
+
+#ifdef MBEDTLS_ENTROPY_HARDWARE_ALT
+int
+mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t 
*olen)
+{
+struct trng_dev *trng;
+int ret;
+
+trng = (struct trng_dev *)os_dev_lookup("trng");
 
 Review comment:
   will add.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware entropy config hooks

2020-02-25 Thread GitBox
nkaje commented on a change in pull request #2184: crypto/mbedtls: add hardware 
entropy config hooks
URL: https://github.com/apache/mynewt-core/pull/2184#discussion_r383882344
 
 

 ##
 File path: hw/drivers/trng/trng_da1469x/src/trng_da1469x.c
 ##
 @@ -105,3 +106,23 @@ da1469x_trng_init(struct os_dev *dev, void *arg)
 
 return 0;
 }
+
+#ifdef MBEDTLS_ENTROPY_HARDWARE_ALT
+int
+mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t 
*olen)
 
 Review comment:
   done.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services