<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: nandhithakamal</title>
    <description>The latest articles on DEV Community by nandhithakamal (@nandhithakamal).</description>
    <link>https://dev.to/nandhithakamal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F208014%2F1f427e24-c974-4aa4-97ac-4302827e8609.jpg</url>
      <title>DEV Community: nandhithakamal</title>
      <link>https://dev.to/nandhithakamal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nandhithakamal"/>
    <language>en</language>
    <item>
      <title>Recommendations for a mechanical keyboard</title>
      <dc:creator>nandhithakamal</dc:creator>
      <pubDate>Mon, 29 Mar 2021 07:27:59 +0000</pubDate>
      <link>https://dev.to/nandhithakamal/recommendations-for-a-mechanical-keyboard-334l</link>
      <guid>https://dev.to/nandhithakamal/recommendations-for-a-mechanical-keyboard-334l</guid>
      <description>&lt;p&gt;Hey folks! &lt;br&gt;
I am looking to buy a mechanical keyboard. I am a beginner to this and I'm overwhelmed by all the different options out there. &lt;br&gt;
What would you recommend? And what does one factor in when buying a mechanical keeb? :D&lt;/p&gt;

&lt;p&gt;If you already have a mechanical keyboard, showcase your setup?&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>keyboards</category>
      <category>keebs</category>
    </item>
    <item>
      <title>How to TPM - Part 2 : TPM Software Stack</title>
      <dc:creator>nandhithakamal</dc:creator>
      <pubDate>Sat, 11 Jul 2020 13:09:15 +0000</pubDate>
      <link>https://dev.to/nandhithakamal/how-to-tpm-part-2-55ao</link>
      <guid>https://dev.to/nandhithakamal/how-to-tpm-part-2-55ao</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of the How to TPM series. In case you haven't read the previous post(s) in this series, you might want to start from there.&lt;/em&gt; &lt;/p&gt;




&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpny68p7sdp6ws5ocafbd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpny68p7sdp6ws5ocafbd.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The last post covered the basics of TPM vocabulary. This post will delve into the TPM ecosystem. The Trusted Computing Group(TCG) has put together specifications for the various components that come together to create the TPM 2 Software Stack. There are multiple libraries that implement these specs to suit specific operating systems and architectures.&lt;/p&gt;

&lt;h4&gt;
  
  
  SAPI - System API
&lt;/h4&gt;

&lt;p&gt;The System API  is a layer of the overall TSS architecture that provides access to all the functionality of a TPM 2.0 implementation.  It is designed to be used wherever low level calls to the TPM functions are made: firmware, BIOS, applications, OS,etc. &lt;/p&gt;

&lt;h4&gt;
  
  
  ESAPI - Extended System API
&lt;/h4&gt;

&lt;p&gt;ESAPI is the layer on top of SAPI. This provides for enhanced context management and Cryptographic operations. &lt;br&gt;
Even though ESAPI provides an easier way to use the TPM, using the ESAPI layer of APIs still requires an in-depth understanding of the TPM's internal workings.&lt;/p&gt;

&lt;h4&gt;
  
  
  FAPI - Feature API
&lt;/h4&gt;

&lt;p&gt;The FAPI layer is on top of the ESAPI layer. FAPI provides a high-level interface including a policy definition language and key store. A user would want to create keys without any knowledge of the underlying system. This is possible by using the FAPI layer of APIs.&lt;/p&gt;

&lt;h4&gt;
  
  
  TCTI - TPM Command Transmission Interface
&lt;/h4&gt;

&lt;p&gt;The TCTI is an IPC abstraction layer used to send commands to and receive responses from the TPM or the TAB/RM. This provides multiple interfaces between SAPI and the lower hardware layers depending on the type of TPM (physical TPM, tpm simulator, etc.) being used&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tpm2-tss&lt;/strong&gt; is a system utility that allows access to the TPM  from the OS and other programs. This library consists of implementations for all the layers from FAPI to the TCTI. &lt;a href="https://github.com/tpm2-software/tpm2-tss/blob/master/INSTALL.md" rel="noopener noreferrer"&gt;Install tpm2-tss.&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  TAB/RM: This is the TPM's Access Broker and Resource Manager.
&lt;/h4&gt;

&lt;p&gt;The access broker manages synchronization between the processes that use TPM simultaneously. The TAB is responsible for guaranteeing that a process using the TPM is able to proceed with the desired operation without any interference from any of the other simultanously TPM-accessinfg processes. &lt;/p&gt;

&lt;p&gt;The resource manager manages the TPM context in a fashion similar to the virtual memory manager. The TPM has a small memory capacity and is easily constrained by how many resources can be loaded simulatenously. The resource manager is responsible for swapping in and out of memory the various resources required by a process.&lt;/p&gt;

&lt;p&gt;In Unix, hardware devices are treated as files and can be accessed using file paths. Likewise, the tpm hardware can be accessed either using &lt;code&gt;/dev/tpm0&lt;/code&gt; or using &lt;code&gt;/dev/tpmrm0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/dev/tpm0&lt;/code&gt; is the direct path to the tpm hardware and at any given time, only a single process can access the tpm using this path. It is very common for multiple processes to require access to tpm. For this purpose, the &lt;code&gt;/dev/tpmrm0&lt;/code&gt; is used. This is the tpm's resource manager and using this multiple processes can use the tpm simultaneously. &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;tpm2-abrmd&lt;/strong&gt; is a system daemon that implements the TAB (TPM2 Access Broker) and resource manager specifications. The recent versions of kernel (starting from 4.12) have an in-kernal resource manager. If you are on a later version of the kernel, you would not need the tpm2-abrmd and can proceed using the in-kernal rm. &lt;br&gt;
&lt;a href="https://github.com/tpm2-software/tpm2-abrmd/blob/master/INSTALL.md" rel="noopener noreferrer"&gt;Install tpm2-abrmd.&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  TPM Device Driver
&lt;/h4&gt;

&lt;p&gt;The TPM device driver is an OS specific driver. It is responsible for establishing connection to the TPM and for reading from and writing to the TPM.&lt;/p&gt;

&lt;h4&gt;
  
  
  tpm2-tools
&lt;/h4&gt;

&lt;p&gt;This is not part of the TPM2 Software Stack per se, but is an end-user command line tool that can be used to generate keys, view capabilities, sign, hash, unseal, etc. &lt;br&gt;
&lt;a href="https://github.com/tpm2-software/tpm2-tools/blob/master/doc/INSTALL.md" rel="noopener noreferrer"&gt;Install tpm2-tools.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F47ftwdo73rmoce5y4zkv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F47ftwdo73rmoce5y4zkv.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>security</category>
      <category>tpm</category>
      <category>tss</category>
    </item>
    <item>
      <title>How to TPM - Part 1: TPM Vocabulary</title>
      <dc:creator>nandhithakamal</dc:creator>
      <pubDate>Wed, 27 May 2020 05:02:17 +0000</pubDate>
      <link>https://dev.to/nandhithakamal/tpm-part-1-4emf</link>
      <guid>https://dev.to/nandhithakamal/tpm-part-1-4emf</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsdrnihmljg37ycb8v5qz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsdrnihmljg37ycb8v5qz.jpg" alt="How to TPM"&gt;&lt;/a&gt;&lt;br&gt;
As part of a recent piece of work, we did a spike on TPM. During the process, I realised that there wasn't material available for beginners out there, at least not in a single place. A lot of the documentation around it is cryptic (pun unintentional!). The idea is to make it easier to understand for TPM novices like me. I plan on documenting this in parts, so that both the reading and writing are not overwhelming. Also, this series will not delve into the technical implementation of the specification and is my basic understanding of TPM and how one can use the TPM. &lt;/p&gt;

&lt;h3&gt;
  
  
  TPM - A Brief Introduction
&lt;/h3&gt;

&lt;h4&gt;
  
  
  What is a TPM?
&lt;/h4&gt;

&lt;p&gt;TPM stands for Trusted Platform Module. TPM is a cryptographic co-processor. What this means is that it the TPM in addition to other things, contains a processor that is specialised for cryptographic use-cases. It is a hardware chip that is attached to the motherboard of a computer. The TPM is an inbuilt security module.&lt;br&gt;
Over time, there have been multiple versions of TPM &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TPM 1.1b &lt;/li&gt;
&lt;li&gt;TPM 1.2&lt;/li&gt;
&lt;li&gt;TPM 2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this post I shall be talking only about TPM 2, unless I want to delve into some historical context or differences between the multiple versions.&lt;/p&gt;

&lt;h4&gt;
  
  
  What can a TPM do?
&lt;/h4&gt;

&lt;p&gt; The use-cases I have explored so far, TPM can be used to &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generate key pairs&lt;/li&gt;
&lt;li&gt;Store key pairs&lt;/li&gt;
&lt;li&gt;Hash&lt;/li&gt;
&lt;li&gt;Sign&lt;/li&gt;
&lt;li&gt;Encrypt/Decrypt&lt;/li&gt;
&lt;li&gt;Verify Signature&lt;/li&gt;
&lt;li&gt;Generate Random Numbers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It can likely be used for a whole bunch of other use-cases as well. I haven't explored other things at this point.&lt;br&gt;
Now, moving on to TPM specific vocabulary.&lt;/p&gt;

&lt;h5&gt;
  
  
  Hierarchies
&lt;/h5&gt;

&lt;p&gt;You can think of a hierarchy as a tree structure with the parent key at the root. This wraps around and encrypts all of its children keys. Keys can be created under any of the following 4 hierarchies.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Endorsement&lt;/strong&gt; - The endorsement hierarchy is the privacy-sensitive tree and is the hierarchy of choice when the user has privacy concerns. TPM and platform vendors certify that primary keys in this hierarchy are constrained to an authentic TPM attached to an authentic platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Owner&lt;/strong&gt; - Also called storage hierarchy, this is intended to be used by the platform owner, i.e., the device owner or user&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Platform&lt;/strong&gt; - Intended to be under the control of the platform manufacturer. This is used by the BIOS and System Management Mode (SMM).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Null&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of the above, Endorsement, Owner and Platform hierarchies are persistent hierarchies. And the Null hierarchy is an ephemeral hierarchy. What this means is that, keys created using either of Endorsement/Owner/Platform hierarchies can survive system re-boots. Keys created using Null hierarchy on the other hand are ephemeral i.e., will not be persisted between system reboots. All TPM objects (keys/data) belong to a hierarchy.&lt;br&gt;
The cryptographic root of each hierarchy is a seed. A seed is a large random number that the TPM generates. This seed is never exposed outside the TPM's secure boundary. This seed is the starting value from which keys are generated. It is also possible to further add security to the keys by adding password to the keys. Usage of the keys would now require the key password also.&lt;/p&gt;

&lt;p&gt;Although the TPM comes with a limited amount of Non-Volatile(NV) memory, it is possible to generate more than just a few keys. This is owing to the fact that one can recreate the same keys by applying a cryptographic algorithm on a given seed. It is deterministic. Thus the keys need not be saved in the file system(TPM allows for saving the keys in file system); it is always possible to regenerate them. &lt;/p&gt;

&lt;p&gt;Null hierarchy is an exception to this. For the ephemeral Null hierarchy, this seed value changes between power cycles. Once the seed value changes, it would not be possible to regenerate the previous keys. For this reason, the null hierarchy can be used to create password-less, transient session keys.&lt;/p&gt;

&lt;h5&gt;
  
  
  Handles
&lt;/h5&gt;

&lt;p&gt;A handle is a 32-bit reference to an entity in the TPM. An identifier that uniquely identifies a TPM resource that occupies TPM memory.&lt;br&gt;
There are 3 types of key handles. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transient&lt;/li&gt;
&lt;li&gt;Persistent&lt;/li&gt;
&lt;li&gt;Permanent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Transient handles are addresses of keys in the NVRAM. These point to keys that have either been loaded using tpm2_load or keys that have been (re)created but not persisted.&lt;/p&gt;

&lt;p&gt;Persistent handles reference keys in the NV memory of the TPM. These keys are persisted through power cycles and hence need not be recreated. To use the keys, they first need to loaded into the TPM. However, with the persistent keys, one need not load as these are resident in the TPM itself. If the key (re)creation time is longer, they are persisted using tpm2_evictcontrol. Otherwise, they can be recreated upon requirement.&lt;br&gt;
Permanent handles reference entities that can't be deleted. Among other things, this also includes handles to the 4 hierarchies.&lt;br&gt;
In addition there are other types of handles for NV indices, saved session, PCR, etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating Keys
&lt;/h4&gt;

&lt;p&gt;To create keys for signing, one needs to first create a primary key under any of the 4 hierarchies. This primary key can now be used to create children keys. The children keys can now be used for signing. It is also possible for each child key of the primary key to become parent keys if it meets certain conditions. Thus one can have a deep hierarchy of keys.&lt;br&gt;
The primary key cannot sign. It can only decrypt the child key for signing. This is specified by what is called key attributes. The key's attributes are set at key creation. These attributes are used to control the behaviour of the keys. &lt;/p&gt;

&lt;p&gt;Some of the commonly used attributes are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;fixedTPM:&lt;/strong&gt; If this attribute is set, the key cannot be duplicated in any way&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;fixedParent:&lt;/strong&gt; If this attribute is set, the parent of this key cannot be changed (more info on this in the future posts).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;sign:&lt;/strong&gt; If a key is to be used for signing, this attribute needs to be set.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;restricted:&lt;/strong&gt; A key with this attribute set can sign only hashes generated within the TPM&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;decrypt:&lt;/strong&gt; Only keys with this attribute are allowed to create or load children key. If this is attribute is set, the key can be a parent key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;sensitiveDataOrigin:&lt;/strong&gt; If this attribute is set, it indicates that the TPM generated all the sensitive data other than auth value for this key&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;noDA:&lt;/strong&gt; The object is subject to dictionary attack protections&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By using a combination of these attributes, one can create primary keys, keys for signing, parent keys, etc.&lt;/p&gt;

&lt;p&gt;In the next parts, I shall cover the various TPM components, accessing the TPM, getting hands-on with creating keys and signing.&lt;/p&gt;

</description>
      <category>tpm</category>
      <category>linux</category>
      <category>security</category>
    </item>
  </channel>
</rss>
