Skip to content

Commit 8daf67f

Browse files
committed
Add MbedTLS setup and teardown
1 parent 58ee0a9 commit 8daf67f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

getting-started/main.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
#include <mbed.h>
18+
#include <platform.h>
1719
#include "psa/crypto.h"
1820
#include "mbedtls/version.h"
1921
#include <string.h>
@@ -759,6 +761,13 @@ int main(void)
759761
{
760762
printf("-- Begin Mbed Crypto Getting Started --\n\n");
761763

764+
int ret = 0;
765+
766+
if((ret = mbedtls_platform_setup(NULL)) != 0) {
767+
mbedtls_printf("Platform initialization failed with error %d\r\n", ret);
768+
return 1;
769+
}
770+
762771
import_a_key();
763772
sign_a_message_using_rsa();
764773
encrypt_with_symmetric_ciphers();
@@ -771,6 +780,7 @@ int main(void)
771780
authenticate_and_decrypt_a_message();
772781
generate_and_export_a_public_key();
773782

783+
mbedtls_platform_teardown(NULL);
774784
printf("\n-- End Mbed Crypto Getting Started --\n");
775785

776786
return 0;

0 commit comments

Comments
 (0)