aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/asn1/doc/src/Makefile4
-rw-r--r--lib/asn1/doc/src/note.gifbin1539 -> 0 bytes
-rw-r--r--lib/asn1/doc/src/notes_history.xml1782
-rw-r--r--lib/asn1/doc/src/part_notes.xml39
-rw-r--r--lib/asn1/doc/src/warning.gifbin1498 -> 0 bytes
-rw-r--r--lib/crypto/test/Makefile81
-rw-r--r--lib/crypto/test/crypto.spec2
-rw-r--r--lib/crypto/test/crypto_SUITE.erl1110
-rw-r--r--lib/debugger/doc/src/Makefile2
-rw-r--r--lib/debugger/doc/src/part_notes.xml40
-rw-r--r--lib/debugger/doc/src/warning.gifbin1498 -> 0 bytes
-rw-r--r--lib/percept/src/egd.erl8
-rw-r--r--lib/percept/src/egd_font.erl7
-rw-r--r--[-rwxr-xr-x]lib/percept/src/egd_png.erl0
-rw-r--r--lib/percept/src/egd_primitives.erl138
-rw-r--r--lib/percept/src/egd_render.erl166
-rw-r--r--lib/percept/test/egd_SUITE.erl43
-rw-r--r--lib/stdlib/doc/src/gen_fsm.xml30
-rw-r--r--lib/stdlib/doc/src/gen_server.xml29
-rw-r--r--lib/stdlib/doc/src/sys.xml39
-rw-r--r--lib/stdlib/src/gen_fsm.erl7
-rw-r--r--lib/stdlib/src/sys.erl11
-rw-r--r--lib/stdlib/test/gen_fsm_SUITE.erl16
-rw-r--r--lib/stdlib/test/gen_server_SUITE.erl29
24 files changed, 1445 insertions, 2138 deletions
diff --git a/lib/asn1/doc/src/Makefile b/lib/asn1/doc/src/Makefile
index be8755f0ff..d29225f6c9 100644
--- a/lib/asn1/doc/src/Makefile
+++ b/lib/asn1/doc/src/Makefile
@@ -51,9 +51,7 @@ XML_REF3_FILES = asn1ct.xml \
GEN_XML = \
asn1_spec.xml
-XML_PART_FILES = \
- part.xml \
- part_notes.xml
+XML_PART_FILES = part.xml
XML_HTML_FILE = \
notes_history.xml
diff --git a/lib/asn1/doc/src/note.gif b/lib/asn1/doc/src/note.gif
deleted file mode 100644
index 6fffe30419..0000000000
--- a/lib/asn1/doc/src/note.gif
+++ /dev/null
Binary files differ
diff --git a/lib/asn1/doc/src/notes_history.xml b/lib/asn1/doc/src/notes_history.xml
deleted file mode 100644
index e6c423e79e..0000000000
--- a/lib/asn1/doc/src/notes_history.xml
+++ /dev/null
@@ -1,1782 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>2006</year><year>2009</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- The contents of this file are subject to the Erlang Public License,
- Version 1.1, (the "License"); you may not use this file except in
- compliance with the License. You should have received a copy of the
- Erlang Public License along with this software. If not, it can be
- retrieved online at http://www.erlang.org/.
-
- Software distributed under the License is distributed on an "AS IS"
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- the License for the specific language governing rights and limitations
- under the License.
-
- </legalnotice>
-
- <title>ASN1 Release Notes</title>
- <prepared>Bertil Karlsson</prepared>
- <responsible></responsible>
- <docno></docno>
- <approved></approved>
- <checked></checked>
- <date>06-04-24</date>
- <rev></rev>
- <file>notes_history.sgml</file>
- </header>
- <p>This document describes the changes made to the asn1 system
- from version to version. The intention of this document is to
- list all incompatibilities as well as all enhancements and
- bug-fixes for every release of the asn1 application. Each release of asn1
- thus constitutes one section in this document. The title of each
- section is the version number of asn1.</p>
-
-
- <section>
- <title>Asn1 1.4.4.14</title>
-
- <section>
- <title>Improvements and New Features</title>
- <list type="bulleted">
- <item>
- <p>Data in info/0 in generated code is moved to attribute
- asn1_info, thus vsn value remains the same if compiler
- options for asn1-spec differs but the generated code is
- the same.</p>
- <p>Own Id: OTP-6462</p>
- </item>
- <item>
- <p>Dialyzer warnings on asn1 are removed, i.e. dead code
- removed.</p>
- <p>Own Id: OTP-6506</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.13</title>
-
- <section>
- <title>Improvements and New Features</title>
- <list type="bulleted">
- <item>
- <p>Now it is possible to use 'asn1config' and 'inline'
- options together. It is also possible to use 'inline' on
- a single file like:
- <c>asn1ct:compile("MyASN1spec.asn",[inline])</c>.</p>
- <p>Own Id: OTP-6405</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.12</title>
-
- <section>
- <title>Improvements and New Features</title>
- <list type="bulleted">
- <item>
- <p>As a complement to the option "{inline,OutputFile}" it is
- now possible to use the option "inline". Then asn1 creates
- an output file with the name of the source .set file.</p>
- <p>Own Id: OTP-6314</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.11</title>
-
- <section>
- <title>Fixed Bugs and Malfunctions</title>
- <list type="bulleted">
- <item>
- <p>When compiling an asn1 source that reference a type in
- another source the compiler uses the asn1db file of the
- other source to resolve the reference. It also tests
- whether the other source has been updated since the
- asn1db file was generated. This last test was to brutal
- in that it exits compilation when no source was found,
- even though a asn1db file existed. Changed behavior from
- a brutal exit to a warning.</p>
- <p>Own Id: OTP-6143</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.10</title>
-
- <section>
- <title>Fixed Bugs and Malfunctions</title>
- <list type="bulleted">
- <item>
- <p>asn1 encoding failed on BIT STRING with constraint
- <c>(SIZE (32..MAX))</c>.</p>
- <p>Own Id: OTP-5932</p>
- </item>
- <item>
- <p>Race condition removed in server for variable names for
- generated code.</p>
- <p>Own Id: OTP-6111</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.9</title>
-
- <section>
- <title>Fixed Bugs and Malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Now exists a default function clause for table lookup of
- a table constraint. This causes a nice error instead of a
- crash. Did also remove some obsolete funs ({Mod,Fun}) in
- generated code.</p>
- <p>Own Id: OTP-5783</p>
- </item>
- <item>
- <p>ASN1-compiler failed to derive a value out of an external
- reference in some certain cases, when compiling specs so
- that the spec with the reference was compiled before the
- spec with the defined value.</p>
- <p>Own Id: OTP-5812 Aux Id: seq10133 </p>
- </item>
- <item>
- <p>The documentation of how records of embedded types are
- named is extended and made clearer by examples and rules.
- The section "Naming of Records in .hrl Files" in the
- User's Guide is added.</p>
- <p>Own Id: OTP-5831 Aux Id: seq10133 </p>
- </item>
- <item>
- <p>The compiler failed to give right name to record/function
- of a parameterized type that was referenced through
- another instance of a parameterized type in another
- module. The fault occurred when modules were compiled in a
- certain order. Now the compiler resolves the name
- correctly.</p>
- <p>Own Id: OTP-5832 Aux Id: seq10133 </p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.8</title>
-
- <section>
- <title>Fixed Bugs and Malfunctions</title>
- <list type="bulleted">
- <item>
- <p>The dynamic sort of SET OF values now correctly handles
- values encoded in the "ber_bin, der, optimize" mode, the
- value of a SET OF is a list of binaries.</p>
- <p>Own Id: OTP-5687</p>
- </item>
- <item>
- <p>Bad code was generated for an INTEGER with value-range. If
- the value that was encoded had a lower bound with
- negative value it caused a crash. This bug is now
- removed.</p>
- <p>Own Id: OTP-5688 Aux Id: seq10049 </p>
- </item>
- <item>
- <p>Compiler now handles wrong include paths by returning an
- error if a referenced module is not available.</p>
- <p>Own Id: OTP-5689</p>
- </item>
- <item>
- <p>The bug causing a runtime error when encoding a type
- defined by: <c>BIT STRING {a(1),b(2)}</c> with the value
- [] in <c>per_bin</c> mode is now removed.</p>
- <p>Own Id: OTP-5710 Aux Id: seq10066 </p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and New Features</title>
- <list type="bulleted">
- <item>
- <p>Better handling of filename paths</p>
- <p>Own Id: OTP-5701</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.7</title>
-
- <section>
- <title>Fixed Bugs and Malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Effective constraint for <c>per</c> now corrected. For
- instance <c>INTEGER (0|15..269)</c> didn't work properly.</p>
- <p>Own Id: OTP-5477 Aux Id: OTP-5511 </p>
- </item>
- <item>
- <p>Adjusted compiler so that functions in generated code
- only are exported once.</p>
- <p>Own Id: OTP-5509</p>
- </item>
- <item>
- <p>Fixed the compiler failure when handling a value range
- constraint with an extension mark that had the Lower
- bound and/or Upper bound values as an external reference
- to a defined value.</p>
- <p>Own Id: OTP-5511 Aux Id: OTP-5466 </p>
- </item>
- <item>
- <p>Removed sorting of elements for SEQUENCE OF. It shall
- only be done in SET OF.</p>
- <p>Own Id: OTP-5602</p>
- </item>
- <item>
- <p>Corrected code that generated code causing badarith
- warning.</p>
- <p>Own Id: OTP-5616</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.6</title>
-
- <section>
- <title>Known Bugs and Problems</title>
- <list type="bulleted">
- <item>
- <p>Compiler now correctly crashes when compiling bad values.
- Failed for instance on INTEGER value that was a reference
- to a defined value. Also solved problem with a union
- constraint on an INTEGER.</p>
- <p>Own Id: OTP-5457</p>
- </item>
- <item>
- <p>Additional coverage of object set syntax.</p>
- <p>Own Id: OTP-5466</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.5</title>
-
- <section>
- <title>Fixed Bugs and Malfunctions</title>
- <list type="bulleted">
- <item>
- <p>A bug due to representation of open_type values is now
- fixed. It could cause problem if one used the EXTERNAL
- type.</p>
- <p>Own Id: OTP-5302</p>
- </item>
- <item>
- <p>Due to an internal error the same code could have been
- generated more than one time. This happened for the
- exclusive decode functionality.</p>
- <p>Own Id: OTP-5378</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.4</title>
-
- <section>
- <title>Fixed Bugs and Malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Empty objects caused problems. There was trouble when an
- object set referenced imported objects that in turn
- referenced imported types. Lacked support of
- SelectionType in object. All these have been attended.</p>
- <p>Own Id: OTP-5240</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and New Features</title>
- <list type="bulleted">
- <item>
- <p>Now it is possible to inline asn1 run-time functionality
- in the module generated by the asn1 compiler. Thus, it
- will be only one module doing all encoding/decoding.</p>
- <p>Own Id: OTP-5243</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.3</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>A class that was referenced in two steps caused a
- compiler failure. It is now corrected.</p>
- <p>Own Id: OTP-5103</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>Optionally make it possible to get the un-decoded rest along with
- the return value. Compile with option <em>undec_rest</em>.</p>
- <p>Own Id: OTP-5104</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.2</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>An error due to unchecked referenced imported type resulted
- in missing tag in some table constraint cases. This error is
- now corrected. Error occurred during decode in
- <c>ber_bin optimized</c> version.</p>
- <p>Own Id: OTP-5022</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4.1</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>When a referenced value in another module in turn referenced a
- defined value the compilation crashed. This is due to the new
- routines for compilation, that external references are resolved
- during compilation, and not by the order in which modules are
- compiled. This error is now corrected.</p>
- <p>Own Id: OTP-4970</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.4</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Functionality for parameterized class is added. Parsing failures on
- WithSyntax spec is corrected.</p>
- <p>Own Id: OTP-4893</p>
- </item>
- <item>
- <p>The failure due to Parameterized Type when parameter is an object
- set is corrected.</p>
- <p>Own Id: OTP-4894</p>
- <p>Aux Id: OTP-4893</p>
- </item>
- <item>
- <p>Object Identifier values with two components and the first was a
- value reference failed due to parsing conflicts. Now it is
- corrected.</p>
- <p>Own Id: OTP-4895</p>
- </item>
- <item>
- <p>The erroneous comparison of file name and asn1 module name could
- cause compilation failure. The situation for this failure is rare,
- it requires that other processes modifies the compiled file during
- the compilation procedure. It is now fixed.</p>
- <p>Own Id: OTP-4944</p>
- <p>Aux Id: seq8429</p>
- </item>
- <item>
- <p>Selective decode was ignored when exclusive decode spec in asn1
- configfile was missing. Selective decode failed when the selected
- type was the top type. These bugs are now removed.</p>
- <p>Own Id: OTP-4953</p>
- <p>Aux Id: seq8436</p>
- </item>
- <item>
- <p>The test interface asn1ct:test/1,2,3 and asn1ct:value/2 failed for
- open type and EXTERNAL. The bug is now removed.</p>
- <p>Own Id: OTP-4955</p>
- <p>Aux Id: seq8438)</p>
- </item>
- <item>
- <p>Two equal functions were generated for two components referencing
- the same type when they were picked by the action "parts". The bug
- is now fixed.</p>
- <p>Own Id: OTP-4957</p>
- <p>Aux Id: seq8434</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>INTEGER with named number list and ENUMERATED can now be sub
- constrained with names from the names list.</p>
- <p>Own Id: OTP-4917</p>
- </item>
- <item>
- <p>Now there is support for SelectionType (X 680 section 29)</p>
- <p>Own Id: OTP-4918</p>
- </item>
- <item>
- <p>The compiler now resolves circular dependencies. When asn1 specs
- IMPORTS from each other so that there are circular dependencies.</p>
- <p>Own Id: OTP-4919</p>
- </item>
- <item>
- <p>Now is the asn1 type UTF8String supported. For user instructions
- see documentation.</p>
- <p>Own Id: OTP-4965</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.3.1</title>
-
- <section>
- <title>Fixed Bugs and Malfunctions</title>
- <list type="bulleted">
- <item>
- <p>The <c>{internal_error,...,{ unrecognized_type,...}}</c>
- error occurring for a SET type when compiling with options
- <c>[ber_bin,optimize,der]</c> is now corrected.</p>
- <p>Own Id: OTP-4866</p>
- </item>
- <item>
- <p>False encode of BIT STRING in PER (per_bin,optimize) is fixed. The error occurred when there was a type like BIT STRING (SIZE(C)) and C &gt; 16.</p>
- <p>Own Id: OTP-4869</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.3</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Functionality to handle parameterized object sets have been added.</p>
- <p>Own Id: OTP-4832</p>
- </item>
- <item>
- <p>Bug causing duplicated function definitions using exclusive decode is removed.</p>
- <p>Own Id: OTP-4833)</p>
- </item>
- <item>
- <p>The race condition when loading asn1 driver is solved.</p>
- <p>Own Id: OTP-4835</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>A specialized decode, <em>selective decode</em> is now available. It decodes a chosen internal sub-type of a constructed type.</p>
- <p>Own Id: OTP-4856)</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.2.2</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Release of Asn1 1.4.2.1 on R7B, The functionality is the same, but
- the layer between the driver and the asn1 erlang code is different.</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.2.1</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>ObjectDescriptor does now work as part of a sequence, set or choice.</p>
- <p>Own Id: OTP-4773</p>
- </item>
- <item>
- <p>When a SEQUENCE that have extension mark was decoded inside a
- SEQUENCE OF it could cause decode error due to a failure in
- restbytes2. It is now corrected.</p>
- <p>Own Id: OTP-4791)</p>
- </item>
- <item>
- <p>Now the bug is fixed that caused the compiler crash on an untagged
- optional open type.</p>
- <p>Own Id: OTP-4792</p>
- </item>
- <item>
- <p>The earlier exit caused by bad in-data is now fixed so it will
- return an {error,Reason} tuple.</p>
- return an {error,Reason} tuple.</p>
- <p>Own Id: OTP-4797</p>
- </item>
- <item>
- <p>Open type encoded with indefinite length is now correct decoded.</p>
- <p>Own Id: OTP-4798</p>
- </item>
- <item>
- <p>Now is absent optional open types handled correctly.</p>
- <p>Own Id: OTP-4799</p>
- </item>
- <item>
- <p>Now is the necessary functions available for sorting in run-time of
- SET and SET OF components.</p>
- <p>Own Id: OTP-4809</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.2</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>When a component in a SEQUENCE is a CHOICE (or reference to a CHOICE)
- and the SEQUENCE's component and one of the alternatives in the CHOICE
- have identical names, an error may occur if one doesn't use the
- 'optimized' versions of the compiler. In the older versions (<c>ber, ber_bin, per, per_bin</c>) one could optionally apply a value of a
- component as <c>{ComponentName,Value}</c>, and the generated code
- chooses the second element of the tuple. However, a value of a CHOICE
- must be applied as a tuple: <c>{AlternativeName,Value}</c>. Thus,
- in the rare case described above and if the value to the SEQUENCE's
- component is not in a tuple notation the
- <c>{AlternativeName,Value}</c> will be peeled off in the SEQUENCE
- and the value fed to the CHOICE will only be the <c>Value</c>
- part of <c>{AlternativeName,Value}</c>, and the encoder crashes.
- The best way to avoid this is to use the optimized version of the
- compiler where the unnecessary tuple notation
- <c>{ComponentName,Value}</c> no longer is allowed. Since it isn't
- possible to solve this bug in the compiler.</p>
- <p>Own Id: OTP-4693</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>Exclusive decode is enabled by a compiler option and a configuration
- file. It makes it possible to leave parts of an ASN.1 encoded message
- un-decoded.</p>
- <p>Own Id: OTP-4744</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.1.1</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>The documentation about how extensibility is handled is now corrected.</p>
- <p>Own Id: OTP-4663</p>
- </item>
- <item>
- <p>Function in object now calls the exported function</p>
- <p>Own Id: OTP-4665</p>
- </item>
- <item>
- <p>Now is tags for ObjectClassFieldType analyzed correctly.</p>
- <p>Own Id: OTP-4666</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4.1</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Now is the Default value for an ENUMERATED returned as the name from
- the NamedList when decoding.</p>
- <p>Own Id: OTP-4633</p>
- </item>
- <item>
- <p>It was an internal failure when permitted alphabet constraint existed
- together with for instance a size constraint. E.g. when a
- referenced type is constrained by a size constraint and the defined
- type in turn is constrained by a permitted alphabet constraint.</p>
- <p>Own Id: OTP-4559</p>
- </item>
- <item>
- <p>Record is generated in hrl file for a CHOICE with extension mark
- that has an internal SEQUENCE/SET definition.</p>
- <p>Own Id: OTP-4560</p>
- </item>
- <item>
- <p>Now is the length of a SEQUENCE/SET OF correctly encoded/decoded (PER).</p>
- <p>Own Id: OTP-4590</p>
- </item>
- <item>
- <p>The problem with unordered decoded terms when a component is a
- ObjectClassFieldType has been solved.</p>
- <p>Own Id: OTP-4591</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>More complex definitions with TableConstraints where the SimpleTable
- and ComponentRelation are on different levels is now fully
- supported.</p>
- <p>Own Id: OTP-4631</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.4</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>Each generated .erl file have now a function info/0 that returns
- information about the used compiler version and options.</p>
- <p>Own Id: OTP-4373</p>
- </item>
- <item>
- <p>When compiling an ASN.1 module the compiler generates an Erlang module
- that is compiled by the Erlang compiler. Earlier it was not possible to
- add options to the final step, the Erlang compilation. By adding any
- option that is not recognized as a specific ASN.1 option it will be
- passed to the final step like: <c>erlc +debug_info Mymodule.asn</c> or
- <c>asn1ct:compile('Mymodule',[debug_info])</c>.</p>
- <p>Own Id: OTP-4491</p>
- </item>
- <item>
- <p>Earlier one couldn't multi file compile modules that had different
- tagdefault, which now is possible. Equal Type/Value names in different
- modules are resolved by renaming (concatenate type name and module
- name): If two types with the same name T exist in module A and module B
- they will get the new names TA and TB.</p>
- <p>(Own Id: OTP-4492)</p>
- <p>Aux Id: OTP-3983</p>
- </item>
- <item>
- <p>BER: Encode/decode of data have been significantly improved. By use of
- the compiler options <c>ber_bin</c> and <c>optimize</c>,
- optimized code will be generated and the optimized run-time module will
- be used.</p>
- <p>Own Id: OTP-4493</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.3.3.1</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Proper length encoding and padding implemented for a <c>BIT STRING</c> with
- NamedNumberList and size constraint as value range. This functionality
- didn't work in the rare occasion when the NamedNumberList is shorter
- than the lower bound of the constraint.As in this example:
- <c>TestS ::= BIT STRING {a (0),b (1)} (SIZE (3..8))</c></p>
- <p>(Own Id: OTP-4353)</p>
- </item>
- <item>
- <p>Bug in compiler, when an <c>OBJECT IDENTIFIER</c> value consisting of
- two identifiers (Defined values or Name form identifiers) was falsely
- interpreted causing a compiling error is now corrected.</p>
- <p>(Own Id: OTP-4354)</p>
- </item>
- <item>
- <p>Internal error in check phase that caused crash on
- <c>ObjectClassFieldType</c> in ber_bin is corrected.</p>
- <p>(Own Id: OTP-4390)</p>
- </item>
- <item>
- <p>Tags for open types are handled according to <c>x.680 30.6c</c>, i.e.
- open types shall not be tagged <c>IMPLICIT.</c></p>
- <p>(Own Id: OTP-4395)</p>
- <p>(Aux Id: OTP-4390)</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.3.3</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Now gives the compiler an appropriate error report when exported
- undefined types are detected.</p>
- <p>(Own Id: OTP-4129)</p>
- </item>
- <item>
- <p>The type <c>ObjectDescriptor</c> is now supported, previously the
- implementation of encode/decode for this rarely used type was
- incomplete.</p>
- <p>(Own Id: OTP-4161)</p>
- <p>(Aux Id: seq7165)</p>
- </item>
- <item>
- <p>In case of per and compact_bit_string the rightmost byte were erroneous
- truncated when the rightmost bits of that byte were zeros. This is now
- corrected.</p>
- <p>(Own Id: OTP-4200)</p>
- </item>
- <item>
- <p>Bad match of return-value from decode_length in skipvalue/3 has now been
- fixed.</p>
- <p>(Own Id: OTP-4232)</p>
- </item>
- <item>
- <p>Now is decode of ENUMERATED handled correctly, when tagged EXPLICIT.</p>
- <p>(Own Id: OTP-4234)</p>
- </item>
- <item>
- <p>The compiler now parses and handles the ValueFromObject construct.</p>
- <p>(Own Id: OTP-4242)</p>
- </item>
- <item>
- <p>Now does the compiler handle the case when the object set in simple
- table and componentrelation constraints is of a CLASS without a UNIQUE
- field. In this case is the octets, which is assumed to be encoded,
- encoded as an open type.</p>
- <p>(Own Id: OTP-4248)</p>
- <p>(Aux Id: OTP-4242)</p>
- </item>
- <item>
- <p>Compiler handles objects in AdditionalElementSetSpec in ObjectSetSpec,
- i.e. the objects that are referred to after the ellipses in an object set.</p>
- <p>(Own Id: OTP-4275)</p>
- </item>
- <item>
- <p>Now are values with a component of type CHOICE encoded with indefinite
- length correctly decoded.</p>
- <p>(Own Id: OTP-4358)</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>The language constructs (from the old 1988 standard) <c>ANY</c>
- and <c>ANY DEFINED BY</c> are now implemented.</p>
- <p>(Own Id: OTP-2741)</p>
- <p>(Aux Id: seq 1188)</p>
- </item>
- <item>
- <p>Now it is checked in run-time if a <c>OBJECT IDENTIFIER</c> value is invalid</p>
- <p>(Own Id: OTP-4235)</p>
- </item>
- <item>
- <p>The ASN.1 types EXTERNAL,EMBEDDED PDV and CHARACTER STRING now have full support in the compiler.</p>
- <p>(Own Id: OTP-4247)</p>
- </item>
- <item>
- <p>A driver in C does the final job (complete) of the PER encoding when
- files are compiled with <c>per_bin</c> and <c>optimize</c> flags.
- It gives significant faster encoding for PER.</p>
- <p>(Own Id: OTP-4355)</p>
- </item>
- <item>
- <p>Encode and decode of PER encoding has been made faster by moving
- analysis done in run-time to compile-time. These optimizations are
- available by compiling ASN.1 files with options <c>per_bin</c> and
- <c>optimize</c>.</p>
- <p>(Own Id: OTP-4381)</p>
- <p>(Aux Id: OTP-4355)</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.3.2</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Now does the compiler check values (including referenced values), and
- formats the value so it is suitable to use as input to encoding
- functions.</p>
- <p>(Own Id: OTP-3277)</p>
- <p>(Aux Id: OTP-4103)</p>
- </item>
- <item>
- <p>Unnecessary external function calls in generated code are now generated
- as internal function calls.</p>
- <p>(Own Id: OTP-4073)</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>Now is Information Objects supported in BER encoding.</p>
- <p>(Own Id: OTP-3980)</p>
- <p>(Aux Id: OTP-3979 OTP-3978)</p>
- <p></p>
- </item>
- <item>
- <p>PER: A new option <c>per_bin</c> is now supported. When used the
- generated encode/decode functions use binaries and the bit syntax to
- get better performance than the old <c>per</c> variant which used
- lists. All values input to encode and returned from decode are
- compatible between <c>per</c> and <c>per_bin</c> except for
- open types which are represented as binaries with per_bin and octet
- lists with per. We recommend that you use per_bin instead of per from
- now on, the use of binaries will be the default in coming versions and
- all improvements and optimizations for PER will be concentrated to that
- solution.</p>
- <p>(Own Id: OTP-4094)</p>
- <p></p>
- </item>
- <item>
- <p>Support for DER implemented. Used by flag +der when compiling. Include
- the full BER encoding plus: sorting of SET components, sorting of
- encoded elements in SET OF, full check of default values in SET and
- SEQUENCE. See new documentation on DER in user_guide sections 1.3.1;
- 1.4.11; 1.4.12; 1.4.14; 1.4.16 and 1.10, in the reference manual for
- asn1ct.</p>
- <p>(Own Id: OTP-4103)</p>
- <p></p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.3.1</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Do not generate record in .hrl file for SET types</p>
- <p>Own Id: OTP-4025</p>
- </item>
- <item>
- <p>Fixed internal error when using BIT STRINGs with Named Number List in combination with <c>compact_bit_string</c> and <c>ber_bin</c> options.</p>
- <p>Own Id: OTP-4026</p>
- <p>Aux Id: OTP-3982</p>
- </item>
- <item>
- <p>The atom 'com' can now be used in ENUMERATED as an EnumerationItem.</p>
- <p>Own Id: OTP-4037</p>
- <p>Aux Id: Seq 7036</p>
- </item>
- <item>
- <p>ber: Now it is possible (again) to encode data format "{Type,Value}" in a SEQUENCE OF RequestParameter, when RequestParameter is of type ENUMERATED. The {Type,Value}
- notation is not recommended for use, it is redundant and exist only for very ancient backwards compatibility reasons. The "feature" might be removed in forthcoming versions.</p>
- <p>Own Id: OTP-4057</p>
- <p>Aux Id: Seq 7066</p>
- </item>
- <item>
- <p>A bug in the parser, that caused failure on COMPONENTS OF is now removed.</p>
- <p>Own Id: OTP-4058</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.3</title>
-
- <section>
- <title>Known problems</title>
- <list type="bulleted">
- <item>
- <p>The compiler will now check that a value referenced by name
- does exist.</p>
- <p>Own Id: OTP-3277</p>
- </item>
- <item>
- <p>BER:Decode of a type T ::= SEQUENCE OF C fails if C is encoded with indefinite length.
- This is know corrected.</p>
- <p>Own Id: OTP-3811</p>
- <p>Aux Id: seq5040</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>The new parser handles imports when one import ends with FROM, a modulename and a reference to a objectidentifier followed by imports from other modules.</p>
- <p>Own Id: OTP-3463</p>
- </item>
- <item>
- <p>The compiler did not check that a name mentioned as EXPORTED
- actually is defined within the module.
- This is now corrected.</p>
- <p>Own Id: OTP-3659</p>
- </item>
- <item>
- <p>Removed bug caused by use of nested indefinite length</p>
- <p>Own Id: OTP-3994</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>Now supporting most common use of parameterization according to X.683</p>
- <p>(Own Id: OTP-3978)</p>
- </item>
- <item>
- <p>PER: Now supporting most common use of Information Objects according to X.681. A new parser has been implemented. The error messages due to syntax errors are slightly different than previous. TableConstraint part of X.682 now also supported.</p>
- <p>Own Id: OTP-3979</p>
- </item>
- <item>
- <p>New compiler option added: <c>ber_bin</c>. The compiler generates code with new bit syntax. Run time functions uses bit syntax when feasible. Higher encoding/decoding performance in most cases. Se also comments for Asn1 1.2.9.3.</p>
- <p>Own Id: OTP-3981</p>
- </item>
- <item>
- <p>A more compact format of BIT STRING in Erlang is now available by use of the compiler option <c>compact_bit_string</c>. It is much faster when large BIT STRINGs are used.</p>
- <p>Own Id: OTP-3982</p>
- </item>
- <item>
- <p>Now possible to merge many ASN.1 input files to one Erlang file by use of a configuration file that lists the ASN.1 files.</p>
- <p>Own Id: OTP-3983</p>
- </item>
- <item>
- <p>New documentation in <em>User's Guide</em> in section:</p>
- <p>3.1: New compile-time functions and options are described.</p>
- <p>4.6: New compact format of BIT STRING is described.</p>
- <p>4.8: Additional comments on character strings.</p>
- <p>7: New section describing ASN.1 Information Objects.</p>
- <p>8: New section describing Parameterization.</p>
- <p><em>Reference Manual/asn1ct</em> New compile options are described.</p>
- <p>Own Id: OTP-3984</p>
- <p>Aux Id: OTP-3978, OTP-3979, OTP-3981, OTP-3982, OTP-3983</p>
- </item>
- <item>
- <p>Added the functionality to invoke ASN1Mod:encode (and decode).</p>
- <p>Own Id: OTP-3985</p>
- </item>
- <item>
- <p>Performance improvements by removing not necessary use of apply when calling asn1rt:encode. Also other general improvements.</p>
- <p>Own Id: OTP-3988</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.2.9.6</title>
-
- <section>
- <title>Known problems</title>
- <list type="bulleted">
- <item>
- <p>The compiler does not check that an exported name actually exists in the ASN.1 module.</p>
- <p>Own Id: OTP-3659</p>
- </item>
- <item>
- <p>The compiler does not check that a value referenced by name does exist.</p>
- <p>Own Id: OTP-3277</p>
- </item>
- <item>
- <p>BER: The compiler does not take the extensions into account when checking if
- the tags are unique in a SEQUENCE or SET.</p>
- <p>Own Id: OTP-3304</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>PER: Trailing zeroes in a BIT STRING declared without named bits
- should not be removed in the encodings.</p>
- <p>Own Id: OTP-3830</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.2.9.5</title>
-
- <section>
- <title>Known problems</title>
- <p>Same as for 1.2.9.3.</p>
- </section>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>PER: Constraints are not propagated when types are
- referring to each other. Example:</p>
- <code type="none">
-
- TBCD-STRING ::= OCTET STRING
-
- LAI ::= TBCD-STRING (SIZE(3)) </code>
- <p>The size constraint is not passed on during encode,decode
- resulting in wrong encoding for PER , it is
- coded with a length determinant which should not be there
- when the length is fixed. For BER this does not matter because the constraints does
- not affect the encodings.</p>
- <p>Own Id: OTP-3713</p>
- </item>
- <item>
- <p>The generated code gets wrong if there are several ENUMERATED fields in a SEQUENCE or SET, this is now corrected.</p>
- <p>Own Id: OTP-3796</p>
- </item>
- <item>
- <p>BER:Decode of a type T ::= SEQUENCE OF C fails if C is encoded with indefinite length.
- This is know corrected.</p>
- <p>Own Id: OTP-3811</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.2.9.3</title>
-
- <section>
- <title>Known problems</title>
- <list type="bulleted">
- <item>
- <p>The compiler does not check that an exported name actually exists in the ASN.1 module.</p>
- <p>Own Id: OTP-3659</p>
- </item>
- <item>
- <p>The compiler does not check that a value referenced by name does exist.</p>
- <p>Own Id: OTP-3277</p>
- </item>
- <item>
- <p>BER: The compiler does not take the extensions into account when checking if
- the tags are unique in a SEQUENCE or SET.</p>
- <p>Own Id: OTP-3304</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>This version supports soft upgrade from versions 1.2.6 1.2.7.</p>
- </item>
- <item>
- <p>In an ENUMERATED type like this:</p>
- <code type="none">
-\011\011T ::= ENUMERATED { blue, green} </code>
- <p>The symbols was encoded/decoded with the wrong values, i.e in
- reverse order. This is now corrected.</p>
- <p>Own Id: OTP-3700</p>
- </item>
- <item>
- <p>PER: OCTET STRING with Size constrained to a single value i.e fixed size
- was treated wrong during encode and decode. This is now corrected.</p>
- <p>Own Id: OTP-3701</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>There is now a new compiler option <c>ber_bin</c> available that can be used to
- generate encode/decode functions for BER that uses the new "bit-syntax" to
- make the functions more efficient. The <c>ber_bin</c> option is used
- as an alternative to the <c>ber</c> and <c>per</c> options.</p>
- <p>The encode function then produces a
- possibly nested list of binaries and integer lists. The decode function does
- in this case require a single binary as input instead of a list.
- The modules generated with this option require that you have an R7A or later
- system, otherwise they will not compile and the runtime module asn1rt_ber_bin
- can not be executed.</p>
- <p>The ber_bin option is not officially supported in this version (will be
- in a later version) but is provided for those who want to try it.
- It should be significantly faster at decode and is slightly faster at encode.
- Exactly how performance differs between this binary approach and the
- list approach depends highly on the type of input.
- Another thing worth noting is that both approaches still have a lot of
- solutions in common which can be improved a lot to gain even better
- performance.</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.2.9.2</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>BER: Encode/decode of extension components did not work properly. This is now corrected.</p>
- <p>Own Id: OTP-3395</p>
- <p>Aux Id: </p>
- <p>PER:The encode/decode of NULL as an open type has been corrected. An open type must always have a length of at least 1 byte even if the contained
- value (e.g NULL) encodes to nothing.</p>
- <p>Own Id: OTP-3496</p>
- <p>Aux Id: </p>
- </item>
- <item>
- <p>BER:In the current implementation extension components of a SEQUENCE are required
- to be present when they are specified as mandatory. This is an error, all extension
- components are "optional" even if they are not specified to have the OPTIONAL or
- DEFAULT property. This is now corrected.</p>
- <p>Own Id: OTP-3278</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>The ASN.1 language feature <c>COMPONENTS OF</c> is now implemented.</p>
- <p>Own Id: OTP-2515</p>
- </item>
- <item>
- <p>The encoding and decoding of ENUMERATED and
- INTEGER with NamedNumbers is made more efficient and thus
- faster in runtime.</p>
- <p>Own Id: OTP-3464</p>
- <p>Aux Id:</p>
- </item>
- <item>
- <p>Added support for encode/decode of open type which is
- constrained to a specific type. Previously the value of
- an open type had to be a list of octets, but now the Erlang
- representation of the specific type used in the constraint
- is used both as input to encode and as output from decode.</p>
- <p>Own Id: OTP-3569</p>
- <p>Aux Id: </p>
- </item>
- <item>
- <p>PER: GeneralString, GraphicalString etc. i.e all strings
- that are not so called "known-multiplier character
- string types" are now supported by the runtime
- encode/decode functions.</p>
- <p>Own Id: OTP-3573</p>
- <p>Aux Id:</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.2.6</title>
-
- <section>
- <title>Known problems</title>
- <list type="bulleted">
- <item>
- <p>The ASN.1 language feature <c>COMPONENTS OF</c> is not implemented.</p>
- <p>Own Id: OTP-2515</p>
- </item>
- <item>
- <p>The compiler does not check that a value referenced by name does exist.</p>
- <p>Own Id: OTP-3277</p>
- </item>
- <item>
- <p>BER:In the current implementation extension components of a SEQUENCE are required
- to be present when they are specified as mandatory. This is an error, all extension
- components are "optional" even if they are not specified to have the OPTIONAL or
- DEFAULT property.</p>
- <p>Own Id: OTP-3278</p>
- </item>
- <item>
- <p>BER: The compiler does not take the extensions into account when checking if
- the tags are unique in a SEQUENCE or SET.</p>
- <p>Own Id: OTP-3304</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>This version supports soft upgrade from versions 1.1.1, 1.1.5 and 1.1.6.
- Two new runtime modules <c>asn1rt_ber_v1</c> and
- <c>asn1rt_per_v1</c> are delivered together with the old ones. This makes
- it possible to continue running applications with modules generated with the
- previous version of the asn1 compiler while modules generated by this version
- will use the new runtime modules. Note that it is only advice-able to continue
- running old generates if they are working perfectly and have no need
- for the corrections made in this version of the asn1 application.</p>
- </item>
- <item>
- <p>BER: SEQUENCEs encoded with indefinite length was not correctly decoded.
- This in now corrected.</p>
- <p>Own Id: OTP-3352</p>
- <p>Aux Id: Seq 4100</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.2.4</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>The compiler now detects multiple definitions of values and types and reports this as
- an error. Previously this was detected when the generated Erlang module was compiled.</p>
- <p>Own Id: OTP-3105</p>
- </item>
- <item>
- <p>BER: An error regarding encoding of <c>ENUMERATED</c> present in asn1-1.1.1
- is corrected. The new version 1.1.2 of asn1 containing this correction is
- delivered as a "patch".</p>
- <p>Own Id: OTP-3169</p>
- </item>
- <item>
- <p>BER: Decoding of <c>SEQUENCE OF</c> and <c>SET OF</c> with indefinite length is corrected.
- The correction was first delivered in version 1.1.2.</p>
- <p>Own Id: OTP-3170</p>
- </item>
- <item>
- <p>BER: Encoding and decoding of <c>ENUMERATED</c>
- with extensionmark
- "..." did not work (crashed with a runtime error). This
- has now been corrected. If an unknown enumerated value is
- decoded (for an extensible enumerated type)
- it is returned as <c>{asn1_enum,Value}</c> where
- <c>Value</c> is an integer. Enumerated values in this format
- are also accepted by the encoder.
- ASN.1 modules containing
- <c>ENUMERATED</c> with extensionmark should be
- recompiled with the corrected
- version of the compiler. The BER runtime functions are also
- corrected.
- Note that this correction has already been delivered as a
- bugfix for R4B (OTP-2951).</p>
- <p>Own Id: OTP-3202</p>
- <p>Aux Id: Seq3745</p>
- </item>
- <item>
- <p>BER: The primitive/constructed bit in the tag byte of an encoding
- is not correct when it comes to user defined tags.
- For example in </p>
- <code type="none">
- T ::= [2] SEQUENCE { a BOOLEAN} </code>
- <p>the tag 2 does not get the constructed bit set which it should.
- This is now corrected.</p>
- <p>Own Id: OTP-3241</p>
- </item>
- <item>
- <p>The decoder can now detect if there are unexpected bytes
- remaining when all components of a sequence are decoded.
- The decoder will then return <c>{error,{asn1{unexpected,Bytes}}}</c></p>
- <p>Own Id: OTP-3270</p>
- </item>
- <item>
- <p>Values of type <c>OBJECT IDENTIFIER</c> was sometimes returned as an Erlang list
- (ASN.1 constants) and sometimes as a tuple (from the decode functions). This is now
- changed so that <c>OBJECT IDENTIFIER</c> values always are represented as an Erlang
- tuple.</p>
- <p>Own Id: OTP-3280</p>
- </item>
- <item>
- <p>PER:The encode/decode functions could not handle integers with
- a range greater than 16#7ffffff. This limit is now removed.</p>
- <p>Own Id: OTP-3287</p>
- </item>
- <item>
- <p>PER: The encoding/decoding of the length for a SET OF/SEQUENCE OF
- was wrong if there was a size constraint. This is now corrected.</p>
- <p>Own Id: OTP-3291</p>
- </item>
- <item>
- <p>PER: Encoding of a constrained INTEGER (range &gt; 16 k) was wrong for
- the value 0. This is now corrected.</p>
- <p>Own Id: OTP-3306</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>The ASN.1 module name and the filename where the ASN.1
- specification resides must match each other (has always been the
- case). This is now checked by the compiler. The check requires that
- the names match in a case or case insensitive way depending on the
- characteristics for the current system.</p>
- <p>Own Id: OTP-1843</p>
- </item>
- <item>
- <p>PER: Encode/decode of an extension value (i.e not within the root set) for
- <c>ENUMERATED</c> did not work properly. This is now corrected.
- If an unknown enumerated value is
- decoded (for an extensible enumerated type)
- it is returned as <c>{asn1_enum,Value}</c> where
- <c>Value</c> is an integer. Enumerated values in this format
- are also accepted by the encoder (if the value is &gt;= the number of known
- extension values).</p>
- <p>Own Id: OTP-2930</p>
- </item>
- <item>
- <p>Unnecessary printouts from the compiler are removed.
- The compiler version and the compiler options are now
- printed to stdout.</p>
- <p>Own Id: OTP-3276</p>
- </item>
- <item>
- <p>In order to better suite the use of ASN.1 in embedded systems only
- the modules needed in runtime are now listed in the <c>.app</c> file.</p>
- <p>Own Id: OTP-3279</p>
- </item>
- <item>
- <p>The compiler now supports extensionmarker in constraint specifications.
- Example:</p>
- <code type="none">
-INTEGER (0..10, ...) </code>
- <p>In previous version this was reported as a syntax error.</p>
- <p>Own Id: OTP-3281</p>
- </item>
- <item>
- <p>A very limited part of ITU-T recommendation X.681
- Abstract Syntax Notation One (ASN.1): Information
- object specification is now implemented. Specifically \011
- TYPE IDENTIFIER is recognized by the compiler.</p>
- <p>Own Id: OTP-3325</p>
- </item>
- <item>
- <p>Parameterization of ASN.1 specifications (ITU-T X.683) is now
- supported to a limited extent.</p>
- <p>Own Id: OTP-3326</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.1.3.1</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>BER Encoding and decoding of <c>ENUMERATED</c>
- with extensionmark
- "..." did not work (crashed with a runtime error). This
- has now been corrected. If an unknown enumerated value is
- decoded (for an extensible enumerated type)
- it is returned as <c>{asn1_enum,Value}</c> where
- <c>Value</c> is an integer. Enumerated values in this format
- are also accepted by the encoder.
- ASN.1 modules containing
- <c>ENUMERATED</c> with extensionmark should be
- recompiled with the corrected
- version of the compiler. The BER runtime functions are also
- corrected.
- Note that this correction has already been delivered as a
- bug-fix for R4B (OTP-2951).</p>
- <p>Own Id: OTP-3202</p>
- <p>Aux Id: Seq3745</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.1.1</title>
-
- <section>
- <title>Known problems</title>
- <list type="bulleted">
- <item>
- <p>The syntactic construct <c>COMPONENTS OF</c> is not
- implemented.</p>
- <p>Own Id: OTP-2515</p>
- </item>
- <item>
- <p><c>ANY</c> and <c>ANY DEFINED BY</c> are currently not
- supported.</p>
- <p>Own Id: OTP-2741</p>
- <p>Aux Id: seq 1188</p>
- </item>
- <item>
- <p>Multiple definitions of the same Type or Value is not detected
- by the compiler. The error occurs when the generated Erlang
- module is compiled.</p>
- <p>Own Id: OTP-3105</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.1</title>
-
- <section>
- <title>Known problems</title>
- <list type="bulleted">
- <item>
- <p>The primitive/constructed bit in the tag byte of an encoding
- is not correct when it comes to user defined tags.
- For example in</p>
- <code type="none">
- T ::= [2] SEQUENCE { a BOOLEAN} </code>
- <p>the tag 2 does not get the constructed bit set which it should.
- This is now corrected.</p>
- <p>Own Id: OTP-3241</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>The BER decoder failed to decode certain nested data types
- where <c>IMPLICIT</c> tags where involved.
- This is now corrected.</p>
- <p>Own Id: OTP-2719</p>
- <p>Aux Id: seq 1148</p>
- </item>
- <item>
- <p>The handling of types with extension marker "..." is corrected.
- Earlier each SEQUENCE and SET with an extension marker got an
- extra field named <c>asn1_EXT</c> in the generated record.
- This was a mistake and that field is now removed (concerns
- both BER and BER).</p>
- <p>Own Id: OTP-2724</p>
- <p>Aux Id: seq 1148, OTP-2719</p>
- </item>
- <item>
- <p>The decoder (both BER and PER) could not handle unnamed
- bits of a <c>BIT STRING</c> if the type had any
- named bits declared. This is now corrected and the unnamed
- bits are returned as <c>{bit,Pos}</c> where Pos is the bit
- position. The <c>{bit,Pos}</c> can be used as input to the
- encoder too.</p>
- <p>Own Id: OTP-2725</p>
- <p>Aux Id: seq 1148,OTP-2719,OTP-2724</p>
- </item>
- <item>
- <p>The functions <c>asn1rt:decode</c> and <c>asn1ct:decode</c>
- did not always return <c>{ok,Result}</c> or
- <c>{error,Reason}</c> as documented. This is now corrected.</p>
- <p>Own Id: OTP-2730</p>
- <p>Aux Id: seq 1158</p>
- </item>
- <item>
- <p>The compiler did not accept CHOICE types as components
- of a SEQUENCE or SET when
- the modules tag default was IMPLICIT.
- Example:</p>
- <code type="none">
-C ::= CHOICE { ......}
-A ::= SEQUENCE {
-a [1] C, -- This was not accepted
-..... </code>
- <p>This was an error
- caused by a misinterpretation of the ASN.1 standard. This
- is now corrected.</p>
- <p>Own Id: OTP-2731</p>
- <p>Aux Id: seq 1163</p>
- </item>
- <item>
- <p>When decoding a SEQUENCE A which contains an OPTIONAL component
- b which is a SEQUENCE with mandatory components, the decoder
- does not detect as an error that a mandatory component of b
- is missing. The same error could occur also in other cases
- with nested types and optional components of SEQUENCE or SET.
- This is now corrected.</p>
- <p>Own Id: OTP-2738</p>
- <p>Aux Id: seq 1183</p>
- </item>
- <item>
- <p>BER Encoding and decoding of <c>ENUMERATED</c>
- with extensionmark
- "..." did not work (crashed with a runtime error). This
- has now been corrected. If an unknown enumerated value is
- decoded (for an extensible enumerated type)
- it is returned as <c>{asn1_enum,Value}</c> where
- <c>Value</c> is an integer. Enumerated values in this format
- are also accepted by the encoder.
- ASN.1 modules containing
- <c>ENUMERATED</c> with extensionmark should be
- recompiled with the corrected
- version of the compiler. The BER runtime functions are also
- corrected.</p>
- <p>Own Id: OTP-2951</p>
- <p>Aux Id: Seq 1446 OTP-2929</p>
- </item>
- <item>
- <p>The compiler does now accept all valid value notations
- for the OBJECT IDENTIFIER type. The generated code for
- those values is also corrected.</p>
- <p>Own Id: OTP-3059</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>The code generated for BER is significantly enhanced resulting
- in less code and around 300% better performance in runtime
- for the encoding of complex ASN.1 values. The performance of
- decoding is unchanged.</p>
- <p>Own Id: OTP-2806</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>Asn1 1.0.3</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>The <c>asn1.app</c> file is corrected.</p>
- <p>Own Id: OTP-2640</p>
- </item>
- <item>
- <p>The encoding of integers in BER did not comply with the
- standard for all values. The values was not encoded
- in the minimum number of octets as required. This is
- now corrected in the runtime module <c>asn1rt_ber</c>.</p>
- <p>Own Id: OTP-2666</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and new features</title>
- <list type="bulleted">
- <item>
- <p>The compiler now generates explicit exports directives for
- all generated
- functions that should be exported (instead of -compile(export_all)).
- This eliminates the warnings from the Erlang compiler when
- compiling the
- generated file.</p>
- <p>Own Id: OTP-1845</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>R3B02 (Asn1 1.0.2)</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>The decoding of a BER encoded SEQUENCE with optional component
- of type SEQUENCE (also with optional components) could result
- in an error or wrong result if the tags are equal.</p>
- <p>Own Id: OTP-2226</p>
- </item>
- <item>
- <p>The encoding of (PER) SEQUENCE with extensionmark was wrong.
- This is now corrected.</p>
- <p>Own Id: OTP-2349</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>R3A (Asn1 0.9)</title>
-
- <section>
- <title>Fixed errors and malfunctions</title>
- <list type="bulleted">
- <item>
- <p>The asn1 compiler now detects the use of an implicit tag before <c>CHOICE</c> as an error (in accordance with the standard)</p>
- <p>Own Id: OTP-1844</p>
- </item>
- <item>
- <p>An OPTIONAL CHOICE embedded in SEQUENCE when BER coding
- caused an error when generating decode code. This is now
- corrected.</p>
- <p>Own Id: OTP-1857</p>
- <p>Aux Id: OTP-1848</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>1 ASN1 0.8.1</title>
- <p>This is the first release of the ASN1 application. This version is
- released for beta-testing. Some functionality will be added until the
- 1.0 version is released. See the release notes for the latest version
- for the exact details about new features. A list of missing features
- and restrictions can be found in the chapter below.</p>
-
- <section>
- <title>1.1 Missing features and other restrictions</title>
- <p></p>
- <list type="bulleted">
- <item>
- <p>The encoding rules BER and PER (aligned) is supported. <em>PER (unaligned) IS NOT SUPPORTED</em>.</p>
- </item>
- <item>
- <p>NOT SUPPORTED types <c>ANY</c> and <c>ANY DEFINED BY</c>
- (is not in the standard any more).</p>
- </item>
- <item>
- <p>NOT SUPPORTED types <c>EXTERNAL</c> and <c>EMBEDDED-PDV</c>. </p>
- </item>
- <item>
- <p>NOT SUPPORTED type <c>REAL</c> (planned to be implemented). </p>
- </item>
- <item>
- <p>The code generation support for value definitions in the ASN.1 notation is very limited
- (planned to be enhanced).</p>
- </item>
- <item>
- <p>The support for constraints is limited to:</p>
- </item>
- </list>
- <list type="bulleted">
- <item>
- <p>SizeConstraint SIZE(X)</p>
- </item>
- <item>
- <p>SingleValue (1)</p>
- </item>
- <item>
- <p>ValueRange (X..Y)</p>
- </item>
- <item>
- <p>PermittedAlpabet FROM (but not for BMPString and UniversalString when generating PER).</p>
- </item>
- <item>
- <p>Complex expressions in constraints is not supported (planned to be extended).</p>
- </item>
- <item>
- <p>The current version of the compiler has very limited error checking:</p>
- </item>
- <item>
- <p>Stops at first syntax error.</p>
- </item>
- <item>
- <p>Does not stop when a reference to an undefined type is found ,
- but prints an error message. Compilation of the generated
- Erlang module will then fail.</p>
- </item>
- <item>
- <p>A whole number of other semantical controls is currently
- missing. This means that the compiler will give little
- or bad help to detect what's wrong with an ASN.1
- specification, but will mostly work very well when the
- ASN.1 specification is correct.</p>
- </item>
- </list>
- <list type="bulleted">
- <item>
- <p>The maximum INTEGER supported in this version is a
- signed 64 bit integer. This limitation is probably quite
- reasonable. (Planned to be extended).</p>
- </item>
- <item>
- <p>Only AUTOMATIC TAGS supported for PER.</p>
- </item>
- <item>
- <p>Only EXPLICIT and IMPLICIT TAGS supported for BER.</p>
- </item>
- <item>
- <p>The compiler supports decoding of BER-data with indefinite
- length but it is not possible to produce data with indefinite
- length with the encoder.</p>
- </item>
- </list>
- </section>
- </section>
-</chapter>
-
diff --git a/lib/asn1/doc/src/part_notes.xml b/lib/asn1/doc/src/part_notes.xml
deleted file mode 100644
index b0a6887aa5..0000000000
--- a/lib/asn1/doc/src/part_notes.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE part SYSTEM "part.dtd">
-
-<part xmlns:xi="http://www.w3.org/2001/XInclude">
- <header>
- <copyright>
- <year>2004</year><year>2009</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- The contents of this file are subject to the Erlang Public License,
- Version 1.1, (the "License"); you may not use this file except in
- compliance with the License. You should have received a copy of the
- Erlang Public License along with this software. If not, it can be
- retrieved online at http://www.erlang.org/.
-
- Software distributed under the License is distributed on an "AS IS"
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- the License for the specific language governing rights and limitations
- under the License.
-
- </legalnotice>
-
- <title>Asn1 Release Notes</title>
- <prepared>Ingela Anderton Andin</prepared>
- <docno></docno>
- <date>>2004-09-07</date>
- <rev></rev>
- <file>part_notes.sgml</file>
- </header>
- <description>
- <p>The <em>Asn1</em> application
- contains modules with compile-time and run-time support for ASN.1.</p>
- <p>There are also release notes for
- <url href="notes_history.html">older versions</url>.</p>
- </description>
- <xi:include href="notes.xml"/>
-</part>
-
diff --git a/lib/asn1/doc/src/warning.gif b/lib/asn1/doc/src/warning.gif
deleted file mode 100644
index 96af52360e..0000000000
--- a/lib/asn1/doc/src/warning.gif
+++ /dev/null
Binary files differ
diff --git a/lib/crypto/test/Makefile b/lib/crypto/test/Makefile
new file mode 100644
index 0000000000..bf5c42877e
--- /dev/null
+++ b/lib/crypto/test/Makefile
@@ -0,0 +1,81 @@
+include $(ERL_TOP)/make/target.mk
+include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+# ----------------------------------------------------
+# Target Specs
+# ----------------------------------------------------
+
+MODULES= crypto_SUITE
+
+ERL_FILES= $(MODULES:%=%.erl)
+
+TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
+
+SOURCE = $(ERL_FILES) $(HRL_FILES)
+
+EMAKEFILE=Emakefile
+
+# ----------------------------------------------------
+# Release directory specification
+# ----------------------------------------------------
+RELSYSDIR = $(RELEASE_PATH)/crypto_test
+
+
+# ----------------------------------------------------
+# FLAGS
+# ----------------------------------------------------
+ERL_MAKE_FLAGS +=
+ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include
+
+EBIN = .
+MAKE_EMAKE = $(wildcard $(ERL_TOP)/make/make_emakefile)
+
+
+# ----------------------------------------------------
+# Targets
+# ----------------------------------------------------
+
+# Backward compatibility, for R9B and earlier.
+
+ifeq ($(MAKE_EMAKE),)
+
+RELTEST_FILES = $(SOURCE) $(TARGET_FILES)
+TEST_TARGET = tests
+
+tests debug opt: $(TARGET_FILES)
+
+else
+
+RELTEST_FILES = $(EMAKEFILE) $(SOURCE)
+TEST_TARGET = make_emakefile
+
+
+tests debug opt: make_emakefile
+ erl $(ERL_MAKE_FLAGS) -make
+
+make_emakefile:
+ $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) \
+ $(MODULES) > $(EMAKEFILE)
+
+endif
+clean:
+ rm -f $(EMAKEFILE)
+ rm -f $(TARGET_FILES) $(GEN_FILES)
+ rm -f core
+
+docs:
+
+# ----------------------------------------------------
+# Release Target
+# ----------------------------------------------------
+include $(ERL_TOP)/make/otp_release_targets.mk
+
+release_spec:
+
+release_tests_spec: $(TEST_TARGET)
+ $(INSTALL_DIR) $(RELSYSDIR)
+ $(INSTALL_DATA) crypto.spec $(RELTEST_FILES) $(RELSYSDIR)
+ chmod -f -R u+w $(RELSYSDIR)
+
+release_docs_spec:
+
diff --git a/lib/crypto/test/crypto.spec b/lib/crypto/test/crypto.spec
new file mode 100644
index 0000000000..7ba5696189
--- /dev/null
+++ b/lib/crypto/test/crypto.spec
@@ -0,0 +1,2 @@
+{topcase, {dir, "../crypto_test"}}.
+
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
new file mode 100644
index 0000000000..290ef19160
--- /dev/null
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -0,0 +1,1110 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(crypto_SUITE).
+
+-include("test_server.hrl").
+-include("test_server_line.hrl").
+
+-export([all/1,
+ init_per_testcase/2,
+ fin_per_testcase/2,
+ info/1,
+ link_test/1,
+ md5/1,
+ md5_update/1,
+ md4/1,
+ md4_update/1,
+ sha/1,
+ sha_update/1,
+ sha256/1,
+ sha256_update/1,
+ sha512/1,
+ sha512_update/1,
+ md5_mac/1,
+ md5_mac_io/1,
+ des_cbc/1,
+ des_cbc_iter/1,
+ aes_cfb/1,
+ aes_cbc/1,
+ aes_cbc_iter/1,
+ mod_exp_test/1,
+ rand_uniform_test/1,
+ rsa_verify_test/1,
+ dsa_verify_test/1,
+ rsa_sign_test/1,
+ dsa_sign_test/1,
+ rsa_encrypt_decrypt/1,
+ dh/1,
+ exor_test/1,
+ rc4_test/1,
+ blowfish_cfb64/1,
+ smp/1,
+ cleanup/1]).
+
+-export([hexstr2bin/1]).
+
+all(suite) ->
+ [link_test,
+ {conf,info,[md5,
+ md5_update,
+ md4,
+ md4_update,
+ md5_mac,
+ md5_mac_io,
+ sha,
+ sha_update,
+%% sha256,
+%% sha256_update,
+%% sha512,
+%% sha512_update,
+ des_cbc,
+ aes_cfb,
+ aes_cbc,
+ aes_cbc_iter,
+ des_cbc_iter,
+ rand_uniform_test,
+ rsa_verify_test,
+ dsa_verify_test,
+ rsa_sign_test,
+ dsa_sign_test,
+ rsa_encrypt_decrypt,
+ dh,
+ exor_test,
+ rc4_test,
+ mod_exp_test,
+ blowfish_cfb64,
+ smp],
+ cleanup}].
+
+init_per_testcase(_Name,Config) ->
+ io:format("init_per_testcase\n"),
+ ?line crypto:start(),
+ Config.
+
+fin_per_testcase(_Name,Config) ->
+ io:format("fin_per_testcase\n"),
+ ?line crypto:stop(),
+ Config.
+
+%%
+%%
+link_test(doc) ->
+ ["Test that the library is statically linked to libcrypto.a."];
+link_test(suite) ->
+ [];
+link_test(Config) when is_list(Config) ->
+ ?line case os:type() of
+ {unix,darwin} -> {skipped,"Darwin cannot link statically"};
+ {unix,_} -> link_test_1();
+ _ -> {skip,"Only runs on Unix"}
+ end.
+
+link_test_1() ->
+ ?line CryptoPriv = code:priv_dir(crypto),
+ ?line Wc = filename:join([CryptoPriv,"lib","crypto_drv.*"]),
+ ?line case filelib:wildcard(Wc) of
+ [] -> {skip,"Didn't find the crypto driver"};
+ [Drv] -> link_test_2(Drv)
+ end.
+
+link_test_2(Drv) ->
+ case ldd_program() of
+ none ->
+ {skip,"No ldd-like program found"};
+ Ldd ->
+ Cmd = Ldd ++ " " ++ Drv,
+ Libs = os:cmd(Cmd),
+ io:format("~p\n", [Libs]),
+ case string:str(Libs, "libcrypto") of
+ 0 -> ok;
+ _ ->
+ case ?t:is_commercial() of
+ true ->
+ ?t:fail({libcrypto,not_statically_linked});
+ false ->
+ {comment,"Not statically linked (OK for open-source platform)"}
+ end
+ end
+ end.
+
+ldd_program() ->
+ case os:find_executable("ldd") of
+ false ->
+ case os:type() of
+ {unix,darwin} ->
+ case os:find_executable("otool") of
+ false -> none;
+ Otool -> Otool ++ " -L"
+ end
+ end;
+ Ldd when is_list(Ldd) -> Ldd
+ end.
+
+%%
+%%
+info(doc) ->
+ ["Call the info function."];
+info(suite) ->
+ [];
+info(Config) when is_list(Config) ->
+ case {code:lib_dir(crypto),?t:is_commercial()} of
+ {{error,bad_name},false} ->
+ {skip,"Missing crypto application"};
+ {_,_} ->
+ ?line crypto:start(),
+ ?line crypto:info(),
+ ?line InfoLib = crypto:info_lib(),
+ ?line [_|_] = InfoLib,
+ F = fun([{Name,VerN,VerS}|T],Me) ->
+ ?line true = is_binary(Name),
+ ?line true = is_integer(VerN),
+ ?line true = is_binary(VerS),
+ Me(T,Me);
+ ([],_) ->
+ ok
+ end,
+ ?line F(InfoLib,F),
+ ?line crypto:stop()
+ end.
+
+cleanup(doc) ->
+ ["Cleanup (dummy)."];
+cleanup(suite) ->
+ [];
+cleanup(Config) when is_list(Config) ->
+ Config.
+
+%%
+%%
+md5(doc) ->
+ ["Generate MD5 message digests and check the result. Examples are "
+ "from RFC-1321."];
+md5(suite) ->
+ [];
+md5(Config) when is_list(Config) ->
+ ?line m(crypto:md5(""),
+ hexstr2bin("d41d8cd98f00b204e9800998ecf8427e")),
+ ?line m(crypto:md5("a"),
+ hexstr2bin("0cc175b9c0f1b6a831c399e269772661")),
+ ?line m(crypto:md5("abc"),
+ hexstr2bin("900150983cd24fb0d6963f7d28e17f72")),
+ ?line m(crypto:md5("message digest"),
+ hexstr2bin("f96b697d7cb7938d525a2f31aaf161d0")),
+ ?line m(crypto:md5("abcdefghijklmnopqrstuvwxyz"),
+ hexstr2bin("c3fcd3d76192e4007dfb496cca67e13b")),
+ ?line m(crypto:md5("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+ "0123456789"),
+ hexstr2bin("d174ab98d277d9f5a5611c2c9f419d9f")),
+ ?line m(crypto:md5("12345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890"),
+ hexstr2bin("57edf4a22be3c955ac49da2e2107b67a")).
+
+%%
+%%
+md5_update(doc) ->
+ ["Generate MD5 message using md5_init, md5_update, and md5_final, and"
+ "check the result. Examples are from RFC-1321."];
+md5_update(suite) ->
+ [];
+md5_update(Config) when is_list(Config) ->
+ ?line Ctx = crypto:md5_init(),
+ ?line Ctx1 = crypto:md5_update(Ctx, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
+ ?line Ctx2 = crypto:md5_update(Ctx1, "abcdefghijklmnopqrstuvwxyz"
+ "0123456789"),
+ ?line m(crypto:md5_final(Ctx2),
+ hexstr2bin("d174ab98d277d9f5a5611c2c9f419d9f")).
+
+%%
+%%
+md4(doc) ->
+ ["Generate MD4 message digests and check the result. Examples are "
+ "from RFC-1321."];
+md4(suite) ->
+ [];
+md4(Config) when is_list(Config) ->
+ ?line m(crypto:md4(""),
+ hexstr2bin("31d6cfe0d16ae931b73c59d7e0c089c0")),
+ ?line m(crypto:md4("a"),
+ hexstr2bin("bde52cb31de33e46245e05fbdbd6fb24")),
+ ?line m(crypto:md4("abc"),
+ hexstr2bin("a448017aaf21d8525fc10ae87aa6729d")),
+ ?line m(crypto:md4("message digest"),
+ hexstr2bin("d9130a8164549fe818874806e1c7014b")),
+ ?line m(crypto:md4("abcdefghijklmnopqrstuvwxyz"),
+ hexstr2bin("d79e1c308aa5bbcdeea8ed63df412da9")),
+ ?line m(crypto:md4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+ "0123456789"),
+ hexstr2bin("043f8582f241db351ce627e153e7f0e4")),
+ ?line m(crypto:md4("12345678901234567890123456789012345678901234567890"
+ "123456789012345678901234567890"),
+ hexstr2bin("e33b4ddc9c38f2199c3e7b164fcc0536")).
+
+%%
+%%
+md4_update(doc) ->
+ ["Generate MD5 message using md5_init, md5_update, and md5_final, and"
+ "check the result. Examples are from RFC-1321."];
+md4_update(suite) ->
+ [];
+md4_update(Config) when is_list(Config) ->
+ ?line Ctx = crypto:md4_init(),
+ ?line Ctx1 = crypto:md4_update(Ctx, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
+ ?line Ctx2 = crypto:md4_update(Ctx1, "abcdefghijklmnopqrstuvwxyz"
+ "0123456789"),
+ ?line m(crypto:md4_final(Ctx2),
+ hexstr2bin("043f8582f241db351ce627e153e7f0e4")).
+
+%%
+%%
+sha(doc) ->
+ ["Generate SHA message digests and check the result. Examples are "
+ "from FIPS-180-1."];
+sha(suite) ->
+ [];
+sha(Config) when is_list(Config) ->
+ ?line m(crypto:sha("abc"),
+ hexstr2bin("A9993E364706816ABA3E25717850C26C9CD0D89D")),
+ ?line m(crypto:sha("abcdbcdecdefdefgefghfghighijhijkijkljklmklm"
+ "nlmnomnopnopq"),
+ hexstr2bin("84983E441C3BD26EBAAE4AA1F95129E5E54670F1")).
+
+
+%%
+%%
+sha_update(doc) ->
+ ["Generate SHA message digests by using sha_init, sha_update, and"
+ "sha_final, and check the result. Examples are from FIPS-180-1."];
+sha_update(suite) ->
+ [];
+sha_update(Config) when is_list(Config) ->
+ ?line Ctx = crypto:sha_init(),
+ ?line Ctx1 = crypto:sha_update(Ctx, "abcdbcdecdefdefgefghfghighi"),
+ ?line Ctx2 = crypto:sha_update(Ctx1, "jhijkijkljklmklmnlmnomnopnopq"),
+ ?line m(crypto:sha_final(Ctx2),
+ hexstr2bin("84983E441C3BD26EBAAE4AA1F95129E5E54670F1")).
+
+%%
+%%
+sha256(doc) ->
+ ["Generate SHA-256 message digests and check the result. Examples are "
+ "from rfc-4634."];
+sha256(suite) ->
+ [];
+sha256(Config) when is_list(Config) ->
+ ?line m(crypto:sha256("abc"),
+ hexstr2bin("BA7816BF8F01CFEA4141"
+ "40DE5DAE2223B00361A396177A9CB410FF61F20015AD")),
+ ?line m(crypto:sha256("abcdbcdecdefdefgefghfghighijhijkijkljklmklm"
+ "nlmnomnopnopq"),
+ hexstr2bin("248D6A61D20638B8"
+ "E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1")).
+
+%%
+%%
+sha256_update(doc) ->
+ ["Generate SHA256 message digests by using sha256_init, sha256_update, and"
+ "sha256_final, and check the result. Examples are from rfc-4634."];
+sha256_update(suite) ->
+ [];
+sha256_update(Config) when is_list(Config) ->
+ ?line Ctx = crypto:sha256_init(),
+ ?line Ctx1 = crypto:sha256_update(Ctx, "abcdbcdecdefdefgefghfghighi"),
+ ?line Ctx2 = crypto:sha256_update(Ctx1, "jhijkijkljklmklmnlmnomnopnopq"),
+ ?line m(crypto:sha256_final(Ctx2),
+ hexstr2bin("248D6A61D20638B8"
+ "E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1")).
+
+
+%%
+%%
+sha512(doc) ->
+ ["Generate SHA-512 message digests and check the result. Examples are "
+ "from rfc-4634."];
+sha512(suite) ->
+ [];
+sha512(Config) when is_list(Config) ->
+ ?line m(crypto:sha512("abc"),
+ hexstr2bin("DDAF35A193617ABACC417349AE20413112E6FA4E89A97EA2"
+ "0A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD"
+ "454D4423643CE80E2A9AC94FA54CA49F")),
+ ?line m(crypto:sha512("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
+ "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"),
+ hexstr2bin("8E959B75DAE313DA8CF4F72814FC143F8F7779C6EB9F7FA1"
+ "7299AEADB6889018501D289E4900F7E4331B99DEC4B5433A"
+ "C7D329EEB6DD26545E96E55B874BE909")).
+
+%%
+%%
+sha512_update(doc) ->
+ ["Generate SHA512 message digests by using sha512_init, sha512_update, and"
+ "sha512_final, and check the result. Examples are from rfc=4634."];
+sha512_update(suite) ->
+ [];
+sha512_update(Config) when is_list(Config) ->
+ ?line Ctx = crypto:sha512_init(),
+ ?line Ctx1 = crypto:sha512_update(Ctx, "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"),
+ ?line Ctx2 = crypto:sha512_update(Ctx1, "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"),
+ ?line m(crypto:sha512_final(Ctx2),
+ hexstr2bin("8E959B75DAE313DA8CF4F72814FC143F8F7779C6EB9F7FA1"
+ "7299AEADB6889018501D289E4900F7E4331B99DEC4B5433A"
+ "C7D329EEB6DD26545E96E55B874BE909")).
+
+%%
+%%
+md5_mac(doc) ->
+ ["Generate some HMACs, using MD5, and check the result. Examples are "
+ "from RFC-2104."];
+md5_mac(suite) ->
+ [];
+md5_mac(Config) when is_list(Config) ->
+ ?line m(crypto:md5_mac(hexstr2bin("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"),
+ "Hi There"),
+ hexstr2bin("9294727a3638bb1c13f48ef8158bfc9d")),
+ ?line m(crypto:md5_mac(list_to_binary("Jefe"),
+ "what do ya want for nothing?"),
+ hexstr2bin("750c783e6ab0b503eaa86e310a5db738")),
+ ?line m(crypto:md5_mac(hexstr2bin("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"),
+ hexstr2bin("DDDDDDDDDDDDDDDDDDDD"
+ "DDDDDDDDDDDDDDDDDDDD"
+ "DDDDDDDDDDDDDDDDDDDD"
+ "DDDDDDDDDDDDDDDDDDDD"
+ "DDDDDDDDDDDDDDDDDDDD")),
+ hexstr2bin("56be34521d144c88dbb8c733f0e8b3f6")).
+
+%%
+%%
+md5_mac_io(doc) ->
+ ["Generate some HMACs, using MD5, with Key an IO-list, and check the "
+ "result. Examples are from RFC-2104."];
+md5_mac_io(suite) ->
+ [];
+md5_mac_io(Config) when is_list(Config) ->
+ ?line Key1 = hexstr2bin("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"),
+ ?line {B11, B12} = split_binary(Key1, 4),
+ ?line Key11 = [B11,binary_to_list(B12)],
+ ?line m(crypto:md5_mac(Key11, "Hi There"),
+ hexstr2bin("9294727a3638bb1c13f48ef8158bfc9d")).
+
+%%
+%%
+des_cbc(doc) ->
+ "Encrypt and decrypt according to CBC DES. and check the result. "
+ "Example are from FIPS-81.";
+des_cbc(suite) ->
+ [];
+des_cbc(Config) when is_list(Config) ->
+ ?line Key = hexstr2bin("0123456789abcdef"),
+ ?line IVec = hexstr2bin("1234567890abcdef"),
+ ?line Plain = "Now is the time for all ",
+ ?line Cipher = crypto:des_cbc_encrypt(Key, IVec, Plain),
+ ?line m(Cipher, hexstr2bin("e5c7cdde872bf27c43e934008c389c"
+ "0f683788499a7c05f6")),
+ ?line m(list_to_binary(Plain),
+ crypto:des_cbc_decrypt(Key, IVec, Cipher)),
+ ?line Plain2 = "7654321 Now is the time for " ++ [0, 0, 0, 0],
+ ?line Cipher2 = crypto:des_cbc_encrypt(Key, IVec, Plain2),
+ ?line m(Cipher2, hexstr2bin("b9916b8ee4c3da64b4f44e3cbefb9"
+ "9484521388fa59ae67d58d2e77e86062733")),
+ ?line m(list_to_binary(Plain2),
+ crypto:des_cbc_decrypt(Key, IVec, Cipher2)).
+
+%%
+%%
+des_cbc_iter(doc) ->
+ "Encrypt and decrypt according to CBC DES in two steps, and "
+ "check the result. Example are from FIPS-81.";
+des_cbc_iter(suite) ->
+ [];
+des_cbc_iter(Config) when is_list(Config) ->
+ ?line Key = hexstr2bin("0123456789abcdef"),
+ ?line IVec = hexstr2bin("1234567890abcdef"),
+ ?line Plain1 = "Now is the time ",
+ ?line Plain2 = "for all ",
+ ?line Cipher1 = crypto:des_cbc_encrypt(Key, IVec, Plain1),
+ ?line IVec2 = crypto:des_cbc_ivec(Cipher1),
+ ?line Cipher2 = crypto:des_cbc_encrypt(Key, IVec2, Plain2),
+ ?line Cipher = concat_binary([Cipher1, Cipher2]),
+ ?line m(Cipher, hexstr2bin("e5c7cdde872bf27c43e934008c389c"
+ "0f683788499a7c05f6")).
+
+%%
+%%
+aes_cfb(doc) ->
+ "Encrypt and decrypt according to AES CFB 128 bit and check "
+ "the result. Example are from NIST SP 800-38A.";
+
+aes_cfb(suite) ->
+ [];
+aes_cfb(Config) when is_list(Config) ->
+
+%% Sample data from NIST Spec.Publ. 800-38A
+%% F.3.13 CFB128-AES128.Encrypt
+%% Key 2b7e151628aed2a6abf7158809cf4f3c
+%% IV 000102030405060708090a0b0c0d0e0f
+%% Segment #1
+%% Input Block 000102030405060708090a0b0c0d0e0f
+%% Output Block 50fe67cc996d32b6da0937e99bafec60
+%% Plaintext 6bc1bee22e409f96e93d7e117393172a
+%% Ciphertext 3b3fd92eb72dad20333449f8e83cfb4a
+%% Segment #2
+%% Input Block 3b3fd92eb72dad20333449f8e83cfb4a
+%% Output Block 668bcf60beb005a35354a201dab36bda
+%% Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
+%% Ciphertext c8a64537a0b3a93fcde3cdad9f1ce58b
+%% Segment #3
+%% Input Block c8a64537a0b3a93fcde3cdad9f1ce58b
+%% Output Block 16bd032100975551547b4de89daea630
+%% Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
+%% Ciphertext 26751f67a3cbb140b1808cf187a4f4df
+%% Segment #4
+%% Input Block 26751f67a3cbb140b1808cf187a4f4df
+%% Output Block 36d42170a312871947ef8714799bc5f6
+%% Plaintext f69f2445df4f9b17ad2b417be66c3710
+%% Ciphertext c04b05357c5d1c0eeac4c66f9ff7f2e6
+
+ ?line Key = hexstr2bin("2b7e151628aed2a6abf7158809cf4f3c"),
+ ?line IVec = hexstr2bin("000102030405060708090a0b0c0d0e0f"),
+ ?line Plain = hexstr2bin("6bc1bee22e409f96e93d7e117393172a"),
+ ?line Cipher = crypto:aes_cfb_128_encrypt(Key, IVec, Plain),
+ ?line m(Cipher, hexstr2bin("3b3fd92eb72dad20333449f8e83cfb4a")),
+ ?line m(Plain,
+ crypto:aes_cfb_128_decrypt(Key, IVec, Cipher)).
+
+%%
+%%
+aes_cbc(doc) ->
+ "Encrypt and decrypt according to AES CBC 128 bit. and check the result. "
+ "Example are from NIST SP 800-38A.";
+
+aes_cbc(suite) ->
+ [];
+aes_cbc(Config) when is_list(Config) ->
+
+%% Sample data from NIST Spec.Publ. 800-38A
+%% F.2.1 CBC-AES128.Encrypt
+%% Key 2b7e151628aed2a6abf7158809cf4f3c
+%% IV 000102030405060708090a0b0c0d0e0f
+%% Block #1
+%% Plaintext 6bc1bee22e409f96e93d7e117393172a
+%% Input Block 6bc0bce12a459991e134741a7f9e1925
+%% Output Block 7649abac8119b246cee98e9b12e9197d
+%% Ciphertext 7649abac8119b246cee98e9b12e9197d
+%% Block #2
+%% Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
+%% Input Block d86421fb9f1a1eda505ee1375746972c
+%% Output Block 5086cb9b507219ee95db113a917678b2
+%% Ciphertext 5086cb9b507219ee95db113a917678b2
+%% Block #3
+%% Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
+%% Input Block 604ed7ddf32efdff7020d0238b7c2a5d
+%% Output Block 73bed6b8e3c1743b7116e69e22229516
+%% Ciphertext 73bed6b8e3c1743b7116e69e22229516
+%% Block #4
+%% Plaintext f69f2445df4f9b17ad2b417be66c3710
+%% Input Block 8521f2fd3c8eef2cdc3da7e5c44ea206
+%% Output Block 3ff1caa1681fac09120eca307586e1a7
+%% Ciphertext 3ff1caa1681fac09120eca307586e1a7
+%%
+%% F.2.2 CBC-AES128.Decrypt
+%% Key 2b7e151628aed2a6abf7158809cf4f3c
+%% IV 000102030405060708090a0b0c0d0e0f
+ %% Block #1
+%% Ciphertext 7649abac8119b246cee98e9b12e9197d
+%% Input Block 7649abac8119b246cee98e9b12e9197d
+%% Output Block 6bc0bce12a459991e134741a7f9e1925
+%% Plaintext 6bc1bee22e409f96e93d7e117393172a
+%% Block #2
+%% Ciphertext 5086cb9b507219ee95db113a917678b2
+%% Input Block 5086cb9b507219ee95db113a917678b2
+%% Output Block d86421fb9f1a1eda505ee1375746972c
+%% Plaintext ae2d8a571e03ac9c9eb76fac45af8e51
+%% Block #3
+%% Ciphertext 73bed6b8e3c1743b7116e69e22229516
+%% Input Block 73bed6b8e3c1743b7116e69e22229516
+%% Output Block 604ed7ddf32efdff7020d0238b7c2a5d
+%% Plaintext 30c81c46a35ce411e5fbc1191a0a52ef
+%% Block #4
+%% Ciphertext 3ff1caa1681fac09120eca307586e1a7
+%% Input Block 3ff1caa1681fac09120eca307586e1a7
+%% Output Block 8521f2fd3c8eef2cdc3da7e5c44ea206
+%% Plaintext f69f2445df4f9b17ad2b417be66c3710
+
+ ?line Key = hexstr2bin("2b7e151628aed2a6abf7158809cf4f3c"),
+ ?line IVec = hexstr2bin("000102030405060708090a0b0c0d0e0f"),
+ ?line Plain = hexstr2bin("6bc1bee22e409f96e93d7e117393172a"),
+ ?line Cipher = crypto:aes_cbc_128_encrypt(Key, IVec, Plain),
+ ?line m(Cipher, hexstr2bin("7649abac8119b246cee98e9b12e9197d")),
+ ?line m(Plain,
+ crypto:aes_cbc_128_decrypt(Key, IVec, Cipher)).
+
+aes_cbc_iter(doc) ->
+ "Encrypt and decrypt according to CBC AES in steps";
+aes_cbc_iter(suite) -> [];
+aes_cbc_iter(Config) when is_list(Config) ->
+ Key = list_to_binary(lists:seq(255,256-16*17,-17)),
+ IVec = list_to_binary(lists:seq(1,16*7,7)),
+ Plain = <<"One, two, three o'clock, four o'clock, rock"
+ "Five, six, seven o'clock, eight o'clock, rock"
+ "Nine, ten, eleven o'clock, twelve o'clock, rock"
+ "We're gonna rock around the clock tonight">>,
+ ?line 0 = size(Plain) rem 16,
+
+ ?line Cipher = crypto:aes_cbc_128_encrypt(Key, IVec, Plain),
+ ?line Plain = crypto:aes_cbc_128_decrypt(Key, IVec, Cipher),
+
+ ?line Cipher = aes_cbc_encrypt_iter(Key,IVec,Plain,<<>>),
+ ?line Plain = aes_cbc_decrypt_iter(Key,IVec,Cipher,<<>>),
+ ok.
+
+aes_cbc_encrypt_iter(_,_,<<>>, Acc) ->
+ Acc;
+aes_cbc_encrypt_iter(Key,IVec,Data, Acc) ->
+ Bytes = 16 * (1 + size(Data) div (16*3)),
+ <<Chunk:Bytes/binary, Rest/binary>> = Data,
+ %%io:format("encrypt iter Chunk=~p Rest=~p\n",[Chunk,Rest]),
+ ?line Cipher = crypto:aes_cbc_128_encrypt(Key, IVec, Chunk),
+ ?line IVec2 = crypto:aes_cbc_ivec(Cipher),
+ aes_cbc_encrypt_iter(Key,IVec2,Rest, <<Acc/binary, Cipher/binary>>).
+
+aes_cbc_decrypt_iter(_,_,<<>>, Acc) ->
+ Acc;
+aes_cbc_decrypt_iter(Key,IVec,Data, Acc) ->
+ Bytes = 16 * (1 + size(Data) div (16*5)),
+ <<Chunk:Bytes/binary, Rest/binary>> = Data,
+ %%io:format("decrypt iter Chunk=~p Rest=~p\n",[Chunk,Rest]),
+ ?line Plain = crypto:aes_cbc_128_decrypt(Key, IVec, Chunk),
+ ?line IVec2 = crypto:aes_cbc_ivec(Chunk),
+ aes_cbc_decrypt_iter(Key,IVec2,Rest, <<Acc/binary, Plain/binary>>).
+
+
+%%
+%%
+mod_exp_test(doc) ->
+ "mod_exp testing (A ^ M % P with bignums)";
+mod_exp_test(suite) ->
+ [];
+mod_exp_test(Config) when is_list(Config) ->
+ mod_exp_aux_test(2, 5, 10, 8).
+
+mod_exp_aux_test(_, _, _, 0) ->
+ ok;
+mod_exp_aux_test(B, E, M, N) ->
+ ?line R1 = crypto:mod_exp(B, E, M),
+ ?line R2 = ipow(B, E, M),
+ ?line m(R1, R2),
+ ?line mod_exp_aux_test(B, E*E+1, M*M+1, N-1).
+
+%%
+%%
+rand_uniform_test(doc) ->
+ "rand_uniform and random_bytes testing";
+rand_uniform_test(suite) ->
+ [];
+rand_uniform_test(Config) when is_list(Config) ->
+ rand_uniform_aux_test(10),
+ ?line 10 = size(crypto:rand_bytes(10)).
+
+rand_uniform_aux_test(0) ->
+ ok;
+rand_uniform_aux_test(N) ->
+ ?line L = N*1000,
+ ?line H = N*100000+1,
+ ?line R1 = crypto:rand_uniform(L, H),
+ ?line t(R1 >= L),
+ ?line t(R1 < H),
+ ?line rand_uniform_aux_test(N-1).
+
+%%
+%%
+%%
+%%
+rsa_verify_test(doc) ->
+ "rsa_verify testing (A ^ M % P with bignums)";
+rsa_verify_test(suite) ->
+ [];
+rsa_verify_test(Config) when is_list(Config) ->
+ ?line H = <<178,28,54,104,36,80,144,66,140,201,135,17,36,97,114,124,
+ 194,164,172,147>>,
+ ?line SigBlob = <<153,44,121,71,132,1,192,159,78,33,29,62,153,64,191,70,
+ 208,239,166,208,220,167,49,111,128,67,91,253,24,63,194,241,
+ 97,157,135,226,121,162,150,156,60,49,236,90,151,67,239,23,
+ 92,103,89,254,17,165,78,181,64,128,13,210,86,111,209,76,
+ 115,34,107,227,151,47,80,185,143,85,202,55,245,163,226,26,
+ 139,104,196,6,96,82,108,197,13,0,12,70,153,109,107,180,
+ 130,246,156,182,56,96,31,220,227,218,136,211,252,43,8,14,
+ 145,155,191,206,72,194,80,52,54,206,53,27,6,188,195,29>>,
+ ?line BadSigBlob = <<153,44,121,71,132,1,192,159,78,33,29,62,153,64,191,70,
+ 208,239,166,208,220,167,49,111,128,67,91,253,24,63,194,241,
+ 97,157,135,226,121,162,150,156,60,49,236,90,151,67,239,23,
+ 92,103,89,254,17,165,78,181,64,128,13,210,86,111,209,76,
+ 115,107,34,227,151,47,80,185,143,85,202,55,245,163,226,26,
+ 139,104,196,6,96,82,108,197,13,0,12,70,153,109,107,180,
+ 130,246,156,182,56,96,31,220,227,218,136,211,252,43,8,14,
+ 145,155,191,206,72,194,80,52,54,206,53,27,6,188,195,29>>,
+ ?line E = <<35>>,
+ ?line N = <<0,199,209,142,191,86,92,148,103,37,250,217,175,169,109,10,
+ 130,139,34,237,174,90,97,118,7,185,57,137,252,236,177,193,
+ 228,16,62,29,153,144,64,207,152,240,152,206,136,89,64,6,
+ 3,187,89,57,241,219,88,215,75,70,120,20,145,229,37,1,
+ 67,138,204,17,39,231,249,239,116,142,169,99,149,41,65,123,
+ 26,225,133,0,41,85,77,181,35,100,162,223,92,220,207,50,
+ 63,168,193,171,174,199,23,214,201,63,157,76,125,6,54,73,
+ 76,89,40,33,147,208,189,76,98,24,61,8,10,110,165,119,165>>,
+ ?line Nbad = <<0,199,209,142,191,86,92,148,103,37,250,217,175,169,109,10,
+ 130,139,34,237,174,90,97,118,7,185,57,137,252,236,177,193,
+ 228,16,62,29,153,144,64,207,152,240,152,206,136,89,64,6,
+ 3,187,89,57,241,219,88,215,75,70,120,20,145,229,37,1,
+ 67,138,204,17,39,231,249,239,116,142,169,99,149,41,65,123,
+ 26,225,133,0,41,85,77,181,35,100,162,223,92,220,207,50,
+ 63,168,193,171,174,199,23,214,201,63,157,76,125,6,54,73,
+ 76,89,40,33,147,189,208,76,98,24,61,8,10,110,165,119,165>>,
+ ?line Ebad = <<77>>,
+ ?line m(crypto:rsa_verify(sized_binary(H), sized_binary(SigBlob),
+ [sized_binary(E), sized_binary(N)]), true),
+ ?line m(crypto:rsa_verify(sized_binary(H), sized_binary(SigBlob),
+ [sized_binary(Ebad), sized_binary(N)]), false),
+ ?line m(crypto:rsa_verify(sized_binary(H), sized_binary(SigBlob),
+ [sized_binary(E), sized_binary(Nbad)]), false),
+ ?line m(crypto:rsa_verify(sized_binary(H), sized_binary(BadSigBlob),
+ [sized_binary(E), sized_binary(N)]), false).
+
+%%
+%%
+dsa_verify_test(doc) ->
+ "dsa_verify testing (A ^ M % P with bignums)";
+dsa_verify_test(suite) ->
+ [];
+dsa_verify_test(Config) when is_list(Config) ->
+ ?line Msg = <<48,130,2,245,160,3,2,1,2,2,1,1,48,9,6,7,42,134,72,206,56,4,3,48,
+ 58,49,11,48,9,6,3,85,4,6,19,2,85,83,49,26,48,24,6,3,85,4,10,19,17,
+ 84,101,115,116,32,67,101,114,116,105,102,105,99,97,116,101,115,49,
+ 15,48,13,6,3,85,4,3,19,6,68,83,65,32,67,65,48,30,23,13,48,49,48,
+ 52,49,57,49,52,53,55,50,48,90,23,13,49,49,48,52,49,57,49,52,53,55,
+ 50,48,90,48,93,49,11,48,9,6,3,85,4,6,19,2,85,83,49,26,48,24,6,3,
+ 85,4,10,19,17,84,101,115,116,32,67,101,114,116,105,102,105,99,97,
+ 116,101,115,49,50,48,48,6,3,85,4,3,19,41,86,97,108,105,100,32,68,
+ 83,65,32,83,105,103,110,97,116,117,114,101,115,32,69,69,32,67,101,
+ 114,116,105,102,105,99,97,116,101,32,84,101,115,116,52,48,130,1,
+ 182,48,130,1,43,6,7,42,134,72,206,56,4,1,48,130,1,30,2,129,129,0,
+ 228,139,175,64,140,21,215,61,124,238,3,150,18,104,193,32,5,232,23,
+ 202,158,116,101,75,154,84,151,42,120,51,218,165,197,114,234,52,
+ 179,148,104,66,213,27,253,119,240,168,66,158,100,147,144,182,194,
+ 2,49,70,19,122,3,105,204,152,45,86,157,94,35,95,40,191,173,127,15,
+ 208,105,149,98,92,26,7,42,94,140,115,73,126,253,18,34,142,85,229,
+ 86,233,174,114,41,150,135,8,39,215,119,67,240,134,184,9,10,27,20,
+ 165,230,3,230,69,121,77,233,250,83,95,193,9,189,126,197,195,2,21,
+ 0,128,63,228,252,243,76,229,62,203,15,23,10,42,84,108,208,103,108,
+ 13,59,2,129,128,102,212,22,138,32,173,254,209,50,159,165,127,167,
+ 179,208,234,119,63,235,108,162,228,41,216,216,188,33,221,154,247,
+ 204,229,180,119,77,223,236,218,162,140,156,117,18,90,31,254,102,
+ 211,17,194,239,132,67,236,169,136,110,76,186,76,63,53,150,199,103,
+ 252,153,189,15,153,41,19,145,78,216,2,174,254,107,175,80,86,170,
+ 47,30,181,42,200,238,34,71,37,120,107,33,221,20,63,206,240,16,129,
+ 247,150,29,156,65,187,94,68,146,93,46,198,30,184,205,105,200,143,
+ 63,59,62,208,79,162,206,217,3,129,132,0,2,129,128,15,83,40,172,56,
+ 47,61,243,17,97,65,195,61,167,214,122,247,246,1,50,211,33,113,16,
+ 20,213,195,62,77,235,25,162,140,175,158,8,61,65,10,255,204,162,71,
+ 130,122,86,161,163,253,236,178,139,183,57,181,202,160,25,133,130,
+ 155,150,104,168,187,107,186,144,164,225,173,101,182,68,49,210,30,
+ 34,47,83,65,79,250,156,248,47,232,44,67,36,22,126,43,216,100,247,
+ 100,250,240,121,72,29,185,2,109,144,54,204,235,54,15,242,57,171,
+ 125,39,236,247,71,111,221,51,196,126,77,238,36,87,163,107,48,105,
+ 48,29,6,3,85,29,14,4,22,4,20,179,51,215,81,162,4,13,68,251,157,64,
+ 241,18,98,113,176,83,246,105,13,48,31,6,3,85,29,35,4,24,48,22,128,
+ 20,116,21,213,36,28,189,94,101,136,31,225,139,9,126,127,234,25,72,
+ 78,97,48,23,6,3,85,29,32,4,16,48,14,48,12,6,10,96,134,72,1,101,3,
+ 2,1,48,1,48,14,6,3,85,29,15,1,1,255,4,4,3,2,6,192>>,
+
+ ?line SigBlob = <<48,45,2,21,0,140,167,200,210,153,212,64,155,249,33,146,104,243,
+ 39,38,9,115,162,89,24,2,20,76,254,31,128,187,48,128,215,216,
+ 112,198,78,118,160,217,157,180,246,64,234>>,
+ ?line P_p = 157224271412839155721795253728878055347359513988016145491388196653004661857517720927482198111104095793441029858267073789634147217022008635826863307553453131345099940951090826856271796188522037524757740796268675508118348391218066949174594918958269259937813776150149068811425194955973128428675945283593831134219,
+ ?line Q_p = 1181895316321540581845959276009400765315408342791,
+ ?line G_p = 143872196713149000950547166575757355261637863805587906227228163275557375159769599033632918292482002186641475268486598023281100659643528846513898847919251032731261718358900479488287933293278745715922865499005559197328388506945134386346185262919258658109015074718441639029135304654725637911172671711310801418648,
+
+ ?line Key = 12603618348903387232593303690286336220738319446775939686476278478034365380027994899970214309288018488811754534229198764622077544117034174589418477472887827980332636062691833965078594576024299807057520016043084384987871640003684704483975314128362610573625803532737054022545217931847268776098203204571431581966,
+
+ ValidKey = [crypto:mpint(P_p),
+ crypto:mpint(Q_p),
+ crypto:mpint(G_p),
+ crypto:mpint(Key)
+ ],
+
+ ?line m(crypto:dss_verify(sized_binary(Msg), sized_binary(SigBlob),
+ ValidKey), true),
+
+ BadMsg = one_bit_wrong(Msg),
+ ?line m(crypto:dss_verify(sized_binary(BadMsg), sized_binary(SigBlob),
+ ValidKey), false),
+ BadSig = one_bit_wrong(SigBlob),
+ ?line m(crypto:dss_verify(sized_binary(Msg), sized_binary(BadSig),
+ ValidKey), false),
+ SizeErr = size(SigBlob) - 13,
+
+ BadArg = (catch crypto:dss_verify(sized_binary(Msg), <<SizeErr:32, SigBlob/binary>>,
+ ValidKey)),
+ ?line m(element(1,element(2,BadArg)), badarg),
+
+ InValidKey = [crypto:mpint(P_p),
+ crypto:mpint(Q_p),
+ crypto:mpint(G_p),
+ crypto:mpint(Key+17)
+ ],
+
+ ?line m(crypto:dss_verify(sized_binary(Msg), sized_binary(SigBlob),
+ InValidKey), false).
+
+one_bit_wrong(Bin) ->
+ Half = size(Bin) div 2,
+ <<First:Half/binary, Byte:8, Last/binary>> = Bin,
+ <<First/binary, (Byte+1):8, Last/binary>>.
+
+
+%%
+%% Sign tests
+
+rsa_sign_test(doc) ->
+ "rsa_sign testing";
+rsa_sign_test(suite) ->
+ [];
+rsa_sign_test(Config) when is_list(Config) ->
+ PubEx = 65537,
+ PrivEx = 7531712708607620783801185371644749935066152052780368689827275932079815492940396744378735701395659435842364793962992309884847527234216715366607660219930945,
+ Mod = 7919488123861148172698919999061127847747888703039837999377650217570191053151807772962118671509138346758471459464133273114654252861270845708312601272799123,
+ Msg = <<"7896345786348756234 Hejsan Svejsan, erlang crypto debugger"
+ "09812312908312378623487263487623412039812 huagasd">>,
+
+ PrivKey = [crypto:mpint(PubEx), crypto:mpint(Mod), crypto:mpint(PrivEx)],
+ PubKey = [crypto:mpint(PubEx), crypto:mpint(Mod)],
+ ?line Sig1 = crypto:rsa_sign(sized_binary(Msg), PrivKey),
+ ?line m(crypto:rsa_verify(sized_binary(Msg), sized_binary(Sig1),PubKey), true),
+
+ ?line Sig2 = crypto:rsa_sign(md5, sized_binary(Msg), PrivKey),
+ ?line m(crypto:rsa_verify(md5, sized_binary(Msg), sized_binary(Sig2),PubKey), true),
+
+ ?line m(Sig1 =:= Sig2, false),
+ ?line m(crypto:rsa_verify(md5, sized_binary(Msg), sized_binary(Sig1),PubKey), false),
+ ?line m(crypto:rsa_verify(sha, sized_binary(Msg), sized_binary(Sig1),PubKey), true),
+
+ ok.
+
+dsa_sign_test(doc) ->
+ "dsa_sign testing";
+dsa_sign_test(suite) ->
+ [];
+dsa_sign_test(Config) when is_list(Config) ->
+ Msg = <<"7896345786348756234 Hejsan Svejsan, erlang crypto debugger"
+ "09812312908312378623487263487623412039812 huagasd">>,
+
+ PubKey = _Y = 25854665488880835237281628794585130313500176551981812527054397586638455298000483144002221850980183404910190346416063318160497344811383498859129095184158800144312512447497510551471331451396405348497845813002058423110442376886564659959543650802132345311573634832461635601376738282831340827591903548964194832978,
+ PrivKey = _X = 441502407453038284293378221372000880210588566361,
+ ParamP = 109799869232806890760655301608454668257695818999841877165019612946154359052535682480084145133201304812979481136659521529774182959764860329095546511521488413513097576425638476458000255392402120367876345280670101492199681798674053929238558140260669578407351853803102625390950534052428162468100618240968893110797,
+ ParamQ = 1349199015905534965792122312016505075413456283393,
+ ParamG = 18320614775012672475365915366944922415598782131828709277168615511695849821411624805195787607930033958243224786899641459701930253094446221381818858674389863050420226114787005820357372837321561754462061849169568607689530279303056075793886577588606958623645901271866346406773590024901668622321064384483571751669,
+
+ Params = [crypto:mpint(ParamP), crypto:mpint(ParamQ), crypto:mpint(ParamG)],
+ ?line Sig1 = crypto:dss_sign(sized_binary(Msg), [Params, crypto:mpint(PrivKey)]),
+
+ ?line m(crypto:dss_verify(sized_binary(Msg), sized_binary(Sig1),
+ [Params, crypto:mpint(PubKey)]), true),
+
+ ?line m(crypto:dss_verify(sized_binary(one_bit_wrong(Msg)), sized_binary(Sig1),
+ [Params, crypto:mpint(PubKey)]), false),
+
+ ?line m(crypto:dss_verify(sized_binary(Msg), sized_binary(one_bit_wrong(Sig1)),
+ [Params, crypto:mpint(PubKey)]), false),
+
+ %%?line Bad = crypto:dss_sign(sized_binary(Msg), [Params, crypto:mpint(PubKey)]),
+
+ ok.
+
+
+rsa_encrypt_decrypt(doc) ->
+ ["Test rsa_public_encrypt and rsa_private_decrypt functions."];
+rsa_encrypt_decrypt(suite) -> [];
+rsa_encrypt_decrypt(Config) when is_list(Config) ->
+ PubEx = 65537,
+ PrivEx = 7531712708607620783801185371644749935066152052780368689827275932079815492940396744378735701395659435842364793962992309884847527234216715366607660219930945,
+ Mod = 7919488123861148172698919999061127847747888703039837999377650217570191053151807772962118671509138346758471459464133273114654252861270845708312601272799123,
+
+ PrivKey = [crypto:mpint(PubEx), crypto:mpint(Mod), crypto:mpint(PrivEx)],
+ PubKey = [crypto:mpint(PubEx), crypto:mpint(Mod)],
+
+ Msg = <<"7896345786348 Asldi">>,
+
+ ?line PKCS1 = crypto:rsa_public_encrypt(Msg, PubKey, rsa_pkcs1_padding),
+ ?line PKCS1Dec = crypto:rsa_private_decrypt(PKCS1, PrivKey, rsa_pkcs1_padding),
+ io:format("PKCS1Dec ~p~n",[PKCS1Dec]),
+ ?line Msg = PKCS1Dec,
+
+ ?line OAEP = crypto:rsa_public_encrypt(Msg, PubKey, rsa_pkcs1_oaep_padding),
+ ?line Msg = crypto:rsa_private_decrypt(OAEP, PrivKey, rsa_pkcs1_oaep_padding),
+
+ <<Msg2Len:32,_/binary>> = crypto:mpint(Mod),
+ Msg2 = list_to_binary(lists:duplicate(Msg2Len-1, $X)),
+ ?line NoPad = crypto:rsa_public_encrypt(Msg2, PubKey, rsa_no_padding),
+ ?line NoPadDec = crypto:rsa_private_decrypt(NoPad, PrivKey, rsa_no_padding),
+ ?line NoPadDec = Msg2,
+
+ ShouldBeError = (catch crypto:rsa_public_encrypt(Msg, PubKey, rsa_no_padding)),
+ ?line {'EXIT', {encrypt_failed,_}} = ShouldBeError,
+
+%% ?line SSL = crypto:rsa_public_encrypt(Msg, PubKey, rsa_sslv23_padding),
+%% ?line Msg = crypto:rsa_private_decrypt(SSL, PrivKey, rsa_sslv23_padding),
+
+ ?line PKCS1_2 = crypto:rsa_private_encrypt(Msg, PrivKey, rsa_pkcs1_padding),
+ ?line PKCS1_2Dec = crypto:rsa_public_decrypt(PKCS1_2, PubKey, rsa_pkcs1_padding),
+ io:format("PKCS2Dec ~p~n",[PKCS1_2Dec]),
+ ?line Msg = PKCS1_2Dec,
+
+ ?line PKCS1_3 = crypto:rsa_private_encrypt(Msg2, PrivKey, rsa_no_padding),
+ ?line PKCS1_3Dec = crypto:rsa_public_decrypt(PKCS1_3, PubKey, rsa_no_padding),
+ io:format("PKCS2Dec ~p~n",[PKCS1_3Dec]),
+ ?line Msg2 = PKCS1_3Dec,
+
+ ?line {'EXIT', {encrypt_failed,_}} =
+ (catch crypto:rsa_private_encrypt(Msg, PrivKey, rsa_no_padding)),
+
+ ok.
+
+
+dh(doc) ->
+ ["Test dh (Diffie-Hellman) functions."];
+dh(suite) -> [];
+dh(Config) when is_list(Config) ->
+ Self = self(),
+ GenP = fun() ->
+ %% Gen Param may take arbitrary long time to finish
+ %% That's not a bug in erlang crypto application.
+ ?line DHPs = crypto:dh_generate_parameters(512,2),
+ ?line ok = crypto:dh_check(DHPs),
+ Self ! {param, DHPs}
+ end,
+ Pid = spawn(GenP),
+ receive
+ {param, DHPs} ->
+ timer:sleep(100),
+ io:format("DHP ~p~n", [DHPs]),
+ ?line {Pub1,Priv1} = crypto:dh_generate_key(DHPs),
+ io:format("Key1:~n~p~n~p~n~n", [Pub1,Priv1]),
+ ?line {Pub2,Priv2} = crypto:dh_generate_key(DHPs),
+ io:format("Key2:~n~p~n~p~n~n", [Pub2,Priv2]),
+ ?line A = crypto:dh_compute_key(Pub1, Priv2, DHPs),
+ timer:sleep(100), %% Get another thread see if that triggers problem
+ ?line B = crypto:dh_compute_key(Pub2, Priv1, DHPs),
+ io:format("A ~p~n",[A]),
+ io:format("B ~p~n",[B]),
+ ?line A = B
+ after 50000 ->
+ io:format("Killing Param generation which took to long ~p~n",[Pid]),
+ exit(Pid, kill)
+ end.
+
+%%
+%%
+exor_test(doc) ->
+ ["Test the exor function."];
+exor_test(suite) ->
+ [];
+exor_test(Config) when is_list(Config) ->
+ B = <<1, 2, 3, 4, 5, 6, 7, 8, 9, 10>>,
+ Z1 = zero_bin(B),
+ Z1 = crypto:exor(B, B),
+ B1 = crypto:rand_bytes(100),
+ B2 = crypto:rand_bytes(100),
+ Z2 = zero_bin(B1),
+ Z2 = crypto:exor(B1, B1),
+ Z2 = crypto:exor(B2, B2),
+ R = xor_bytes(B1, B2),
+ R = crypto:exor(B1, B2),
+ ok.
+
+%%
+%%
+rc4_test(doc) ->
+ ["Test rc4 encryption ."];
+rc4_test(suite) ->
+ [];
+rc4_test(Config) when is_list(Config) ->
+ CT1 = <<"hej p� dig">>,
+ R1 = <<71,112,14,44,140,33,212,144,155,47>>,
+ K = "apaapa",
+ R1 = crypto:rc4_encrypt(K, CT1),
+ CT1 = crypto:rc4_encrypt(K, R1),
+ CT2 = lists:seq(0, 255),
+ R2 = crypto:rc4_encrypt(K, CT2),
+ CT2 = binary_to_list(crypto:rc4_encrypt(K, R2)),
+ ok.
+
+blowfish_cfb64(doc) -> ["Test Blowfish encrypt/decrypt."];
+blowfish_cfb64(suite) -> [];
+blowfish_cfb64(Config) when is_list(Config) ->
+ Key = <<1,35,69,103,137,171,205,239,240,225,210,195,180,165,150,135>>,
+
+ IVec = <<254,220,186,152,118,84,50,16>>,
+ Plain = <<"7654321 Now is the time for ">>,
+ Enc = <<231,50,20,162,130,33,57,202,242,110,207,109,46,185,231,110,61,163,222,4,209,81,114,0,81,157,87,166>>,
+
+ Enc = crypto:blowfish_cfb64_encrypt(Key, IVec, Plain),
+ Plain = crypto:blowfish_cfb64_decrypt(Key, IVec, Enc),
+
+ Key2 = <<"A2B4C">>,
+ IVec2 = <<"12345678">>,
+ Plain2 = <<"badger at my table....!">>,
+ Enc2 = <<173,76,128,155,70,81,79,228,4,162,188,92,119,53,144,89,93,236,28,164,176,16,138>>,
+
+ Enc2 = crypto:blowfish_cfb64_encrypt(Key2, IVec2, Plain2),
+ Plain2 = crypto:blowfish_cfb64_decrypt(Key2, IVec2, Enc2).
+
+
+smp(doc) -> "Check concurrent access to crypto driver";
+smp(suite) -> [];
+smp(Config) ->
+ case erlang:system_info(smp_support) of
+ true ->
+ NumOfProcs = erlang:system_info(schedulers),
+ io:format("smp starting ~p workers\n",[NumOfProcs]),
+ Seeds = [random:uniform(9999) || _ <- lists:seq(1,NumOfProcs)],
+ Parent = self(),
+ Pids = [spawn_link(fun()-> worker(Seed,Config,Parent) end)
+ || Seed <- Seeds],
+ wait_pids(Pids);
+
+ false ->
+ {skipped,"No smp support"}
+ end.
+
+worker(Seed, Config, Parent) ->
+ io:format("smp worker ~p, seed=~p~n",[self(),Seed]),
+ random:seed(Seed,Seed,Seed),
+ worker_loop(100, Config),
+ %%io:format("worker ~p done\n",[self()]),
+ Parent ! self().
+
+worker_loop(0, _) ->
+ ok;
+worker_loop(N, Config) ->
+ Funcs = { md5, md5_update, md5_mac, md5_mac_io, sha, sha_update, des_cbc,
+ aes_cfb, aes_cbc, des_cbc_iter, rand_uniform_test,
+ rsa_verify_test, exor_test, rc4_test, mod_exp_test },
+
+ F = element(random:uniform(size(Funcs)),Funcs),
+ %%io:format("worker ~p calling ~p\n",[self(),F]),
+ ?MODULE:F(Config),
+ worker_loop(N-1,Config).
+
+wait_pids([]) ->
+ ok;
+wait_pids(Pids) ->
+ receive
+ Pid ->
+ ?line true = lists:member(Pid,Pids),
+ Others = lists:delete(Pid,Pids),
+ io:format("wait_pid got ~p, still waiting for ~p\n",[Pid,Others]),
+ wait_pids(Others)
+ end.
+
+%%
+%% Help functions
+%%
+
+% match
+m(X, X) ->
+ ?line true.
+t(true) ->
+ true.
+
+% hexstr2bin
+hexstr2bin(S) ->
+ list_to_binary(hexstr2list(S)).
+
+hexstr2list([X,Y|T]) ->
+ [mkint(X)*16 + mkint(Y) | hexstr2list(T)];
+hexstr2list([]) ->
+ [].
+
+mkint(C) when $0 =< C, C =< $9 ->
+ C - $0;
+mkint(C) when $A =< C, C =< $F ->
+ C - $A + 10;
+mkint(C) when $a =< C, C =< $f ->
+ C - $a + 10.
+
+%% mod_exp in erlang (copied from jungerl's ssh_math.erl)
+ipow(A, B, M) when M > 0, B >= 0 ->
+ if A == 1 ->
+ 1;
+ true ->
+ ipow(A, B, M, 1)
+ end.
+
+ipow(A, 1, M, Prod) ->
+ (A*Prod) rem M;
+ipow(_A, 0, _M, Prod) ->
+ Prod;
+ipow(A, B, M, Prod) ->
+ B1 = B bsr 1,
+ A1 = (A*A) rem M,
+ if B - B1 == B1 ->
+ ipow(A1, B1, M, Prod);
+ true ->
+ ipow(A1, B1, M, (A*Prod) rem M)
+ end.
+
+%%
+%% Invert an element X mod P
+%% Calculated as {1, {A,B}} = egcd(X,P),
+%% 1 == P*A + X*B == X*B (mod P) i.e B is the inverse element
+%%
+%% X > 0, P > 0, X < P (P should be prime)
+%%
+%% invert(X,P) when X > 0, P > 0, X < P ->
+%% I = inv(X,P,1,0),
+%% if
+%% I < 0 -> P + I;
+%% true -> I
+%% end.
+
+%% inv(0,_,_,Q) -> Q;
+%% inv(X,P,R1,Q1) ->
+%% D = P div X,
+%% inv(P rem X, X, Q1 - D*R1, R1).
+
+sized_binary(Binary) when is_binary(Binary) ->
+ <<(size(Binary)):32/integer, Binary/binary>>;
+sized_binary(List) ->
+ sized_binary(list_to_binary(List)).
+
+xor_bytes(Bin1, Bin2) when is_binary(Bin1), is_binary(Bin2) ->
+ L1 = binary_to_list(Bin1),
+ L2 = binary_to_list(Bin2),
+ list_to_binary(xor_bytes(L1, L2));
+xor_bytes(L1, L2) ->
+ xor_bytes(L1, L2, []).
+
+xor_bytes([], [], Acc) ->
+ lists:reverse(Acc);
+xor_bytes([N1 | Tl1], [N2 | Tl2], Acc) ->
+ xor_bytes(Tl1, Tl2, [N1 bxor N2 | Acc]).
+
+zero_bin(N) when is_integer(N) ->
+ N8 = N * 8,
+ <<0:N8/integer>>;
+zero_bin(B) when is_binary(B) ->
+ zero_bin(size(B)).
diff --git a/lib/debugger/doc/src/Makefile b/lib/debugger/doc/src/Makefile
index e6a1de2701..1c0bbaf9d2 100644
--- a/lib/debugger/doc/src/Makefile
+++ b/lib/debugger/doc/src/Makefile
@@ -39,7 +39,7 @@ RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN)
XML_APPLICATION_FILES = ref_man.xml
XML_REF3_FILES = debugger.xml i.xml int.xml
-XML_PART_FILES = part.xml part_notes.xml
+XML_PART_FILES = part.xml
XML_CHAPTER_FILES = debugger_chapter.xml notes.xml
BOOK_FILES = book.xml
diff --git a/lib/debugger/doc/src/part_notes.xml b/lib/debugger/doc/src/part_notes.xml
deleted file mode 100644
index 60299bbb11..0000000000
--- a/lib/debugger/doc/src/part_notes.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="latin1" ?>
-<!DOCTYPE part SYSTEM "part.dtd">
-
-<part xmlns:xi="http://www.w3.org/2001/XInclude">
- <header>
- <copyright>
- <year>2004</year><year>2009</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- The contents of this file are subject to the Erlang Public License,
- Version 1.1, (the "License"); you may not use this file except in
- compliance with the License. You should have received a copy of the
- Erlang Public License along with this software. If not, it can be
- retrieved online at http://www.erlang.org/.
-
- Software distributed under the License is distributed on an "AS IS"
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- the License for the specific language governing rights and limitations
- under the License.
-
- </legalnotice>
-
- <title>Debugger Release Notes</title>
- <prepared></prepared>
- <docno></docno>
- <date>2004-09-07</date>
- <rev>1.0</rev>
- <file>part_notes.sgml</file>
- </header>
- <description>
- <p><em>Debugger</em> is a graphical tool which can be used for
- debugging and testing of Erlang programs. For example, breakpoints
- can be set, code can be single stepped and variable values can be
- displayed and changed.</p>
- </description>
- <xi:include href="notes.xml">
-</part>
-
-
diff --git a/lib/debugger/doc/src/warning.gif b/lib/debugger/doc/src/warning.gif
deleted file mode 100644
index 96af52360e..0000000000
--- a/lib/debugger/doc/src/warning.gif
+++ /dev/null
Binary files differ
diff --git a/lib/percept/src/egd.erl b/lib/percept/src/egd.erl
index 4becfef19b..7972fde597 100644
--- a/lib/percept/src/egd.erl
+++ b/lib/percept/src/egd.erl
@@ -128,13 +128,13 @@ line(Image, P1, P2, Color) ->
%% @spec color( Value | Name ) -> color()
%% where
-%% Value = {byte(), byte(), byte()} | {byte(), byte(), byte(), byte()}
-%% Name = black | silver | gray | white | maroon | red | purple | fuchia | green | lime | olive | yellow | navy | blue | teal | aqua
+%% Value = {byte(), byte(), byte()} | {byte(), byte(), byte(), byte()}
+%% Name = black | silver | gray | white | maroon | red | purple | fuchia | green | lime | olive | yellow | navy | blue | teal | aqua
%% @doc Creates a color reference.
-spec(color/1 :: (
- Value :: {byte(), byte(), byte()} | {byte(), byte(), byte(), byte()} | atom()) ->
- color()).
+ Value :: {byte(), byte(), byte()} | {byte(), byte(), byte(), byte()} | atom()) ->
+ color()).
color(Color) ->
egd_primitives:color(Color).
diff --git a/lib/percept/src/egd_font.erl b/lib/percept/src/egd_font.erl
index 2b2a89a0a9..5f0d56dd90 100644
--- a/lib/percept/src/egd_font.erl
+++ b/lib/percept/src/egd_font.erl
@@ -131,18 +131,18 @@ parse_glyph({Code,W,H,X0,Y0,Xm,Offset}, Bitmasks) ->
render_glyph(W, H, X0, Y0, Xm, Bitmask) ->
render_glyph(W,{0,H},X0,Y0,Xm,Bitmask, []).
render_glyph(_W, {H,H}, _X0, _Y0, _Xm, _Bitmask, Out) -> Out;
-render_glyph(W, {Hi,H}, X0, Y0,Xm, Bitmask, LSs) ->
+render_glyph(W, {Hi,H}, X0, Y0,Xm, Bitmask , LSs) ->
N = ((W+7) div 8),
O = N*Hi,
<<_:O/binary, Submask/binary>> = Bitmask,
- LS = render_glyph_horizontal(
+ LS = render_glyph_horizontal(
Submask, % line glyph bitmask
{down, W - 1}, % loop state
W - 1, % Width
[]), % Linespans
render_glyph(W,{Hi+1,H},X0,Y0,Xm, Bitmask, [LS|LSs]).
-render_glyph_horizontal(Value, {Pr, Px}, 0, Spans) ->
+render_glyph_horizontal(Value, {Pr, Px}, 0, Spans) ->
Cr = bit_spin(Value, 0),
case {Pr,Cr} of
{up , up } -> % closure of interval since its last
@@ -173,4 +173,3 @@ bit_spin(Value, Cx) ->
1 -> up;
0 -> down
end.
-
diff --git a/lib/percept/src/egd_png.erl b/lib/percept/src/egd_png.erl
index 3a0aaeef31..3a0aaeef31 100755..100644
--- a/lib/percept/src/egd_png.erl
+++ b/lib/percept/src/egd_png.erl
diff --git a/lib/percept/src/egd_primitives.erl b/lib/percept/src/egd_primitives.erl
index 245e0d48e2..77c600279f 100644
--- a/lib/percept/src/egd_primitives.erl
+++ b/lib/percept/src/egd_primitives.erl
@@ -28,6 +28,7 @@
pixel/3,
polygon/3,
line/4,
+ line/5,
arc/4,
arc/5,
rectangle/4,
@@ -50,7 +51,6 @@
-include("egd.hrl").
-
%% API info
info(I) ->
W = I#image.width, H = I#image.height,
@@ -75,13 +75,22 @@ object_info(O) ->
%% interface functions
line(I, Sp, Ep, Color) ->
- I#image{objects = [
+ I#image{ objects = [
#image_object{
type = line,
points = [Sp, Ep],
span = span([Sp, Ep]),
color = Color} | I#image.objects]}.
+line(I, Sp, Ep, Stroke, Color) ->
+ I#image{ objects = [
+ #image_object{
+ type = line,
+ points = [Sp, Ep],
+ span = span([Sp, Ep]),
+ internals = Stroke,
+ color = Color } | I#image.objects]}.
+
arc(I, {Sx,Sy} = Sp, {Ex,Ey} = Ep, Color) ->
X = Ex - Sx,
Y = Ey - Sy,
@@ -162,8 +171,6 @@ create(W, H) ->
#image{ width = W, height = H}.
-%color({crayon, Color}) -> rgba_byte2float(name_to_color({crayon, Color, 255}));
-%color({crayon, Color, A}) -> rgba_byte2float(name_to_color({crayon, Color, A}));
color(Color) when is_atom(Color) -> rgba_byte2float(name_to_color({Color, 255}));
color({Color, A}) when is_atom(Color) -> rgba_byte2float(name_to_color({Color, A}));
color({R,G,B}) -> rgba_byte2float({R,G,B, 255});
@@ -314,129 +321,6 @@ name_to_color({ slategray, A}) -> { 112, 128, 144, A};
name_to_color({ dimgray, A}) -> { 105, 105, 105, A};
name_to_color({ darkslategray, A}) -> { 47, 79, 79, A}.
-%% Crayons
-%name_to_color({crayon, mahogany, A}) -> { 205, 74, 74, A};
-%name_to_color({crayon, 'fuzzy wuzzy brown', A}) -> { 204, 102, 102, A};
-%name_to_color({crayon, chestnut, A}) -> { 188, 93, 88, A};
-%name_to_color({crayon, 'red orange', A}) -> { 255, 83, 73, A};
-%name_to_color({crayon, 'sunset orange', A}) -> { 253, 94, 83, A};
-%name_to_color({crayon, bittersweet, A}) -> { 253, 124, 110, A};
-%name_to_color({crayon, melon, A}) -> { 253, 188, 180, A};
-%name_to_color({crayon, 'outrageous orange', A}) -> { 255, 110, 74, A};
-%name_to_color({crayon, 'vivid tangerine', A}) -> { 255, 160, 137, A};
-%name_to_color({crayon, 'burnt sienna', A}) -> { 234, 126, 93, A};
-%name_to_color({crayon, brown, A}) -> { 180, 103, 77, A};
-%name_to_color({crayon, sepia, A}) -> { 165, 105, 79, A};
-%name_to_color({crayon, orange, A}) -> { 255, 117, 56, A};
-%name_to_color({crayon, 'burnt orange', A}) -> { 255, 127, 73, A};
-%name_to_color({crayon, copper, A}) -> { 221, 148, 117, A};
-%name_to_color({crayon, 'mango tango', A}) -> { 255, 130, 67, A};
-%name_to_color({crayon, 'atomic tangerine', A}) -> { 255, 164, 116, A};
-%name_to_color({crayon, beaver, A}) -> { 159, 129, 112, A};
-%name_to_color({crayon, 'antique brass', A}) -> { 205, 149, 117, A};
-%name_to_color({crayon, 'desert sand', A}) -> { 239, 205, 184, A};
-%name_to_color({crayon, 'raw sienna', A}) -> { 214, 138, 89, A};
-%name_to_color({crayon, tumbleweed, A}) -> { 222, 170, 136, A};
-%name_to_color({crayon, tan, A}) -> { 250, 167, 108, A};
-%name_to_color({crayon, peach, A}) -> { 255, 207, 171, A};
-%name_to_color({crayon, 'macaroni and cheese', A}) -> { 255, 189, 136, A};
-%name_to_color({crayon, apricot, A}) -> { 253, 217, 181, A};
-%name_to_color({crayon, 'neon carrot', A}) -> { 255, 163, 67, A};
-%name_to_color({crayon, almond, A}) -> { 239, 219, 197, A};
-%name_to_color({crayon, 'yellow orange', A}) -> { 255, 182, 83, A};
-%name_to_color({crayon, gold, A}) -> { 231, 198, 151, A};
-%name_to_color({crayon, shadow, A}) -> { 138, 121, 93, A};
-%name_to_color({crayon, 'banana mania', A}) -> { 250, 231, 181, A};
-%name_to_color({crayon, sunglow, A}) -> { 255, 207, 72, A};
-%name_to_color({crayon, goldenrod, A}) -> { 252, 217, 117, A};
-%name_to_color({crayon, dandelion, A}) -> { 253, 219, 109, A};
-%name_to_color({crayon, yellow, A}) -> { 252, 232, 131, A};
-%name_to_color({crayon, 'green yellow', A}) -> { 240, 232, 145, A};
-%name_to_color({crayon, 'spring green', A}) -> { 236, 234, 190, A};
-%name_to_color({crayon, 'olive green', A}) -> { 186, 184, 108, A};
-%name_to_color({crayon, 'laser lemon', A}) -> { 253, 252, 116, A};
-%name_to_color({crayon, 'unmellow yellow', A}) -> { 253, 252, 116, A};
-%name_to_color({crayon, canary, A}) -> { 255, 255, 153, A};
-%name_to_color({crayon, 'yellow green', A}) -> { 197, 227, 132, A};
-%name_to_color({crayon, 'inch worm', A}) -> { 178, 236, 93, A};
-%name_to_color({crayon, asparagus, A}) -> { 135, 169, 107, A};
-%name_to_color({crayon, 'granny smith apple', A}) -> { 168, 228, 160, A};
-%name_to_color({crayon, 'electric lime', A}) -> { 29, 249, 20, A};
-%name_to_color({crayon, 'screamin green', A}) -> { 118, 255, 122, A};
-%name_to_color({crayon, fern, A}) -> { 113, 188, 120, A};
-%name_to_color({crayon, 'forest green', A}) -> { 109, 174, 129, A};
-%name_to_color({crayon, 'sea green', A}) -> { 159, 226, 191, A};
-%name_to_color({crayon, green, A}) -> { 28, 172, 120, A};
-%name_to_color({crayon, 'mountain meadow', A}) -> { 48, 186, 143, A};
-%name_to_color({crayon, shamrock, A}) -> { 69, 206, 162, A};
-%name_to_color({crayon, 'jungle green', A}) -> { 59, 176, 143, A};
-%name_to_color({crayon, 'caribbean green', A}) -> { 28, 211, 162, A};
-%name_to_color({crayon, 'tropical rain forest', A}) -> { 23, 128, 109, A};
-%name_to_color({crayon, 'pine green', A}) -> { 21, 128, 120, A};
-%name_to_color({crayon, 'robin egg blue', A}) -> { 31, 206, 203, A};
-%name_to_color({crayon, aquamarine, A}) -> { 120, 219, 226, A};
-%name_to_color({crayon, 'turquoise blue', A}) -> { 119, 221, 231, A};
-%name_to_color({crayon, 'sky blue', A}) -> { 128, 218, 235, A};
-%name_to_color({crayon, 'outer space', A}) -> { 65, 74, 76, A};
-%name_to_color({crayon, 'blue green', A}) -> { 25, 158, 189, A};
-%name_to_color({crayon, 'pacific blue', A}) -> { 28, 169, 201, A};
-%name_to_color({crayon, cerulean, A}) -> { 29, 172, 214, A};
-%name_to_color({crayon, cornflower, A}) -> { 154, 206, 235, A};
-%name_to_color({crayon, 'midnight blue', A}) -> { 26, 72, 118, A};
-%name_to_color({crayon, 'navy blue', A}) -> { 25, 116, 210, A};
-%name_to_color({crayon, denim, A}) -> { 43, 108, 196, A};
-%name_to_color({crayon, blue, A}) -> { 31, 117, 254, A};
-%name_to_color({crayon, periwinkle, A}) -> { 197, 208, 230, A};
-%name_to_color({crayon, 'cadet blue', A}) -> { 176, 183, 198, A};
-%name_to_color({crayon, indigo, A}) -> { 93, 118, 203, A};
-%name_to_color({crayon, 'wild blue yonder', A}) -> { 162, 173, 208, A};
-%name_to_color({crayon, manatee, A}) -> { 151, 154, 170, A};
-%name_to_color({crayon, 'blue bell', A}) -> { 173, 173, 214, A};
-%name_to_color({crayon, 'blue violet', A}) -> { 115, 102, 189, A};
-%name_to_color({crayon, 'purple heart', A}) -> { 116, 66, 200, A};
-%name_to_color({crayon, 'royal purple', A}) -> { 120, 81, 169, A};
-%name_to_color({crayon, 'purple mountains majesty', A}) -> { 157, 129, 186, A};
-%name_to_color({crayon, violet, A}) -> { 146, 110, 174, A};
-%name_to_color({crayon, wisteria, A}) -> { 205, 164, 222, A};
-%name_to_color({crayon, 'vivid violet', A}) -> { 143, 80, 157, A};
-%name_to_color({crayon, fuchsia, A}) -> { 195, 100, 197, A};
-%name_to_color({crayon, 'shocking pink', A}) -> { 251, 126, 253, A};
-%name_to_color({crayon, 'pink flamingo', A}) -> { 252, 116, 253, A};
-%name_to_color({crayon, plum, A}) -> { 142, 69, 133, A};
-%name_to_color({crayon, 'hot magenta', A}) -> { 255, 29, 206, A};
-%name_to_color({crayon, 'purple pizzazz', A}) -> { 255, 29, 206, A};
-%name_to_color({crayon, 'razzle dazzle rose', A}) -> { 255, 72, 208, A};
-%name_to_color({crayon, orchid, A}) -> { 230, 168, 215, A};
-%name_to_color({crayon, 'red violet', A}) -> { 192, 68, 143, A};
-%name_to_color({crayon, eggplant, A}) -> { 110, 81, 96, A};
-%name_to_color({crayon, cerise, A}) -> { 221, 68, 146, A};
-%name_to_color({crayon, 'wild strawberry', A}) -> { 255, 67, 164, A};
-%name_to_color({crayon, magenta, A}) -> { 246, 100, 175, A};
-%name_to_color({crayon, lavender, A}) -> { 252, 180, 213, A};
-%name_to_color({crayon, 'cotton candy', A}) -> { 255, 188, 217, A};
-%name_to_color({crayon, 'violet red', A}) -> { 247, 83, 148, A};
-%name_to_color({crayon, 'carnation pink', A}) -> { 255, 170, 204, A};
-%name_to_color({crayon, razzmatazz, A}) -> { 227, 37, 107, A};
-%name_to_color({crayon, 'piggy pink', A}) -> { 253, 215, 228, A};
-%name_to_color({crayon, 'jazzberry jam', A}) -> { 202, 55, 103, A};
-%name_to_color({crayon, blush, A}) -> { 222, 93, 131, A};
-%name_to_color({crayon, 'tickle me pink', A}) -> { 252, 137, 172, A};
-%name_to_color({crayon, 'pink sherbet', A}) -> { 247, 128, 161, A};
-%name_to_color({crayon, maroon, A}) -> { 200, 56, 90, A};
-%name_to_color({crayon, red, A}) -> { 238, 32, 77, A};
-%name_to_color({crayon, 'radical red', A}) -> { 255, 73, 108, A};
-%name_to_color({crayon, mauvelous, A}) -> { 239, 152, 170, A};
-%name_to_color({crayon, 'wild watermelon', A}) -> { 252, 108, 133, A};
-%name_to_color({crayon, scarlet, A}) -> { 252, 40, 71, A};
-%name_to_color({crayon, salmon, A}) -> { 255, 155, 170, A};
-%name_to_color({crayon, 'brick red', A}) -> { 203, 65, 84, A};
-%name_to_color({crayon, white, A}) -> { 237, 237, 237, A};
-%name_to_color({crayon, timberwolf, A}) -> { 219, 215, 210, A};
-%name_to_color({crayon, silver, A}) -> { 205, 197, 194, A};
-%name_to_color({crayon, gray, A}) -> { 149, 145, 140, A};
-%name_to_color({crayon, black, A}) -> { 35, 35, 35, A}.
-
-
text(I, {Xs,Ys} = Sp, Font, Text, Color) ->
{FW,FH} = egd_font:size(Font),
Length = length(Text),
diff --git a/lib/percept/src/egd_render.erl b/lib/percept/src/egd_render.erl
index f5e32c2a0f..cea9d2d926 100644
--- a/lib/percept/src/egd_render.erl
+++ b/lib/percept/src/egd_render.erl
@@ -35,7 +35,7 @@ binary(Image, Type) ->
parallel_binary(precompile(Image),Type).
parallel_binary(Image = #image{ height = Height },Type) ->
- case lists:min([erlang:system_info(schedulers), Height]) of
+ case erlang:min(erlang:system_info(schedulers), Height) of
1 ->
% if the height or the number of schedulers is 1
% do the scanlines in this process.
@@ -120,27 +120,15 @@ receive_binaries(H, Bins) when H > 0 ->
scanline(Y, Os, {_,_,Width,_}=LSB, Type) ->
- OLSs = parse_objects_on_line(Y-1, Width, Os),
- URLSs = resulting_line_spans([LSB|OLSs],Type),
-
- % FIXME: Can we keep the list sorted instead of sorting it?
- % sort descending
- RLSs = lists:reverse(URLSs),
-
- resulting_scanline(RLSs,Width).
-
-resulting_scanline(RLSs, Width) -> resulting_scanline(RLSs, Width, []).
-resulting_scanline([], _, Scanlines) -> Scanlines;
-resulting_scanline([{_,Xl, Xr, C} | RLSs], Width, Scanlines) ->
- {R,G,B,_} = rgb_float2byte(C),
- Scanline = lists:duplicate(trunc(Xr - Xl + 1), <<R:8,G:8,B:8>>),
- resulting_scanline(RLSs, Width, [Scanline|Scanlines]).
+ OLSs = parse_objects_on_line(Y-1, Width, Os),
+ RLSs = resulting_line_spans([LSB|OLSs],Type),
+ [ lists:duplicate(Xr - Xl + 1, <<(trunc(R*255)):8,(trunc(G*255)):8,(trunc(B*255)):8>>) || {_,Xl, Xr, {R,G,B,_}} <- RLSs ].
resulting_line_spans(LSs,Type) ->
%% Build a list of "transitions" from left to right.
Trans = line_spans_to_trans(LSs),
%% Convert list of "transitions" to linespans.
- trans_to_line_spans(Trans,Type).
+ trans_to_line_spans(Trans,Type).
line_spans_to_trans(LSs) ->
line_spans_to_trans(LSs,[],0).
@@ -194,19 +182,14 @@ color([{_,C}|_],opaque) -> C;
color(Layers,alpha) -> color1({0,0,0,0},Layers).
color1(Color,[]) -> Color;
-color1(Color,[{_,C}|Layers]) -> color1(blend(Color,C),Layers).
-
-blend(C1,C2) -> alpha_blend(C1,C2).
+color1(Color,[{_,C}|Layers]) -> color1(alpha_blend(Color,C),Layers).
modify_layers(Layers,[]) -> Layers;
-modify_layers(Layers,[{{_,Z,Op},C}|Trans]) ->
- modify_layers(case Op of
- start ->
- add_layer(Layers,Z,C);
- stop ->
- remove_layer(Layers,Z,C)
- end,
- Trans).
+modify_layers(Layers,[{{_,Z,start},C}|Trans]) ->
+ modify_layers(add_layer(Layers, Z, C), Trans);
+modify_layers(Layers,[{{_,Z,stop },C}|Trans]) ->
+ modify_layers(remove_layer(Layers, Z, C), Trans).
+
add_layer([{Z1,_}=H|Layers],Z,C) when Z1 > Z ->
[H|add_layer(Layers,Z,C)];
@@ -216,7 +199,7 @@ add_layer(Layers,Z,C) ->
remove_layer(Layers,Z,C) ->
Layers -- [{Z,C}].
-alpha_blend({R1,G1,B1,A1}, {R2,G2,B2,A2}) ->
+alpha_blend({R1,G1,B1,A1}, {R2,G2,B2,A2}) when is_float(A1), is_float(A2)->
Beta = A2*(1.0 - A1),
A = A1 + Beta,
R = R1*A1 + R2*Beta,
@@ -232,7 +215,7 @@ parse_objects_on_line(Y, Z, Width, [O|Os], Out) ->
false ->
parse_objects_on_line(Y, Z + 1, Width, Os, Out);
true ->
- OLs = object_line_data(Y, Z, O),
+ OLs = object_line_data(Y, Z, O),
TOLs = trim_object_line_data(OLs, Width),
parse_objects_on_line(Y, Z + 1, Width, Os, [TOLs|Out])
end.
@@ -240,15 +223,13 @@ parse_objects_on_line(Y, Z, Width, [O|Os], Out) ->
trim_object_line_data(OLs, Width) ->
trim_object_line_data(OLs, Width, []).
trim_object_line_data([], _, Out) -> Out;
+
+trim_object_line_data([{_, Xl, _, _}|OLs], Width, Out) when Xl > Width ->
+ trim_object_line_data(OLs, Width, Out);
+trim_object_line_data([{_, _, Xr, _}|OLs], Width, Out) when Xr < 0 ->
+ trim_object_line_data(OLs, Width, Out);
trim_object_line_data([{Z, Xl, Xr, C}|OLs], Width, Out) ->
- if
- Xl > Width ->
- trim_object_line_data(OLs, Width, Out);
- Xr < 0 ->
- trim_object_line_data(OLs, Width, Out);
- true ->
- trim_object_line_data(OLs, Width, [{Z, lists:max([0,Xl]), lists:min([Xr,Width]), C}|Out])
- end.
+ trim_object_line_data(OLs, Width, [{Z, erlang:max(0,Xl), erlang:min(Xr,Width), C}|Out]).
% object_line_data
% In:
@@ -264,7 +245,8 @@ trim_object_line_data([{Z, Xl, Xr, C}|OLs], Width, Out) ->
% Calculate the length (start and finish index) of an objects horizontal
% line given the height index.
-object_line_data(Y, Z, Object) -> object_line_data(Y, Z, Object, Object#image_object.type).
+object_line_data(Y, Z, Object) ->
+ object_line_data(Y, Z, Object, Object#image_object.type).
object_line_data(Y, Z, #image_object{ span = {X0, Y0, X1, Y1}, color = C}, rectangle) ->
if
Y0 =:= Y ; Y1 =:= Y ->
@@ -277,70 +259,43 @@ object_line_data(Y, Z, #image_object{ span = {X0, Y0, X1, Y1}, color = C}, recta
object_line_data(_Y, Z, #image_object{ span = {X0, _, X1, _}, color = C}, filled_rectangle) ->
[{Z, X0, X1, C}];
-object_line_data(Y, Z, #image_object{ span = {X0,Y0,X1,Y1}, color = C}, filled_ellipse) ->
+object_line_data(Y, Z, #image_object{ internals={Xr,Yr,Yr2}, span = {X0,Y0,X1,Y1}, color = C}, filled_ellipse) ->
if
- X1 - X0 == 0 -> % if the width is exactly one pixel
- [{Z, X1, X0, C}];
- X1 - X0 < 0 -> throw(bad_ellipse_width);
- Y1 - Y0 == 0 -> % Height exactly one pixel, get width
+ X1 - X0 == 0; Y1 - Y0 == 0 ->
[{Z, X0, X1, C}];
true ->
- Xr = (X1 - X0)/2,
- Yr = (Y1 - Y0)/2,
- Yo = trunc(Y - Y0 - Yr),
+ Yo = trunc(Y - Y0 - Yr),
Yo2 = Yo*Yo,
- Yr2 = Yr*Yr,
- Xo = math:sqrt((1 - Yo2/Yr2))*Xr,
+ Xo = math:sqrt((1 - Yo2/Yr2))*Xr,
[{Z, round(X0 - Xo + Xr), round(X0 + Xo + Xr), C}]
end;
object_line_data(Y, Z, #image_object{ intervals = Is, color = C}, filled_triangle) ->
- case lists:keysearch(Y, 1, Is) of
- {value, {Y, Xl, Xr}} -> [{Z, Xl, Xr, C}];
+ case lists:keyfind(Y, 1, Is) of
+ {Y, Xl, Xr} -> [{Z, Xl, Xr, C}];
false -> []
end;
object_line_data(Y, Z, #image_object{ intervals = Is, color = C}, line) ->
case dict:find(Y, Is) of
- %{ok, {Xl, Xr}} -> [{Z, Xl, Xr, C}];
{ok, Ls} -> [{Z, Xl, Xr, C}||{Xl,Xr} <- Ls];
_ -> []
end;
-object_line_data(Y, Z, O, polygon) ->
- Is = lists:filter(
- fun({Yp,_,_}) ->
- if Yp == Y -> true; true -> false end
- end, O#image_object.intervals),
- [ {Z, Xl, Xr, O#image_object.color} || {_, Xl, Xr} <- Is];
-
-object_line_data(Y, Z, #image_object{ color = C, intervals = Is }, text_horizontal) ->
- % FIXME: optimize!
- lists:foldl(
- fun ({Yg,Xl,Xr}, Out) ->
- if
- Yg == Y ->
- [{Z, Xl, Xr, C}|Out];
- true ->
- Out
- end
- end, [], Is);
+object_line_data(Y, Z, #image_object{ color = C, intervals = Is}, polygon) ->
+ [{Z, Xl, Xr, C} || {Yp, Xl, Xr} <- Is, Yp =:= Y];
+
+object_line_data(Y, Z, #image_object{ color = C, intervals = Is}, text_horizontal) ->
+ [{Z, Xl, Xr, C} || {Yg, Xl, Xr} <- Is, Yg =:= Y];
+
object_line_data(_, Z, #image_object{ span = {X0,_,X1,_}, color = C}, _) ->
- % faked
[{Z, X0, X1, C}].
-is_object_on_line(Y, Object) ->
- is_object_bounds_on_line(Y, Object#image_object.span).
+is_object_on_line(Y, #image_object{ span = Span }) ->
+ is_object_bounds_on_line(Y, Span).
-is_object_bounds_on_line(Y, {_,Y0,_,Y1}) ->
- if
- Y < Y0 -> false;
- Y > Y1 -> false;
- true -> true
- end.
-
-rgb_float2byte({R,G,B,A}) ->
- {trunc(R*255), trunc(G*255), trunc(B*255), trunc(A*255)}.
+is_object_bounds_on_line(Y, {_,Y0,_,Y1}) when Y < Y0 ; Y > Y1 -> false;
+is_object_bounds_on_line(_, _) -> true.
%%% primitives to line_spans
@@ -360,6 +315,12 @@ precompile_objects([O = #image_object{ type = filled_triangle, points = [P0,P1,P
precompile_objects([O = #image_object{ type = polygon, points = Pts } | Os], Out) ->
precompile_objects(Os, [O#image_object{ intervals = polygon_ls(Pts) } | Out]);
+
+precompile_objects([O = #image_object{ type = filled_ellipse, span = {X0,Y0,X1,Y1} } | Os], Out) ->
+ Xr = (X1 - X0)/2,
+ Yr = (Y1 - Y0)/2,
+ Yr2 = Yr*Yr,
+ precompile_objects(Os, [ O#image_object{ internals={Xr,Yr,Yr2} } | Out]);
precompile_objects([O = #image_object{ type = arc, points = [P0,P1], internals = D }| Os], Out) ->
Es = egd_primitives:arc_to_edges(P0, P1, D),
@@ -579,13 +540,7 @@ line_ls({Xi0, Yi0},{Xi1,Yi1}) ->
true -> 1;
false -> -1
end,
- case Steep of
- false ->
- line_ls_step_not_steep({X0, X1},Y0, DX, DY, Ystep, Error, X0, []);
- true ->
- line_ls_step_steep({X0, X1},Y0, DX, DY, Ystep, Error, X0, [])
- end.
-
+ line_ls_step(X0, X1,Y0, DX, DY, Ystep, Error, X0, Steep, []).
%% line_ls_step_(not)_steep
%% In:
@@ -594,27 +549,17 @@ line_ls({Xi0, Yi0},{Xi1,Yi1}) ->
%% Purpose:
%% Produce an line_interval for each Yi (Y index)
-% Iterating the X-axis
-
-line_ls_step_not_steep({X,X1},Y,Dx,Dy,Ys,E, X0, LSs) when X < X1 ->
- case E >= 0 of
- true ->
- line_ls_step_not_steep({X+1,X1},Y+Ys,Dx,Dy,Ys, E - Dx + Dy, X+1,[{Y,X0,X}|LSs]);
- false ->
- line_ls_step_not_steep({X+1,X1},Y,Dx,Dy,Ys, E + Dy, X0, LSs)
- end;
-line_ls_step_not_steep({X,_},Y,_Dx,_Dy,_Ystep,_E,X0,LSs) ->
- [{Y,X0,X}|LSs].
-
-% Iterating the Y-axis
-line_ls_step_steep({X,X1},Y,Dx,Dy,Ystep,E, X0, LSs) when X =< X1 ->
- case E >= 0 of
- true ->
- line_ls_step_steep({X + 1,X1},Y+Ystep,Dx,Dy,Ystep,E - Dx + Dy,X,[{X,Y,Y}|LSs]);
- false ->
- line_ls_step_steep({X + 1,X1},Y,Dx,Dy,Ystep,E + Dy,X0, [{X,Y,Y}|LSs])
- end;
-line_ls_step_steep({_X,_},_Y,_Dx,_Dy,_Ystep,_E,_X0,LSs) ->
+line_ls_step(X, X1, Y, Dx, Dy, Ys, E, X0, false = Steep, LSs) when X < X1, E >= 0 ->
+ line_ls_step(X+1,X1,Y+Ys,Dx,Dy,Ys, E - Dx + Dy, X+1, Steep, [{Y,X0,X}|LSs]);
+line_ls_step(X, X1, Y, Dx, Dy, Ys, E, X0, false = Steep, LSs) when X < X1 ->
+ line_ls_step(X+1,X1,Y,Dx,Dy,Ys, E + Dy, X0, Steep, LSs);
+line_ls_step(X, _X1, Y, _Dx, _Dy, _Ys, _E, X0, false, LSs) ->
+ [{Y,X0,X}|LSs];
+line_ls_step(X, X1, Y, Dx, Dy, Ys, E, _X0, true = Steep, LSs) when X =< X1, E >= 0 ->
+ line_ls_step(X+1,X1,Y+Ys,Dx,Dy,Ys, E - Dx + Dy, X, Steep, [{X,Y,Y}|LSs]);
+line_ls_step(X, X1, Y, Dx, Dy, Ys, E, X0, true = Steep, LSs) when X =< X1 ->
+ line_ls_step(X+1,X1,Y,Dx,Dy,Ys,E + Dy, X0, Steep, [{X,Y,Y}|LSs]);
+line_ls_step(_X,_,_Y,_Dx,_Dy,_Ys,_E,_X0,_,LSs) ->
LSs.
% Text
@@ -707,3 +652,4 @@ eps_header(W,H) ->
eps_footer() ->
"%%EOF\n".
+
diff --git a/lib/percept/test/egd_SUITE.erl b/lib/percept/test/egd_SUITE.erl
index 603ad628d3..a2595400dd 100644
--- a/lib/percept/test/egd_SUITE.erl
+++ b/lib/percept/test/egd_SUITE.erl
@@ -29,6 +29,7 @@
-export([
image_create_and_destroy/1,
image_shape/1,
+ image_primitives/1,
image_colors/1,
image_font/1,
image_png_compliant/1
@@ -38,8 +39,7 @@
-define(default_timeout, ?t:minutes(1)).
init_per_suite(Config) when is_list(Config) ->
- {A1,A2,A3} = now(),
- random:seed(A1, A2, A3),
+ random:seed(now()),
Config.
end_per_suite(Config) when is_list(Config) ->
@@ -59,6 +59,7 @@ all(suite) ->
[
image_create_and_destroy,
image_shape,
+ image_primitives,
image_colors,
image_font,
image_png_compliant
@@ -145,7 +146,43 @@ image_shape(Config) when is_list(Config) ->
?line ok = egd:destroy(Im),
erase(image_size),
ok.
-
+
+image_primitives(suite) ->
+ [];
+image_primitives(doc) ->
+ ["Image shape api test."];
+image_primitives(Config) when is_list(Config) ->
+ {W,H} = get_size(?config(max_size, Config)),
+ put(image_size, {W,H}),
+
+ ?line Im0 = egd_primitives:create(W, H),
+ ?line Fgc = egd:color({25,25,255}),
+ ?line Bgc = egd:color({0,250,25}),
+
+ ?line Im1 = lists:foldl(fun
+ ({Function, Arguments}, Im) ->
+ ?line erlang:apply(egd_primitives, Function, [Im|Arguments])
+ end, Im0,
+ [{Fs, [get_point(), get_point(), Bgc]} || Fs <- [line, rectangle, filledEllipse, arc]] ++
+ [{pixel, [get_point(), Bgc]},
+ {filledTriangle, [get_point(), get_point(), get_point(), Bgc]}]),
+
+ Pt1 = get_point(),
+ Pt2 = get_point(),
+
+ ?line Im2 = egd_primitives:filledRectangle(Im1, Pt1, Pt2, Fgc),
+
+ ?line Bitmap = egd_render:binary(Im2, opaque),
+
+ ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc),
+ ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc),
+
+ erase(image_size),
+ ok.
+
+
+
+
image_font(suite) ->
[];
image_font(doc) ->
diff --git a/lib/stdlib/doc/src/gen_fsm.xml b/lib/stdlib/doc/src/gen_fsm.xml
index f5d8b9bb48..739cd0bffd 100644
--- a/lib/stdlib/doc/src/gen_fsm.xml
+++ b/lib/stdlib/doc/src/gen_fsm.xml
@@ -729,6 +729,36 @@ gen_fsm:sync_send_all_state_event -----> Module:handle_sync_event/4
updated internal data.</p>
</desc>
</func>
+ <func>
+ <name>Module:format_status(normal, [PDict, StateData]) -> Status</name>
+ <fsummary>Optional function for providing a term describing the
+ current gen_fsm status.</fsummary>
+ <type>
+ <v>PDict = [{Key, Value}]</v>
+ <v>StateData = term()</v>
+ <v>Status = [term()]</v>
+ </type>
+ <desc>
+ <p><em>This callback is optional, so callback modules need not
+ export it. The gen_fsm module provides a default
+ implementation of this function that returns the callback
+ module state data.</em></p>
+ <p>This function is called by a gen_fsm process when one
+ of <seealso marker="sys#get_status/1">sys:get_status/1,2</seealso>
+ is invoked to get the gen_fsm status. A callback module
+ wishing to customise the <c>sys:get_status/1,2</c> return
+ value exports an instance of <c>format_status/2</c> that
+ returns a term describing the current status of the
+ gen_fsm.</p>
+ <p><c>PDict</c> is the current value of the gen_fsm's
+ process dictionary.</p>
+ <p><c>StateData</c> is the internal state data of the
+ gen_fsm.</p>
+ <p>The function should return <c>Status</c>, a list of one or
+ more terms that customise the details of the current state
+ and status of the gen_fsm.</p>
+ </desc>
+ </func>
</funcs>
<section>
diff --git a/lib/stdlib/doc/src/gen_server.xml b/lib/stdlib/doc/src/gen_server.xml
index 8496802259..30c04d1d52 100644
--- a/lib/stdlib/doc/src/gen_server.xml
+++ b/lib/stdlib/doc/src/gen_server.xml
@@ -598,6 +598,35 @@ gen_server:abcast -----> Module:handle_cast/2
<p>The function should return the updated internal state.</p>
</desc>
</func>
+ <func>
+ <name>Module:format_status(normal, [PDict, State]) -> Status</name>
+ <fsummary>Optional function for providing a term describing the
+ current gen_server status.</fsummary>
+ <type>
+ <v>PDict = [{Key, Value}]</v>
+ <v>State = term()</v>
+ <v>Status = [term()]</v>
+ </type>
+ <desc>
+ <p><em>This callback is optional, so callback modules need not
+ export it. The gen_server module provides a default
+ implementation of this function that returns the callback
+ module state.</em></p>
+ <p>This function is called by a gen_server process when one
+ of <seealso marker="sys#get_status/1">sys:get_status/1,2</seealso>
+ is invoked to get the gen_server status. A callback module
+ wishing to customise the <c>sys:get_status/1,2</c> return
+ value exports an instance of <c>format_status/2</c> that
+ returns a term describing the current status of the
+ gen_server.</p>
+ <p><c>PDict</c> is the current value of the gen_server's
+ process dictionary.</p>
+ <p><c>State</c> is the internal state of the gen_server.</p>
+ <p>The function should return <c>Status</c>, a list of one or
+ more terms that customise the details of the current state
+ and status of the gen_server.</p>
+ </desc>
+ </func>
</funcs>
<section>
diff --git a/lib/stdlib/doc/src/sys.xml b/lib/stdlib/doc/src/sys.xml
index a395a8a415..10ead62073 100644
--- a/lib/stdlib/doc/src/sys.xml
+++ b/lib/stdlib/doc/src/sys.xml
@@ -4,23 +4,21 @@
<erlref>
<header>
<copyright>
- <year>1996</year>
- <year>2007</year>
- <holder>Ericsson AB, All Rights Reserved</holder>
+ <year>1996</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
- The contents of this file are subject to the Erlang Public License,
- Version 1.1, (the "License"); you may not use this file except in
- compliance with the License. You should have received a copy of the
- Erlang Public License along with this software. If not, it can be
- retrieved online at http://www.erlang.org/.
-
- Software distributed under the License is distributed on an "AS IS"
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- the License for the specific language governing rights and limitations
- under the License.
-
- The Initial Developer of the Original Code is Ericsson AB.
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
</legalnotice>
<title>sys</title>
@@ -237,6 +235,17 @@
</type>
<desc>
<p>Gets the status of the process.</p>
+ <p>The value of <c>Misc</c> varies for different types of
+ processes. For example, a <c>gen_server</c> process returns
+ the callback module's state, and a <c>gen_fsm</c> process
+ returns information such as its current state name. Callback
+ modules for <c>gen_server</c> and <c>gen_fsm</c> can also
+ customise the value of <c>Misc</c> by exporting
+ a <c>format_status/2</c> function that contributes
+ module-specific information;
+ see <seealso marker="gen_server#format_status/2">gen_server:format_status/2</seealso>
+ and <seealso marker="gen_fsm#format_status/2">gen_fsm:format_status/2</seealso>
+ for more details.</p>
</desc>
</func>
<func>
diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl
index f3775f967a..ba0275ae2b 100644
--- a/lib/stdlib/src/gen_fsm.erl
+++ b/lib/stdlib/src/gen_fsm.erl
@@ -603,7 +603,12 @@ get_msg(Msg) -> Msg.
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, Debug, [Name, StateName, StateData, Mod, _Time]] =
StatusData,
- Header = lists:concat(["Status for state machine ", Name]),
+ NameTag = if is_pid(Name) ->
+ pid_to_list(Name);
+ is_atom(Name) ->
+ Name
+ end,
+ Header = lists:concat(["Status for state machine ", NameTag]),
Log = sys:get_debug(log, Debug, []),
Specfic =
case erlang:function_exported(Mod, format_status, 2) of
diff --git a/lib/stdlib/src/sys.erl b/lib/stdlib/src/sys.erl
index e0f2dbcd3c..12209c16d7 100644
--- a/lib/stdlib/src/sys.erl
+++ b/lib/stdlib/src/sys.erl
@@ -245,8 +245,17 @@ do_cmd(SysState, Other, _Parent, _Mod, Debug, Misc) ->
{SysState, {error, {unknown_system_msg, Other}}, Debug, Misc}.
get_status(SysState, Parent, Mod, Debug, Misc) ->
+ PDict = get(),
+ FmtMisc =
+ case erlang:function_exported(Mod, format_status, 2) of
+ true ->
+ FmtArgs = [PDict, SysState, Parent, Debug, Misc],
+ Mod:format_status(normal, FmtArgs);
+ _ ->
+ Misc
+ end,
{status, self(), {module, Mod},
- [get(), SysState, Parent, Debug, Misc]}.
+ [PDict, SysState, Parent, Debug, FmtMisc]}.
%%-----------------------------------------------------------------
%% These are the system debug commands.
diff --git a/lib/stdlib/test/gen_fsm_SUITE.erl b/lib/stdlib/test/gen_fsm_SUITE.erl
index 62f8b2f9dd..23c1d9a193 100644
--- a/lib/stdlib/test/gen_fsm_SUITE.erl
+++ b/lib/stdlib/test/gen_fsm_SUITE.erl
@@ -30,7 +30,7 @@
-export([shutdown/1]).
--export([sys/1, sys1/1]).
+-export([sys/1, sys1/1, call_format_status/1]).
-export([hibernate/1,hiber_idle/3,hiber_wakeup/3,hiber_idle/2,hiber_wakeup/2]).
@@ -42,7 +42,7 @@
% The gen_fsm behaviour
-export([init/1, handle_event/3, handle_sync_event/4, terminate/3,
- handle_info/3]).
+ handle_info/3, format_status/2]).
-export([idle/2, idle/3,
timeout/2,
wfor_conf/2, wfor_conf/3,
@@ -305,7 +305,7 @@ shutdown(Config) when is_list(Config) ->
ok.
-sys(suite) -> [sys1].
+sys(suite) -> [sys1, call_format_status].
sys1(Config) when is_list(Config) ->
?line {ok, Pid} =
@@ -317,6 +317,13 @@ sys1(Config) when is_list(Config) ->
?line sys:resume(Pid),
?line stop_it(Pid).
+call_format_status(Config) when is_list(Config) ->
+ ?line {ok, Pid} = gen_fsm:start(gen_fsm_SUITE, [], []),
+ ?line Status = sys:get_status(Pid),
+ ?line {status, Pid, _Mod, [_PDict, running, _Parent, _, Data]} = Status,
+ ?line [format_status_called | _] = lists:reverse(Data),
+ ?line stop_it(Pid).
+
%% Hibernation
hibernate(suite) -> [];
@@ -836,3 +843,6 @@ handle_sync_event(stop_shutdown_reason, _From, _State, Data) ->
{stop, {shutdown,reason}, {shutdown,reason}, Data};
handle_sync_event({get, _Pid}, _From, State, Data) ->
{reply, {state, State, Data}, State, Data}.
+
+format_status(_Opt, [_Pdict, _StateData]) ->
+ [format_status_called].
diff --git a/lib/stdlib/test/gen_server_SUITE.erl b/lib/stdlib/test/gen_server_SUITE.erl
index 86a5a65ba3..6efdce78a1 100644
--- a/lib/stdlib/test/gen_server_SUITE.erl
+++ b/lib/stdlib/test/gen_server_SUITE.erl
@@ -30,7 +30,7 @@
call_remote_n1/1, call_remote_n2/1, call_remote_n3/1, spec_init/1,
spec_init_local_registered_parent/1,
spec_init_global_registered_parent/1,
- otp_5854/1, hibernate/1, otp_7669/1
+ otp_5854/1, hibernate/1, otp_7669/1, call_format_status/1
]).
% spawn export
@@ -42,7 +42,7 @@
% The gen_server behaviour
-export([init/1, handle_call/3, handle_cast/2,
- handle_info/2, terminate/2]).
+ handle_info/2, terminate/2, format_status/2]).
all(suite) ->
[start, crash, call, cast, cast_fast, info,
@@ -51,7 +51,7 @@ all(suite) ->
call_remote_n2, call_remote_n3, spec_init,
spec_init_local_registered_parent,
spec_init_global_registered_parent,
- otp_5854,hibernate,otp_7669].
+ otp_5854, hibernate, otp_7669, call_format_status].
-define(default_timeout, ?t:minutes(1)).
@@ -851,7 +851,7 @@ otp_5854(Config) when is_list(Config) ->
ok.
%% If initialization fails (with ignore or {stop,Reason}),
-%% make sure that the process is not registered when gen_sever:start()
+%% make sure that the process is not registered when gen_server:start()
%% returns.
otp_7669(Config) when is_list(Config) ->
@@ -887,6 +887,24 @@ do_otp_7669_stop() ->
?MODULE, stop, []),
?line undefined = global:whereis_name(?MODULE).
+%% Verify that sys:get_status correctly calls our format_status/2 fun
+%%
+call_format_status(suite) ->
+ [];
+call_format_status(doc) ->
+ ["Test that sys:get_status/1,2 calls format_status/2"];
+call_format_status(Config) when is_list(Config) ->
+ ?line {ok, Pid} = gen_server:start_link({local, call_format_status},
+ gen_server_SUITE, [], []),
+ ?line Status1 = sys:get_status(call_format_status),
+ ?line {status, Pid, _Mod, [_PDict, running, _Parent, _, Data1]} = Status1,
+ ?line [format_status_called | _] = lists:reverse(Data1),
+ ?line Status2 = sys:get_status(call_format_status, 5000),
+ ?line {status, Pid, _Mod, [_PDict, running, _Parent, _, Data2]} = Status2,
+ ?line [format_status_called | _] = lists:reverse(Data2),
+ ok.
+
+
%%--------------------------------------------------------------
%% Help functions to spec_init_*
start_link(Init, Options) ->
@@ -1046,4 +1064,5 @@ terminate({From, stopped_info}, _State) ->
terminate(_Reason, _State) ->
ok.
-
+format_status(_Opt, [_PDict, _State]) ->
+ [format_status_called].