Network Working Group J. Strombergson Request for Comments: 4194 InformAsic AB Category: Standards Track L. Walleij Lunds Tekniska Hogskola P. Faltstrom Cisco Systems Inc October 2005 The S Hexdump Format Status of this Memo This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited. Copyright Notice Copyright (C) The Internet Society (2005).
AbstractThis document specifies the S Hexdump Format (SHF), a new, XML-based open format for describing binary data in hexadecimal notation. SHF provides the ability to describe both small and large, simple and complex hexadecimal data dumps in an open, modern, transport- and vendor-neutral format.
Word sizes, and data sizes spanning anywhere from a few Bytes of data to much larger than 2^32 bits are not handled. Also, the checksums included in these formats are too simplistic and for larger data sizes, they provide insufficient ability to accurately detect errors. Alternatively, the overhead needed for proper error detection is very large. Therefore, the S Hexdump format is an effort to provide a modern, XML-based format that is not too complex for simple tools and computing environments to implement, generate, parse, and use. Yet the format is able to handle large data sizes and complex data structures, and can provide high quality error detection by leveraging standardized cryptographic hash functions. One of the simplifications introduced in the format is to disallow other number systems such as octal or decimal notation, and to allow for Word sizes of even bytes (8-bit groups) only. This is intentional and was done to simplify implementations aimed for practical present-day applications. Formats aimed for esoteric number systems or odd Word sizes may be implemented elsewhere. At present, the usage of the SHF format may be mainly for Internet transport and file storage on development machinery. A parser for the XML format is presently not easily deployed in hardware devices, but the parsing and checksumming of the SHF data may be done by a workstation computer, which in turn converts the SHF tokens to an ordinary bitstream before the last step (e.g., of a firmware upgrade) commences. SHF is a dump format only and shall not be confused with similar applications, such as binary configuration formats or patches, which are intended to, for example, alter contents of a core memory. Such applications require the possibility of modifying individual bits or groups of bits in the memory of a machine, and is not the intended usage of the mechanism described in the present document. RFC 2119 . The key word "Byte" is to be interpreted as a group of 8 bits. The key word "Octet" is another name for Byte. The key word "Word" is to be interpreted as a group containing an integral number of Bytes.
The key word "Block" is to be interpreted as an ordered sequence of Words, beginning at a certain address, running from lower to higher addresses. A Block typically represents a sequence of Words at a certain address range in the memory of a computer. The key word "Dump" is to be interpreted as a sequence of Blocks, which may or may not be in a particular order. A Dump typically represents some non-continuous, interesting parts of the memory of a computer, such that the Dump as a whole has a certain meaning, for example (but not limited to) a complete firmware for an embedded system. The expression "2^n" is to be interpreted as the value two (2) raised to the n:th power. For example, 2^8 equals the value 256. RFC3174 specified (see ) SHA-1 cryptographic signature o An XML-based format In the embedded systems domain, 8- and 16-bit processors are still used in large numbers and will continue to be used for any foreseeable future. Simultaneously, more and more systems are using 64-bit and even larger Word sizes. SHF supports all of these systems by allowing the Word size to be specified. The Word size MUST be an integer number of Bytes and at least one (1) Byte. SHF is able to represent both large and small data Blocks. The data Block MUST contain at least one (1) Word. Additionally, the data Block MUST NOT be larger than (2^64)-1 bits. The SHF Dump MUST contain at least one (1) data Block. The maximum number of Blocks supported is 2^64. Each data Block in the Dump MAY have different Word sizes and start at different addresses.
The checksum (or message digest) used to verify the correctness or data integrity of each Block is 20 Bytes (160 bits) long. The digest MUST be calculated on the data actually represented by the SHF data Block, NOT the representation, i.e., NOT the ASCII-code. SHA-1 is only able to calculate a digest for a data Block no larger than (2^64)-1 bits and this limits the size of each data Block in SHF to (2^64)-1 bits.
figure is in hex notation or not, and can always assume it is hexadecimal. o All attribute values, with the exception of the checksum, MAY omit leading zeros. Conversely, the checksum MUST NOT omit leading zeros. o The data represented in a Block MUST NOT be larger than (2^64)-1 bits.
o The size of a Word MUST NOT be larger than (2^64)-1 bits. This implies that a Block with a Word defined to the maximum width cannot contain more than one Word. An SHF consumer shall assure that it can handle a certain Word length before beginning to parse blocks of an SHF Dump. Failure to do so may cause buffer overflows and endanger the stability and security of the system running the consuming application. o The attribute values representing an actual value MUST be in big-endian format. This means that the most significant hexadecimal digits are to be put to the left in a hexadecimal Word, address, or similar field. For example, the address value 1234 represents the address 1234 and not 3412. While some computing architectures may be using little-endian Words as their native format, it is the responsibility of any SHF producer running on such an architecture to swap the attribute values to a big-endian format. The reverse holds for a consumer receiving the big-endian SHF attributes: if the consumer is little-endian, the values have to be swapped around. o Likewise, the words inside a Dump MUST be stored in a big-endian format if the word size is larger than one Byte. Here, the same need for swapping Bytes around may arise, as mentioned in the previous paragraph.
<!-- DTD for the S Hexdump Format, as of 2003-10-10 Linus Walleij, Joachim Strombergson, Patrik Faltstrom 2003 Refer to this DTD as: <!ENTITY % SHF PUBLIC "-//IETF//DTD SHF//EN" "http://ietf.org/dtd/shf.dtd"> %SHF; --> <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT dump (block)+> <!ATTLIST dump name CDATA #REQUIRED blocks CDATA #IMPLIED> <!ELEMENT block (#PCDATA)> <!ATTLIST block name CDATA #REQUIRED address CDATA #REQUIRED word_size CDATA #REQUIRED length CDATA #REQUIRED checksum CDATA #REQUIRED>
The second example is a program in 6502 machine code residing at memory address 0x1000, which calculates the 13 first Fibonacci numbers and stores them at 0x1101-0x110d: <?xml version="1.0" encoding="UTF-8"?> <dump name="6502 Fibonacci" blocks="02"> <block name="Code" address="1000" word_size="01" length="2a" checksum="5cab5bf8ee299af1ad17e8093d941914eb5930c7"> a9 01 85 20 85 21 20 1e 10 20 1e 10 18 a5 21 aa 65 20 86 20 85 21 20 1e 10 c9 c8 90 ef 60 ae 00 11 a5 21 9d 00 11 ee 00 11 60 </block> <block name="Mem" address="1100" word_size="01" length="e" checksum="c8c2001c42b0226a5d9f7c2f24bd47393166487a"> 01 00 00 00 00 00 00 00 00 00 00 00 00 00 </block> </dump> The final example contains a Block of 40-bit wide data: <?xml version="1.0" encoding="UTF-8"?> <dump name="Example of an SHF dump with wide data words" blocks="00001"> <block name="SMIL memory dump" address="000" word_size="5" length="1A" checksum="ff2033489aff0e4e4f0cd7901afc985f7a213c97"> 00100 00200 00000 00090 00000 00036 00300 00400 00852 00250 00230 00858 00500 00600 014DC 00058 002A8 000B8 00700 00800 000B0 00192 00100 00000 00900 00A00 00000 0000A 40000 00000 00B00 00C00 00000 00000 00000 00001 00D00 00E00 00000 00100 0CCCC CCCCD 00F00 01000 00000 00010 80000 00000 00100 00790 00000 00234 </block> </dump> RFC 3275 .
4]. o Registration: application/shf+xml o MIME media type name: application o MIME subtype name: shf+xml o Required parameters: charset Required parameters: charset This parameter must exist and must be set to "UTF-8". No other character sets are allowed for transporting SHF data. The character set designator MUST be uppercase. Encoding considerations: This media type may contain binary content; accordingly, when used over a transport that does not permit binary transfer, an appropriate encoding must be applied. Security considerations: A hex Dump in itself has no other security considerations than what applies for any other XML file. However, the included binary data may in decoded form contain any executable code for a target platform. If additional security is desired, additional transport security solutions may be applied. For target code contained in a hex Dump, developers may want to include certificates, checksums, and the like in hexdump form for the target platform. Such uses are outside the scope of this document and a matter of implementation. Interoperability considerations: n/a Published specification: This media type is a proper subset of the XML 1.0 specification . One restriction is made: no entity references other than the five predefined general entities references ("&", "<", ">", "'", and """) and numeric entity references may be present. Neither the "XML" declaration (e.g., <?xml version="1.0" ?>) nor the "DOCTYPE" declaration (e.g., <!DOCTYPE ...>) need be present. (XML fragments are allowed.) All other XML 1.0 instructions (e.g., CDATA blocks, processing instructions, and so on) are allowed.
Applications that use this media type: any program or individual wishing to make use of this XML 1.0 subset for hexdump exchange. Additional information: o Magic number: There is no single initial Byte sequence that is always present for SHF files o File extension: shf o Macintosh File Type code: none Intended usage: COMMON. Author/Change controller: this MIME transport type is controlled by the IETF.
 Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.  Eastlake, 3rd, D. and P. Jones, "US Secure Hash Algorithm 1 (SHA1)", BCP 14, RFC 3174, September 2001.  Eastlake, 3rd, D., Joseph, J., and D. David, "(Extensible Markup Language) XML-Signature Syntax and Processing", BCP 14, RFC 3275, March 2002.  Makoto, M., Simon, S., and D. Dan, "(Extensible Markup Language) XML Media Types", RFC 3023, January 2001.  Bray, Tim, Paoli, Jean, Sperberg-McQueen, C. M. and Maler, Eve, Yergeau, Francois, "Extensible Markup Language (XML) 1.0 (Third Edition)", http://www.w3.org/TR/REC-xml.
http://www.InformAsic.com/ Linus Walleij Lunds Tekniska Hogskola Master Olofs Vag 24 Lund 224 66 SE Phone: +46 703 193678 EMail: firstname.lastname@example.org Patrik Faltstrom Cisco Systems Inc Ledasa 273 71 Lovestad Sweden EMail: email@example.com URI: http://www.cisco.com
Full Copyright Statement Copyright (C) The Internet Society (2005). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Intellectual Property The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf- firstname.lastname@example.org. Acknowledgement Funding for the RFC Editor function is currently provided by the Internet Society.