Input and Output Block Conventions for AES Encryption Algorithms by Dr

Input and Output Block Conventions for AES Encryption Algorithms by Dr

The NIST Advanced Encryption Standard (AES) Input and Output Block Conventions Input and Output Block Conventions for AES Encryption Algorithms By Dr. B. R. Gladman Introduction means that we cannot avoid dealing with such issues. 1. Cryptographic algorithms operate in computer memory and transform memory blocks for inputs, 6. In considering how this impacts on crypto- outputs and keys. When these values need to be graphic algorithms, we have to decide whether calculated consistently in many different proces- our algorithms should act on the bits without con- sor environments it is necessary to have precise sidering their meaning or whether we want our definitions of how they are to be interpreted and algorithms to act on the higher level abstractions used. This has been a source of difficulty in the such as, for example, numbers. AES effort so far [1, 2] and has also been the 7. In practice, however, sequences of bits in subject of proposals for improvement in the first processor memory can be used to represent a round comments [3]. huge variety of things: unsigned integers, signed 2. When considered at the lowest level, the integers (one’s or two’s complement), fractions, memory used in computers is made up of binary binary coded decimals, floating point numbers (in bits that are typically grouped into larger entities many different formats), sequences of characters such as 8-bit bytes and 32-bit words, entities that (using different character sets) and any of an al- will be referred to here as units. Although proc- most infinite variety of user defined abstractions. essors can be designed to interpret these units in 8. Numbers are hence just one subset of an ef- many different ways, it is common practice to fectively infinite set of possible abstractions that treat them as numbers in which the different bits can be imposed on these bits. And if algorithms represent powers of 2. act on these higher level abstractions rather than 3. When integers are being represented it is on the underlying bits, it is then necessary to common to number the bits within each unit from specify, for each such abstraction, how the bits 0 upwards, with bit number ‘n’ being used to rep- are being used to represent it. This would be an resent 2n. In such ‘integer’ representations, the impossible task and this clearly suggests that this numeric value (significance) associated with bits approach would not be a sensible one to adopt. increases with bit number from the ‘bottom’ or 9. In consequence it seems most sensible to im- ‘rightmost’ end of a unit. But it is equally valid, pose the minimum possible semantics on algo- though less common, to view units as represent- -(n+1) rithm inputs and outputs. By doing this we allow ing fractions in which bit ‘n’ represents 2 so users and designers to each attach their own that bits decrease in numeric significance with meanings to these interface objects without hav- increasing bit number. In such ‘fractional’ repre- ing to share these with each other. Hence while sentations bits are numbered starting at the ‘top’ a user might see the interface objects as num- or ‘leftmost’ end of a unit. bers or character strings, an algorithm designer 4. This issue also arises when bytes or words may choose to define them as elements in a finite are combined to represent larger numbers. field. When arrays of bytes (8-bit units) are used to rep- resent integers it is common to use byte ‘n’ to unsigned integer signed integer unsigned fraction represent multiples of 256n so that higher num- bered bytes are given higher numeric signifi- input bit block cryptographic cance. Again, however, such byte arrays can be algorithm considered as fractional values where byte ‘n’ interface -(n+1) represents multiples of 256 , with higher num- Cryptographic bered bytes gaining lower numeric significance. Algorithm key bit block These two styles of number representation have ock become known as ‘big-endian’ and ‘little-endian’ and processors are often designed to directly output bit block process numbers in only one of these two forms. 10. For these reasons it has become common 5. It is important to recognise that this issue only practice to specify algorithm input, output and key arises when we consider groups of bits in mem- blocks as groups of bits with no specified seman- ory as higher level entities, for example, repre- tics as illustrated in the diagram above. This is sentations of numbers. When these bits are sim- reasonable for hardware but most processors are ply viewed as arrays of bits without semantic sig- designed to use groups of bits rather than indi- nificance we do not have to worry about these vidual bits as their basic processing entities. matters. In practice, however most algorithms Hence for software a bit level view is not the most impose some form of order on bits and this convenient. Fortunately, however, almost all Dr B. R. Gladman, version 2.2, 6th June 1999 page 1 The NIST Advanced Encryption Standard (AES) Input and Output Block Conventions processors offer ways of handling 8-bit units – the underlying bits and the most simple and intui- bytes – and these are not much higher in abstract tive choice here is to group adjacently numbered terms than the bit level definitions that have been bits into each unit and to define unit numbers employed in the past. (and bit numbers in units) using: 11. Hence by using bytes as convenient groups AesUnitNumber = AesBitNumber /UnitSize of 8-bits, and by using their order in memory, we can obtain a fairly universal, low level interface to AesBitNumberInUnit = AesBitNumber modUnitSize cryptographic algorithms without imposing a par- ticular semantic meaning either on external users where x is defined as “the largest integer not or on algorithm designers. greater than x”. The AES Algorithm Interface 17. In practice the grouping of AES bits into 8-bit units – bytes – is an important ‘canonical refer- 12. The NIST specified AES algorithm interface is ence’ since almost all processors offer both bytes considered both within the source code of the and byte level addressing within memory. Hence NIST tool-kit and in the specification of test vec- a useful representation of AES blocks is as bytes tors. Within the source code the input, output and numbered from 0..15, 0..23 or 0..31 as appropri- key blocks are specified as character arrays in a ate with numbering according to the conventions way that makes it clear that characters are simply described earlier. This is fully consistent with the convenient groups of 8 bits without semantic con- approach adopted in the NIST programming inter- tent. This is fully consistent with the earlier con- face. siderations. 18. With these bit and byte numbering conven- 13. In the discussion of the test vectors, however, tions at the interface it should be relatively easy the concepts of ‘significance’ and ‘leftmost’ are for AES algorithm specifications and implementa- used in a way that has encouraged designers and tions to accurately describe mappings between implementers to treat these as numbers rather AES bits, bytes (and larger units if appropriate) than blocks of bits. As a result some designers and those used within algorithms. have implemented their algorithms with code to put these numeric values into big or little endian AES Test Vector Conventions form whereas others have considered them as 19. As discussed earlier, ambiguities in respect of arrays of bytes that do not require such changes byte order during the first AES round derive from of order. The result has been some confusion uncertainties about whether the KAT test vectors and lack of interoperability between implementa- are specified in terms of memory address order tions when running on different processors [1,2]. or by their numeric significance. In fact NIST has 14. In principle the internal semantics of algo- clearly used the latter, which was fairly certain to rithms are as rich as the external semantics dis- cause uncertainty because it is different in princi- cussed earlier. While algorithm designers must ple to the ‘byte address order’ used in the pro- be free to decide how they want to interpret and gramming interface. manipulate the bits in input, output and key 20. The author believes that using ‘byte address blocks, it is nevertheless important to have a ordering’ for the API and ‘numeric significance standard notation for referencing these bits so ordering’ for the test vectors is not advisable. This that different implementations can each ensure subtle but important difference of approach has that they are operating on these bits in an identi- caused uncertainty about the true NIST intentions cal way. and hence a lack of interoperability in different Achieving a Low Level AES Interface implementations. Fortunately this is easy to avoid by using a consistent byte address order for 15. For purposes of reference it seems reason- both the API and the test vectors by defining test able to take the traditional approach and hence to vector ‘n’ in a set of vectors to be one in which all define all AES input, output and key blocks as bits are 0 except for bit number n, which is 1. sequences of bits in which the bits are numbered This will be considered further later. from 0..127, 0..191 or 0..255 as appropriate. At this primitive level bits have no defined signifi- 21. Issues of the order in which entities are cance, grouping or semantics. printed in human readable input and output are also important. This applies, for example, to test 16.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us