Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied! <p>After having digged the crypto sources, I can say that ... No, I can't set up the <em>j</em> parameter I introduced in the question for the CTR mode.</p> <p>Nonetheless, I will give a few details about the inner crypto API to make this answer relevant. The details exposed herein are describing the internal low-level API to add support for new algorithms/modes in the crypto API.</p> <hr> <h2>Crypto objects</h2> <p>First of all, the crypto API manages collection of various <em>objects</em>. I use the word <em>object</em> because even though it's C programming, the code is obviously kinda object oriented. There are three main objects :</p> <ul> <li>Algorithms : <code>struct crypto_alg</code></li> <li>Templates : <code>struct crypto_template</code></li> <li>Instances : <code>struct crypto_instance</code> and <code>struct crypto_spawn</code></li> <li>Transforms : <code>struct crypto_tfm</code> and friends (<code>struct crypto_blkcipher</code>, ...).</li> </ul> <p>The first category is the milestone of this inner beast. When one wants to create a new algorithm, he only has to create a <code>struct crypto_alg</code>, fill the appropriate fields and register it.<br> Templates are a bit different since they rely on an a given algorithm structure. The algorithm object is passed when needed at run time. Therefore, templates are the suitable object for creating custom modes of execution (like it is implied in my original question).<br> Then, instances and spawns are here to handle internally how this little world interacts with the outside and with itself.<br> Finally, transforms structures are the "one-use" specific structures exposed to the outer interface (these will be used from other modules which need to encrypt/decrypt something).</p> <hr> <h2>Creating a new template</h2> <p>Basically, the procedure is rather simple, one can start from an existing template such as the ones found under the ctr.c file. Nevertheless, I will show some details.</p> <hr> <h2>How is the above handled by the crypto API</h2> <p>This part will cover the way the inner crypto part handles template or algorithm creation and the way it offers cryptographic features to the user (by <em>user</em>, understand <em>other modules</em>).</p> <p><em>Note: This answer is under construction, I will edit it regularly to add extra information.</em></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload