The crux of the matter is that the code is free to use commercially but "somehow" you have to comply with the license terms. How the hell are you going to do that when selling a product which does not come with source code?
It depends on the license, of course. Here, the pertinent license is
Apache-2.0, or GPL 2.0 or later. For commercial use, Apache 2.0 is much simpler.
I have seen only bits of the sources for MbedTLS
The active development repository is
github.com/Mbed-TLS/mbedtls (aka
https://github.com/ARMmbed/mbedtls). All releases are tagged, too, so you can easily view or download any release or follow the main development branch, "
development".
especially given that a commercial product is obviously 100% binary
That's where you are obviously 100% wrong.
A lot of custom proprietary development is done by contractors for organizations,
with the sources provided. (Guess why I know?)
You are stuck in a specific view of what a commercial software product is, and this is causing the huge problems you are experiencing: the world just does not
fit your preconceptions. Recognize where the problem lies, and you can start to solve it. The world will not change for you, you have to adapt yourself, no matter how insane or weird it might feel like.
I do understand what you are experiencing, of course, because I went through the same around the turn of the century. My solution, which I warmly recommend to everyone doing software development based on open source work, is to hire a specialized lawyer for a few hours to explain these licenses and how they work for you. It worked for me better than I would ever have guessed.
in "open source" software anybody is free to use it for any purpose whatsoever. One can have a license stipulating that the author is credited but how do you do that on a commercially sold "box"?

The entire free software/open source/copyleft idea is based on the distinction set in copyright law. The license governs how one can distribute copies and derivatives of the work. It does not govern how the work is "used" outside of that.
The same distinction also lead to contributions becoming the "currency" in this ecosystem, with end user counts being irrelevant (and occasionally negative!) for developers; only mattering for social reasons, and for the companies and/or organizations funding the developers. To truly understand how and why these licenses work, you just have to get your mind around this. If you don't, you won't. I'm sorry to be this blunt, but getting this is absolutely critical here.
Free/open source licenses themselves can be divided roughly into two categories, based on their focus:
permissive, and
copyleft (or
protective). The permissive ones place minimal restrictions on copying and derivatives, focusing on
acknowledgement of authorship and origin. Copyleft, or protective licenses, want to ensure that all end users, even those of derivatives, have full access to the source code.
Let's step back a bit, and consider a practical example.
Let's say you have created Thingié, an off-the-shelf microcontroller product that uses MbedTLS under Apache-2.0 license. Buyers only get the device, a one-page brochure, a download link to a PDF manual, and perhaps a link to firmware update site; not the source code. How do you ensure you comply with the Apache-2.0 license?
First step is, of course, to understand the purpose of the Apache-2.0 license itself. It was first released in 2004 by the Apache Software Foundation, with the "official" text
here. It is a permissive license, well suited for integration into closed-source proprietary products, with its main focus on retaining attribution in copies and derivatives. The key part is section 4, Redistribution:
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
a. You must give any other recipients of the Work or Derivative Works a copy of this License; and
b. You must cause any modified files to carry prominent notices stating that You changed the files; and
c. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
d. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License.
You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
To fulfill 4.a, you include the license text in the user manual provided to customers. The recommended way is to include a paragraph in the introduction chapter, describing that the product uses MbedTLS (including specific version) under the Apache-2.0 license, and include (as an end note or attachment at the end of the manual) the text of the Apache-2.0 license. Similarly for all other permissively-licensed projects and their licenses you use. Note that to build community goodwill, you should not be ashamed or downplay the library use: quite contrary, you should be
celebrating its use, for example using wording like
"This product uses the MbedTLS library under the Apache-2.0 license. MbedTLS is a reference implementation of the Platform Security Architecture for security in Internet of Things hardware, software, and devices."While you do not need to do anything yo fulfill 4.b if you do not redistribute the sources, it is nevertheless a good idea to add a modification shortlog near the beginning of any file you modify. It is simply a comment block with the date, your name/pseudonym/ID, and reason for the modification. This suffices, plus it helps you yourself in maintaining the derivative library.
Paragraph 4.c just means you don't get to delete other peoples' notices in the sources if you distribute them. In practice, it means that if you create a derivative by only copying parts that you think pertinent, you should keep the comments related to attribution with your copies (for the parts you do copy), and not just skip/delete them. (Remember: the focus of this license is attribution. This makes more and more sense the more you think about it.)
Paragraph 4.d you can ignore for MbedTLS, because it does not have a NOTICE file. If it did, the user manual introduction paragraph should incorporate it the same way you did the Apache-2.0 license.
That's it.
Let's recap what you need to do to comply with the Apache-2.0 license you rely on with MbedTLS:
- In the user manual introduction chapter, include a paragraph describing MbedTLS, and that it is used under the Apache-2.0 license; and include the license at the end of the user manual.
- Internally, if you end up having to modify MbedTLS sources, just to help yourself in the future, mark your changes with a short comment at the beginning of each file you modify, preferably with a date, your pseudonym/name, and a one-line explanation of the change. This helps you track your own modifications; but if you end up changing your mind later on, and want to publish the modified version of MbedTLS also, you'll be in compliance then too — so this both helps you maintain the changes, and keeps your future options open.
- Uh.. profit?
The procedure is the same regardless of the license and project involved. For example, to use Qt under LGPL in a closed-source proprietary product, the added hurdle is that you need to let your users replace the Qt libraries incorporated with their own files, and only link to them dynamically (at run time); this is because the LGPL license is extremely strict about end user freedom to choose what they use.
As a vendor, you of course believe the product is
yours and end users are only
using it under a license, but the entire reason for free software and open source existing is the opposite: that outside of distribution governed by the copyright laws, the end users
own the copies in the sense that as long as they don't run afoul of copyright laws, they do get to apply the product any way they want. In fact, it is extremely close to the
Right of Ownership that e.g. Louis Rossmann is fighting for.