Using TPM under embedded Linux on ARM - arm

I want to learn about using TPM in embedded Linux on ARM for secureboot, TrustZone etc. But I'm currently lost finding a good starting point.
I used the search engines and read some stuff like "DEN0006D_Trusted_Board_Boot_Requirements" and "Infineon-ISPN-Use-Case-Secured-boot-for-ARM-processor-platforms-ABR-v01_00-EN". But nothing which really helped me gaining knowledge.
Either I used the wrong searching words or the information is mainly closed. The most stuff I found is about TPM and Windows...
Can someone recommend any webpage, book, video or something else to start?
Edit: Beside the things in the solution, I can recommend the free open book "A Practical Guide to TPM 2.0" https://link.springer.com/book/10.1007/978-1-4302-6584-9

I was using TPM lately on an embedded Linux and it's really a hard topic.
If you are talking about TPM itself, the first thing is which version you are using.
I am assuming that you are using TPM 2.0.
A good starting point for me was: tpm-js. You can use this tool
to learn a few things about TPM. You can browse sources of this project to
get a little deeper knowledge.
Then you can use Tpm2-tss library. Only a few months ago they
implemented the FAPI layer that simplifies the whole development.
And also there is a TPM 2.0 architecture doc that can help you a
lot, but I don't think it is a good starting point.
The last and very good source of information for me ware the people behind tpm2-tss library. Ask them on the tpm2-tss Git-Hub page.
I don't recommend you to use tpm2 tools. There ware a lot of changes lately and it will be really confusing for you in the beginning. First you need to learn the differences between hierarchies and the difference between primary key and it's child keys. A lot of these information you will find in tpm-js.

Related

Issues with VICE

I have recently started using VICE, specifically x64sc, and I was thinking of coding a game for it. However, I know almost nothing about what I want to do, and the manual isn't very helpful either. Some issues are particularly hard to overcome, and so far I can't find any solution
How do I copy files from a 1541 to an FD-4000? I was going to compile multiple basic extensions together to create a sort of all-in-one extension, but I don't know how to do that either.
How do I replace the kernal ROMs? My intention with this is to implement a fastloader that will work with a virtual FD-4000.
How do I get a virtual FD-4000 to work in VICE?
How do the tape images work? So far I haven't been able to find a conclusive answer.
I have downloaded some basic extensions, but I am not sure whether they are all compatible with the C64. As such, I would like to know information about the following programs, primarily if they are compatible.
apsoft-64
basic lightning v1.2
basic4.0
Basic expansion 4.5
c64 basic v3.5
DotBASIC
Game BASIC
Graphics basic
laser basic
metabasic
metabasic plus
modem basic v1.2
northcastle structured basic v1.7
tape master pro 2
ultra basic
Please let me know is there is a more appropriate place to post this.

Erlang source code guide

I am interested in delving into Erlang's C source code and try to understand what is going on under the hood. Where can I find info on the design and structure of the code?
First of all, you might want to have a look to Joe Armstrong's thesis, introducing Erlang at a high level. It will be useful to get an idea of what was the idea behind the language. Then, you could focus on the Erlang Run Time System (erts). The erlang.erl module could be a good start. Then, I would focus on the applications who constitutes the so-called minimal release, kernel and stdlib. Within the stdlib, have a look on how behaviours are implemented. May I suggest the gen_server.erl module as a start?
A Guide To The Erlang Source
http://www.trapexit.org/A_Guide_To_The_Erlang_Source
The short answer is that there is no good guide. And the code is not very well documented.
I recommend finding someone in your neighbourhood that knows the code reasonably well, and buy them dinner in exchange for a little chat.
If you don't have the possibility to do that, then I recommend starting with the loader.
./erts/emulator/beam/beam_load.c
Some useful information can also be found by pretty printing the beam representation. I don't know whether there is any way to do so supplied by OTP, but the HiPE project has some cheats.
hipe:c(MODULE, [pp_beam]).
Should get you started.
(And I also recommend Joe's book.)
Pretty printer of beam can be done by 'erlc -S', which is equivalent with hipe:c(M, [pp_beam]) mentioned by Daniel.
I also use erts_debug:df(Module). to disassemble the loaded beam code, which are instructions actually been interpreted by the VM.
Sometimes I use a debugger. OTP delivers tools supporting gdb very well. See example usage at http://www.erlang.org/pipermail/erlang-questions/2008-September/037793.html
A little late to the party here. If you just download the source from GitHub the internal documentation is really good. You have to generate some of it using make.
Get the documentation built and most of the relevant source is under /erts (Erlang Run Time System)
Edit: BEAM Wisdoms is also a really good guide but it may or may not be what you're after.

practicing C over the summer

I'm a student with a bit of experience in Java and C++ (one semester each)
Currently, I'm going through K&R and working on the exercises in the book. However, I was thinking of what I could work on over the summer since I'm almost done with K&R and I will have a lot of free time soon.
I really like building command line applications so I was thinking of getting involved with the coreutils project somehow. My question is, is it too early for me to be messing with coreutils? Should I be working on something a bit simpler perhaps? I'm a bit new with the Linux/Open source world if that matters but I'm really enjoying it.
I've done some project euler problems and I don't really like it that much.
Download the Nethack sources. Play it. If you ever get past that stage, then add some new and interesting monsters, weapons, traps and other objects.
https://openhatch.org/search/
http://sourceforge.net/people/
http://www.fsf.org/campaigns/priority-projects/
http://savannah.gnu.org/people/?type_id=1
You can do various other things with C:
Use various data structures like Link-list, tree, hash, heap
Try coding various algorithm implementation
Play with various string manipulation
Work with basic system and socket programing
List goes on..
There are (I'd argue) probably only a couple of places where C is still used extensively in preference to C++, so if you want to make a difference in the Open Source world I'd recommend thinking about working in one of the following areas:
Device drivers, and indeed most aspects of OS kernels.
Interfaces to scripting languages (Python, Perl, Lua etc.)
In both cases, C++ has no significant advantage, or some significant disadvantages, over C.
I agree absolutely with Mark's comment above that it is difficult to join a mature project. I have recently been trying to get a Haskell binding put together for SWIG, and it has proven to be pretty tricky - and I say that with over 20 years of C and about 15 of C++ behind me!
The problem is that mature codebases usually are not so clean, and this means that it can be difficult to understand how things hang together.
If you have the case, working on ARM device such as a Pandora or one of the other small embedded devices you can pick up is a lot of fun, and will teach quite a bit. In many cases what you are looking for is a device with a 'community' Linux port, and for many of these there are some quite basic components which are not yet working.
Good luck, and have fun!
I agree with Jeremy O'Donoghue's answer (since I am also a Mobile Device developer). Go install a 32-bit linux distro (if you don't already have), and start hacking Android Source Code.
There are many mailing-lists dedicated for the Android and you might try discuss some idea from there.
And there is also Google Summer of Code if you can make it

RTS AI: where to start?

I'd like to begin tinkering around with an RTS AI, but I'm having trouble finding a good environment to work with, ie a game that has been already created. I have looked at Spring RTS and Bos Wars, but they don't seem to be conducive to creating simple examples.
I am not totally opposed to writing my own game environment, it would just take a long time. Does anyone have a suggestion as to how I can get my feet wet without programming my own game?
There's actually a starcraft AI competition going on right now. The BWAPI ai api is very nice and should get you going very quickly. There are already many impressive entrants.
http://eis.ucsc.edu/StarCraftAICompetition
Edit :(, just realized how old this question is.
I can not say anything about the other projects, but i can speak for Spring RTS:
It supports a plugin system for AI Interfaces, and as of January 2011, comes with a Native (C/C++) and a JVM (Java, Groovy, JRuby, ...) AI Interface plugin. A Python plugin is quite mayor already, but not yet considered stable. There are lots of C++ AIs to be used as reference, while for Java, there is a small tutorial and a few AIs.
As the base of all the interfaces is the same (the engine), they are very similar in nature, so it is also possible to use C++ AIs as a reference when writing a Java AI and vice versa.
The AI development forum and the #ai channel on the lobby (also reachable through IRC) may be of use too.
The engine has already been used for at least 7 AIs developed during university thesis.
The engine its self is mostly written in C++, uses the CMake build system and compiles on Linux+GCC and Windows+MinGW (unofficially also on MSVC). You may want to follow the guide under Development - Compiling on the projects homepage, which explains how to compile the engine, and in turn also gets you the source code of the engine and a few AIs.
Check out ORTS, maintained by Michael Buro at the University of Alberta.
I haven't used it myself, but I've seen it in action since even before the first release in 2003, and it's definitely grown in leaps and bounds.
I'm pretty sure Strarcraft II will come with a very complete, programmable, editor (some people even transformed it into a FPS). It will be released on July the 2nd.
Supreme Commander is also moddable via Lua. There are several WWI - WWII strategy games also moddable via Lua.
On the Opensource front, glest and temulous have their source available; you might want to try modding them.
Finally, there's 0 A. D., which is also opensource, but on alpha.
My recommendation, however, is that you give a look at the Spring project.
If you have a few bucks, Garage Games has an RTS kit for its Torque game engine. http://www.garagegames.com/products/rts-genre-kit
This should allow you to begin writing some AI code immediately.

Writing Windows Port Monitor Basics

I'm trying to find a basic example, tutorial, or blog post on how to write a printer port monitor. I downloaded the Windows DDK and dug through localmon, but it appears that this sample is much more complex than just the nuts and bolts basics and from my understanding it is a bit different than an OEM port monitor because of how it handles the registry key and port enumeration. Does anyone know of a blog post, tutorial, or even book that walks the reader through the basic code to get one up and going? I've found a few links talking about the conceptual stuff, but nothing that is hands on code.
I can recomend http://www.codeproject.com/KB/printing/wpa.aspx, which describes how to write a printer driver and also has good hints about what's necessary to build a port monitor.
But my opinion is that a good tutorial in this area is not available on the Internet (I would be glad to find somebody who can show me that I'm wrong). So, when I had to deal with this task I was forced to do it the hard way: I've read carefully the MSDN explanations starting from this point: http://msdn.microsoft.com/en-us/library/ff561109.aspx. In parallel with reading MSDN I also checked the code in DDK you mentioned and try to understand it. I'm sure this solution could also work for you.
I wrote mine from the specs, there aren't really that many API's to implement.
The one thing that regularaly trips people up is EnumPorts, the spooler allocates enough memory for ALL the ports, not just yours. So you need to make sure you fill any strings from the end of the spoolers buffer, don't put them straight after your structures.
It doesn't say so in the specs but you can safely put the UI and Server functions in the same DLL.
It's also possible to create a single port monitor that supports NT and the later Windows 2000 type port monitors.
The code in RedMon is much easier to read than the localmon example, it's worth looking at before you start. It's quite nice because you can compile it in VS, you don't need to use the DDK to build it.
I have been over that exact same territory for a serial printer. About the best example I found was this article in Dr Dobbs Journal. The good part is that both a serial port driver and the user-space control program are covered and the project can also be used as an example of how to set up Visual Studio to compile a driver. This is also something a little difficult to find information about. The article discusses an old NT style driver, which worked well for me on XP.
There are quite a few good articles on CodeProject about writing drivers and programs to interact with them. They include source code and most deal with the newer WDM and WDF style drivers.
OSROnline is another good source, especially for discussion of specific issues and common mistakes. They also have some great utilities you will need.
Some of the most clearly written and understandable driver code I came across was Mark Russinovich's sample code. Although Microsoft withdrew all of the source when they purchased Sysinternals, some of the best examples can still be found cached here and there.
Drivers are pretty interesting. Whatever else you do though, do it in a virtual machine. Really.

Resources