backporting uart_i and cli

This commit is contained in:
bg 2009-07-29 09:49:57 +00:00
parent 7f4bda01ca
commit 52ec168ece
126 changed files with 3868 additions and 1274 deletions

View File

@ -0,0 +1,453 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="uC-Crypto-logo+text.svg"
height="60.0000000"
sodipodi:version="0.32"
width="60.0000000"
_SVGFile__filename="scalable/apps/kgpg.svg"
version="1.0"
y="0"
x="0"
inkscape:version="0.46"
id="svg1"
sodipodi:docbase="/home/bg/workspace/micro-crypt"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/bg/workspace/micro-crypt/uC-Crypto-logo.png"
inkscape:export-xdpi="299.73813"
inkscape:export-ydpi="299.73813">
<sodipodi:namedview
bordercolor="#666666"
inkscape:pageshadow="2"
inkscape:window-y="-1"
pagecolor="#ffffff"
inkscape:window-height="580"
inkscape:zoom="1.7366334"
inkscape:window-x="1"
borderopacity="1.0"
inkscape:cx="179.69675"
inkscape:cy="27.879071"
inkscape:window-width="1022"
inkscape:pageopacity="0.0"
id="base"
inkscape:current-layer="svg1"
showgrid="false" />
<defs
id="defs3">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 30 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="60 : 30 : 1"
inkscape:persp3d-origin="30 : 20 : 1"
id="perspective37" />
</defs>
<g
id="g1554"
transform="translate(0.230915,-0.235226)"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160">
<path
sodipodi:nodetypes="ccc"
style="font-size:12.000000;fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#333333;stroke-width:5.0000000;stroke-miterlimit:4.0000000;"
d="M 12.986483,29.403286 C 15.818301,17.671464 20.875121,5.3328238 31.191034,5.5350970 C 41.304673,5.5350974 45.147854,18.885102 47.372855,29.605558"
sodipodi:stroke-cmyk="(0 0 0 0.8)"
id="path612" />
<path
style="font-size:12.000000;fill:#cccccc;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#333333;stroke-width:3.1250000;stroke-linejoin:round;"
d="M 9.8122082,28.265654 C 8.7042082,28.265654 7.8122082,29.157654 7.8122082,30.265654 L 7.8122082,53.817583 C 7.8122082,54.925583 8.7042082,55.817583 9.8122082,55.817583 L 50.547129,55.817583 C 51.655129,55.817583 52.547129,54.925583 52.547129,53.817583 L 52.547129,30.265654 C 52.547129,29.157654 51.655129,28.265654 50.547129,28.265654 L 9.8122082,28.265654 z "
id="rect611" />
</g>
<metadata
id="metadata6">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:title>Part of the Flat Icon Collection (Thu Aug 26 14:31:40 2004)</dc:title>
<dc:description />
<dc:subject>
<rdf:Bag>
<rdf:li />
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent
rdf:about="">
<dc:title />
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent
rdf:about="">
<dc:title>Danny Allen</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent
rdf:about="">
<dc:title>Danny Allen</dc:title>
</cc:Agent>
</dc:rights>
<dc:date />
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://creativecommons.org/licenses/LGPL/2.1/">
<dc:date />
</cc:license>
<dc:language>en</dc:language>
</cc:Work>
</rdf:RDF>
</metadata>
<rect
height="2.550113"
width="1.1182215"
id="rect4208"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958729"
x="22.392134"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4210"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958696"
x="25.205595"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4212"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958729"
x="28.039183"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4214"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958729"
x="30.862715"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4216"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="30.059542"
x="33.676201"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<a
id="a2680"
transform="matrix(1.0764385,0,0,1.0764386,-3.9678317,-2.8218674)"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160">
<rect
x="22.957844"
y="-49.865311"
ry="0.50752664"
style="fill:#c0c0c0;fill-opacity:0;stroke:#000000;stroke-width:0.26633105;stroke-opacity:1"
rx="0.60646188"
id="rect4218"
width="16.989586"
transform="scale(1,-1)"
height="16.91943" />
</a>
<rect
height="2.550113"
width="1.1182215"
id="rect4220"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958696"
x="36.489658"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4222"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136734"
x="-46.626415"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4224"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-35.312218"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4226"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-38.135746"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4228"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-40.959274"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4230"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-43.782803"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4232"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-49.429836"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4234"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.13517"
x="22.412243"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4236"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.135139"
x="25.225708"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4238"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.13517"
x="28.059299"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4240"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.13517"
x="30.88283"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4242"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.135139"
x="33.686245"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.550113"
width="1.1182215"
id="rect4244"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.135139"
x="36.509773"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4246"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313171"
x="-46.626415"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4248"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-35.312218"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4250"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-38.135746"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4252"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-40.959274"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4254"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-43.782803"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4256"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-49.429836"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160" />
<text
xml:space="preserve"
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans Mono"
x="22.675781"
y="45.092186"
id="text2683"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160"><tspan
sodipodi:role="line"
id="tspan2685"
x="22.675781"
y="45.092186">µC</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Sans"
x="65.350945"
y="47.988457"
id="text2410"
inkscape:export-filename="/home/bg/workspace/micro-crypt/logo+text.png"
inkscape:export-xdpi="160"
inkscape:export-ydpi="160"><tspan
sodipodi:role="line"
id="tspan2412"
x="65.350945"
y="47.988457">AVR-Crypto-Lib</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

350
AVR-Crypto-Lib-logo.svg Normal file
View File

@ -0,0 +1,350 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="uC-Crypto-logo.svg"
height="60.0000000"
sodipodi:version="0.32"
width="60.0000000"
_SVGFile__filename="scalable/apps/kgpg.svg"
version="1.0"
y="0"
x="0"
inkscape:version="0.45.1"
id="svg1"
sodipodi:docbase="/home/bg/workspace/micro-crypt"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/bg/workspace/micro-crypt/uC-Crypto-logo.png"
inkscape:export-xdpi="299.73813"
inkscape:export-ydpi="299.73813">
<sodipodi:namedview
bordercolor="#666666"
inkscape:pageshadow="2"
inkscape:window-y="0"
pagecolor="#ffffff"
inkscape:window-height="580"
inkscape:zoom="4.9119411"
inkscape:window-x="0"
borderopacity="1.0"
inkscape:cx="33.667126"
inkscape:cy="27.879071"
inkscape:window-width="1022"
inkscape:pageopacity="0.0"
id="base"
inkscape:current-layer="svg1" />
<defs
id="defs3" />
<g
id="g1554"
transform="translate(0.230915,-0.235226)">
<path
sodipodi:nodetypes="ccc"
style="font-size:12.000000;fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#333333;stroke-width:5.0000000;stroke-miterlimit:4.0000000;"
d="M 12.986483,29.403286 C 15.818301,17.671464 20.875121,5.3328238 31.191034,5.5350970 C 41.304673,5.5350974 45.147854,18.885102 47.372855,29.605558"
sodipodi:stroke-cmyk="(0 0 0 0.8)"
id="path612" />
<path
style="font-size:12.000000;fill:#cccccc;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#333333;stroke-width:3.1250000;stroke-linejoin:round;"
d="M 9.8122082,28.265654 C 8.7042082,28.265654 7.8122082,29.157654 7.8122082,30.265654 L 7.8122082,53.817583 C 7.8122082,54.925583 8.7042082,55.817583 9.8122082,55.817583 L 50.547129,55.817583 C 51.655129,55.817583 52.547129,54.925583 52.547129,53.817583 L 52.547129,30.265654 C 52.547129,29.157654 51.655129,28.265654 50.547129,28.265654 L 9.8122082,28.265654 z "
id="rect611" />
</g>
<metadata
id="metadata6">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:title>Part of the Flat Icon Collection (Thu Aug 26 14:31:40 2004)</dc:title>
<dc:description />
<dc:subject>
<rdf:Bag>
<rdf:li />
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent
rdf:about="">
<dc:title />
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent
rdf:about="">
<dc:title>Danny Allen</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent
rdf:about="">
<dc:title>Danny Allen</dc:title>
</cc:Agent>
</dc:rights>
<dc:date />
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://creativecommons.org/licenses/LGPL/2.1/">
<dc:date />
</cc:license>
<dc:language>en</dc:language>
</cc:Work>
</rdf:RDF>
</metadata>
<rect
height="2.550113"
width="1.1182215"
id="rect4208"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958729"
x="22.392134" />
<rect
height="2.550113"
width="1.1182215"
id="rect4210"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958696"
x="25.205595" />
<rect
height="2.550113"
width="1.1182215"
id="rect4212"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958729"
x="28.039183" />
<rect
height="2.550113"
width="1.1182215"
id="rect4214"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958729"
x="30.862715" />
<rect
height="2.550113"
width="1.1182215"
id="rect4216"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="30.059542"
x="33.676201" />
<a
id="a2680"
transform="matrix(1.0764385,0,0,1.0764386,-3.9678317,-2.8218674)">
<rect
x="22.957844"
y="-49.865311"
ry="0.50752664"
style="fill:#c0c0c0;fill-opacity:0;stroke:#000000;stroke-width:0.26633105;stroke-opacity:1"
rx="0.60646188"
id="rect4218"
width="16.989586"
transform="scale(1,-1)"
height="16.91943" />
</a>
<rect
height="2.550113"
width="1.1182215"
id="rect4220"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="29.958696"
x="36.489658" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4222"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136734"
x="-46.626415" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4224"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-35.312218" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4226"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-38.135746" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4228"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-40.959274" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4230"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-43.782803" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4232"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="18.136717"
x="-49.429836" />
<rect
height="2.550113"
width="1.1182215"
id="rect4234"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.13517"
x="22.412243" />
<rect
height="2.550113"
width="1.1182215"
id="rect4236"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.135139"
x="25.225708" />
<rect
height="2.550113"
width="1.1182215"
id="rect4238"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.13517"
x="28.059299" />
<rect
height="2.550113"
width="1.1182215"
id="rect4240"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.13517"
x="30.88283" />
<rect
height="2.550113"
width="1.1182215"
id="rect4242"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.135139"
x="33.686245" />
<rect
height="2.550113"
width="1.1182215"
id="rect4244"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="51.135139"
x="36.509773" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4246"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313171"
x="-46.626415" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4248"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-35.312218" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4250"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-38.135746" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4252"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-40.959274" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4254"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-43.782803" />
<rect
height="2.5501127"
transform="matrix(0,-1,1,0,0,0)"
width="1.1182216"
id="rect4256"
rx="0"
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.27343532;stroke-opacity:1"
ry="0"
y="39.313141"
x="-49.429836" />
<text
xml:space="preserve"
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans Mono"
x="22.675781"
y="45.092186"
id="text2683"><tspan
sodipodi:role="line"
id="tspan2685"
x="22.675781"
y="45.092186">µC</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -108,7 +108,12 @@ info:
#-------------------------------------------------------------------------------
define SOURCEFILE_TEMPLATE
$(BIN_DIR)$(1): $(2)/$(3).c
$(CC) $(CFLAGS) -c -o $@ $<
endef
#-------------------------------------------------------------------------------
$(BIN_DIR)%.o: %.c
@echo "[gcc]: $@"
@$(CC) $(CFLAGS) -c -o $@ $<

View File

@ -1,7 +1,7 @@
MCU_TARGET = atmega644
OPTIMIZE = -Os
PROGRAMMER = stk500v2 # avr911
PROGRAMMER = avr911
DEFS = -D$(call uc, $(MCU_TARGET))
FLASHCMD = avrdude -p $(MCU_TARGET) -P /dev/ttyUSB0 -c $(PROGRAMMER) -U flash:w:# no space at the end
#FLASHCMD = avrdude -p $(MCU_TARGET) -c usbasp -U flash:w:# no space at the end

View File

@ -28,7 +28,7 @@
#include <avr/pgmspace.h>
#include "camellia.h"
#if 0
#include "uart.h"
#include "cli.h"
#include "debug.h"
#include <util/delay.h>
#endif
@ -72,11 +72,11 @@ uint32_t PROGMEM camellia_sigma[12]={ /* 48 byte table */
/*****************************************************************************/
/*
void camellia128_ctx_dump(camellia128_ctx_t *s){
uart_putstr_P(PSTR("\r\n==State Dump=="));
uart_putstr_P(PSTR("\n\rKAl: ")); uart_hexdump(&(s->kal), 8);
uart_putstr_P(PSTR("\n\rKAr: ")); uart_hexdump(&(s->kar), 8);
uart_putstr_P(PSTR("\n\rKLl: ")); uart_hexdump(&(s->kll), 8);
uart_putstr_P(PSTR("\n\rKLr: ")); uart_hexdump(&(s->klr), 8);
cli_putstr_P(PSTR("\r\n==State Dump=="));
cli_putstr_P(PSTR("\n\rKAl: ")); cli_hexdump(&(s->kal), 8);
cli_putstr_P(PSTR("\n\rKAr: ")); cli_hexdump(&(s->kar), 8);
cli_putstr_P(PSTR("\n\rKLl: ")); cli_hexdump(&(s->kll), 8);
cli_putstr_P(PSTR("\n\rKLr: ")); cli_hexdump(&(s->klr), 8);
return;
}
*/

View File

@ -28,7 +28,7 @@
#include <avr/pgmspace.h>
#include "camellia.h"
#if 0
#include "uart.h"
#include "cli.h"
#include "debug.h"
#include <util/delay.h>
#endif
@ -100,7 +100,7 @@ uint8_t camellia_s4(uint8_t b){
/*****************************************************************************/
uint64_t camellia_s(uint64_t d){
// uart_putstr("\n\r S von "); uart_hexdump(&(d), 8);
// cli_putstr("\n\r S von "); cli_hexdump(&(d), 8);
#define D ((uint8_t*)(&d))
D[7] = camellia_s1(D[7]);
D[6] = camellia_s2(D[6]);
@ -112,7 +112,7 @@ uint64_t camellia_s(uint64_t d){
D[1] = camellia_s4(D[1]);
D[0] = camellia_s1(D[0]);
#undef D
// uart_putstr(" ist "); uart_hexdump(&(d), 8);
// cli_putstr(" ist "); cli_hexdump(&(d), 8);
return d;
}
@ -133,7 +133,7 @@ uint64_t camellia_p(uint64_t d){
Z[7] = D[3] ^ D[5] ^ D[4];
*/
// Z[7] = z1 z3 z4 z6 z7 z8
// uart_putstr("\n\r P von "); uart_hexdump(&(d), 8);
// cli_putstr("\n\r P von "); cli_hexdump(&(d), 8);
Z[7] = D[7] ^ D[5] ^ D[4] ^ D[2] ^ D[1] ^ D[0];
Z[6] = D[7] ^ D[6] ^ D[4] ^ D[3] ^ D[1] ^ D[0];
@ -144,7 +144,7 @@ uint64_t camellia_p(uint64_t d){
Z[1] = D[5] ^ D[4] ^ D[3] ^ D[2] ^ D[0];
Z[0] = D[7] ^ D[4] ^ D[3] ^ D[2] ^ D[1] ;
// uart_putstr(" ist "); uart_hexdump(&(z), 8);
// cli_putstr(" ist "); cli_hexdump(&(z), 8);
#undef Z
#undef D
@ -176,12 +176,12 @@ uint64_t camellia_fl(uint64_t x, uint64_t k){
yl = (yr | K[0]) ^ (X[1]); /* Yl */
/*
uart_putstr("\r\nFL(");
uart_hexdump(&(x), 8);
uart_putstr(", ");
uart_hexdump(&(k), 8);
uart_putstr(") = ");
uart_hexdump(y, 8);
cli_putstr("\r\nFL(");
cli_hexdump(&(x), 8);
cli_putstr(", ");
cli_hexdump(&(k), 8);
cli_putstr(") = ");
cli_hexdump(y, 8);
*/
#undef K
#undef X
@ -206,11 +206,11 @@ uint64_t camellia_fl_inv(uint64_t y, uint64_t k){
X[0]=rol32((X[1] & K[1]),1) ^ Y[0];
/*
uart_putstr("\r\nFL_inv(");
uart_hexdump(&(y), 8);
uart_putstr(", ");
uart_hexdump(&(k), 8);
uart_putstr(") = ");
cli_putstr("\r\nFL_inv(");
cli_hexdump(&(y), 8);
cli_putstr(", ");
cli_hexdump(&(k), 8);
cli_putstr(") = ");
*/
#undef K
#undef X
@ -232,11 +232,11 @@ uint64_t camellia_sigma[6]={
/*****************************************************************************/
#if 0
void camellia128_ctx_dump(camellia128_ctx_t *s){
uart_putstr("\r\n==State Dump==");
uart_putstr("\n\rKAl: "); uart_hexdump(&(s->kal), 8);
uart_putstr("\n\rKAr: "); uart_hexdump(&(s->kar), 8);
uart_putstr("\n\rKLl: "); uart_hexdump(&(s->kll), 8);
uart_putstr("\n\rKLr: "); uart_hexdump(&(s->klr), 8);
cli_putstr("\r\n==State Dump==");
cli_putstr("\n\rKAl: "); cli_hexdump(&(s->kal), 8);
cli_putstr("\n\rKAr: "); cli_hexdump(&(s->kar), 8);
cli_putstr("\n\rKLl: "); cli_hexdump(&(s->kll), 8);
cli_putstr("\n\rKLr: "); cli_hexdump(&(s->klr), 8);
return;
}
#endif
@ -270,7 +270,7 @@ void camellia128_init(const void* key, camellia128_ctx_t* s){
s->kar ^= camellia_f(s->kal, camellia_sigma[2]);
s->kal ^= camellia_f(s->kar, camellia_sigma[3]);
/**/
// uart_putstr("\n\r----------------init finished--------------------");
// cli_putstr("\n\r----------------init finished--------------------");
}
/*****************************************************************************/

54
cast5.c
View File

@ -36,7 +36,7 @@
#undef DEBUG
#ifdef DEBUG
#include "uart.h"
#include "cli.h"
#endif
#include "cast5-sbox.h"
@ -112,7 +112,7 @@ void cast5_init_rM(uint8_t *klo, uint8_t *khi, uint8_t offset, uint8_t *src, boo
klo[offset*2+1] |= t<<4;
h |= t&0x10; h >>=1;
#ifdef DEBUG
uart_putstr("\r\n\t h="); uart_hexdump(&h,1);
cli_putstr("\r\n\t h="); cli_hexdump(&h,1);
#endif
khi[offset>>1] |= h<<((offset&0x1)?4:0);
}
@ -204,17 +204,17 @@ uint32_t cast5_f1(uint32_t d, uint32_t m, uint8_t r){
t = ROTL32((d + m),r);
#ifdef DEBUG
uint32_t ia,ib,ic,id;
uart_putstr("\r\n f1("); uart_hexdump(&d, 4); uart_putc(',');
uart_hexdump(&m , 4); uart_putc(','); uart_hexdump(&r, 1);uart_putstr("): I=");
uart_hexdump(&t, 4);
cli_putstr("\r\n f1("); cli_hexdump(&d, 4); cli_putc(',');
cli_hexdump(&m , 4); cli_putc(','); cli_hexdump(&r, 1);cli_putstr("): I=");
cli_hexdump(&t, 4);
ia = pgm_read_dword(&s1[((uint8_t*)&t)[IA]] );
ib = pgm_read_dword(&s2[((uint8_t*)&t)[IB]] );
ic = pgm_read_dword(&s3[((uint8_t*)&t)[IC]] );
id = pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
uart_putstr("\r\n\tIA="); uart_hexdump(&ia, 4);
uart_putstr("\r\n\tIB="); uart_hexdump(&ib, 4);
uart_putstr("\r\n\tIC="); uart_hexdump(&ic, 4);
uart_putstr("\r\n\tID="); uart_hexdump(&id, 4);
cli_putstr("\r\n\tIA="); cli_hexdump(&ia, 4);
cli_putstr("\r\n\tIB="); cli_hexdump(&ib, 4);
cli_putstr("\r\n\tIC="); cli_hexdump(&ic, 4);
cli_putstr("\r\n\tID="); cli_hexdump(&id, 4);
return (((ia ^ ib) - ic) + id);
@ -234,19 +234,19 @@ uint32_t cast5_f2(uint32_t d, uint32_t m, uint8_t r){
t = ROTL32((d ^ m),r);
#ifdef DEBUG
uint32_t ia,ib,ic,id;
uart_putstr("\r\n f2("); uart_hexdump(&d, 4); uart_putc(',');
uart_hexdump(&m , 4); uart_putc(','); uart_hexdump(&r, 1);uart_putstr("): I=");
uart_hexdump(&t, 4);
cli_putstr("\r\n f2("); cli_hexdump(&d, 4); cli_putc(',');
cli_hexdump(&m , 4); cli_putc(','); cli_hexdump(&r, 1);cli_putstr("): I=");
cli_hexdump(&t, 4);
ia = pgm_read_dword(&s1[((uint8_t*)&t)[IA]] );
ib = pgm_read_dword(&s2[((uint8_t*)&t)[IB]] );
ic = pgm_read_dword(&s3[((uint8_t*)&t)[IC]] );
id = pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
uart_putstr("\r\n\tIA="); uart_hexdump(&ia, 4);
uart_putstr("\r\n\tIB="); uart_hexdump(&ib, 4);
uart_putstr("\r\n\tIC="); uart_hexdump(&ic, 4);
uart_putstr("\r\n\tID="); uart_hexdump(&id, 4);
cli_putstr("\r\n\tIA="); cli_hexdump(&ia, 4);
cli_putstr("\r\n\tIB="); cli_hexdump(&ib, 4);
cli_putstr("\r\n\tIC="); cli_hexdump(&ic, 4);
cli_putstr("\r\n\tID="); cli_hexdump(&id, 4);
return (((ia - ib) + ic) ^ id);
#else
@ -267,19 +267,19 @@ uint32_t cast5_f3(uint32_t d, uint32_t m, uint8_t r){
#ifdef DEBUG
uint32_t ia,ib,ic,id;
uart_putstr("\r\n f3("); uart_hexdump(&d, 4); uart_putc(',');
uart_hexdump(&m , 4); uart_putc(','); uart_hexdump(&r, 1);uart_putstr("): I=");
uart_hexdump(&t, 4);
cli_putstr("\r\n f3("); cli_hexdump(&d, 4); cli_putc(',');
cli_hexdump(&m , 4); cli_putc(','); cli_hexdump(&r, 1);cli_putstr("): I=");
cli_hexdump(&t, 4);
ia = pgm_read_dword(&s1[((uint8_t*)&t)[IA]] );
ib = pgm_read_dword(&s2[((uint8_t*)&t)[IB]] );
ic = pgm_read_dword(&s3[((uint8_t*)&t)[IC]] );
id = pgm_read_dword(&s4[((uint8_t*)&t)[ID]] );
uart_putstr("\r\n\tIA="); uart_hexdump(&ia, 4);
uart_putstr("\r\n\tIB="); uart_hexdump(&ib, 4);
uart_putstr("\r\n\tIC="); uart_hexdump(&ic, 4);
uart_putstr("\r\n\tID="); uart_hexdump(&id, 4);
cli_putstr("\r\n\tIA="); cli_hexdump(&ia, 4);
cli_putstr("\r\n\tIB="); cli_hexdump(&ib, 4);
cli_putstr("\r\n\tIC="); cli_hexdump(&ic, 4);
cli_putstr("\r\n\tID="); cli_hexdump(&id, 4);
return (((ia + ib) ^ ic) - id);
#else
return (( pgm_read_dword(&s1[((uint8_t*)&t)[IA]] )
@ -298,16 +298,16 @@ void cast5_enc(void* block, const cast5_ctx_t *s){
cast5_f_t* f[]={cast5_f1,cast5_f2,cast5_f3};
l=((uint32_t*)block)[0];
r=((uint32_t*)block)[1];
// uart_putstr("\r\n round[-1] = ");
// uart_hexdump(&r, 4);
// cli_putstr("\r\n round[-1] = ");
// cli_hexdump(&r, 4);
for (i=0;i<(s->shortkey?12:16);++i){
x = r;
y = (f[i%3])(CHANGE_ENDIAN32(r), CHANGE_ENDIAN32(s->mask[i]),
(((s->roth[i>>3]) & (1<<(i&0x7)))?0x10:0x00)
+ ( ((s->rotl[i>>1])>>((i&1)?4:0)) & 0x0f) );
r = l ^ CHANGE_ENDIAN32(y);
// uart_putstr("\r\n round["); DEBUG_B(i); uart_putstr("] = ");
// uart_hexdump(&r, 4);
// cli_putstr("\r\n round["); DEBUG_B(i); cli_putstr("] = ");
// cli_hexdump(&r, 4);
l = x;
}
((uint32_t*)block)[0]=r;

40
cast6.c
View File

@ -194,31 +194,31 @@ void w(void* buffer, uint8_t* tr, uint32_t* tm){
/*
void dump_ctx(const cast6_ctx_t* ctx){
uint8_t i,t;
uart_putstr_P(PSTR("\r\n DBG:"));
cli_putstr_P(PSTR("\r\n DBG:"));
for(i=0; i<12; ++i){
uart_putstr_P(PSTR("\r\n DBG:"));
uart_putstr_P(PSTR(" rotk1="));
cli_putstr_P(PSTR("\r\n DBG:"));
cli_putstr_P(PSTR(" rotk1="));
t=kr(i*4+0, ctx);
uart_hexdump(&t,1);
uart_putstr_P(PSTR(" rotk2="));
cli_hexdump(&t,1);
cli_putstr_P(PSTR(" rotk2="));
t=kr(i*4+1, ctx);
uart_hexdump(&t,1);
uart_putstr_P(PSTR(" rotk3="));
cli_hexdump(&t,1);
cli_putstr_P(PSTR(" rotk3="));
t=kr(i*4+2, ctx);
uart_hexdump(&t,1);
uart_putstr_P(PSTR(" rotk4="));
cli_hexdump(&t,1);
cli_putstr_P(PSTR(" rotk4="));
t=kr(i*4+3, ctx);
uart_hexdump(&t,1);
uart_putstr_P(PSTR("\r\n "));
uart_putstr_P(PSTR(" mask1="));
uart_hexdump(&(ctx->km[i][0]),4);
uart_putstr_P(PSTR(" mask2="));
uart_hexdump(&(ctx->km[i][1]),4);
uart_putstr_P(PSTR(" mask3="));
uart_hexdump(&(ctx->km[i][2]),4);
uart_putstr_P(PSTR(" mask4="));
uart_hexdump(&(ctx->km[i][3]),4);
uart_putstr_P(PSTR("\r\n;-----"));
cli_hexdump(&t,1);
cli_putstr_P(PSTR("\r\n "));
cli_putstr_P(PSTR(" mask1="));
cli_hexdump(&(ctx->km[i][0]),4);
cli_putstr_P(PSTR(" mask2="));
cli_hexdump(&(ctx->km[i][1]),4);
cli_putstr_P(PSTR(" mask3="));
cli_hexdump(&(ctx->km[i][2]),4);
cli_putstr_P(PSTR(" mask4="));
cli_hexdump(&(ctx->km[i][3]),4);
cli_putstr_P(PSTR("\r\n;-----"));
}
}
*/

View File

@ -24,6 +24,7 @@
// #define F_CPU 14745600
#include "uart_defs.h"
#define DEBUG uart
@ -38,6 +39,17 @@
#define UART_XON_XOFF_THRESHOLD_2 (UART_RXBUFSIZE - 60)
#undef UART_LEDS
#define UART0_I 1
#define UART0_BAUD_RATE 38400
#define UART0_PARATY UART_PARATY_NONE
#define UART0_STOPBITS UART_STOPBITS_1
#define UART0_DATABITS UART_DATABITS_8
#define UART0_RXBUFFER_SIZE 64
#define UART0_TXBUFFER_SIZE 64
#define UART0_SWFLOWCTRL 1
#define UART0_THRESH_LOW 10
#define UART0_THRESH_HIGH 48
/*
#define UART_HWFLOWCONTROL
#define UART_RTS_PORT PORTA

2
des.c
View File

@ -27,7 +27,7 @@
*/
#include "config.h"
#include "debug.h"
#include "uart.h"
#include "cli.h"
#include <stdint.h>
#include <string.h>
#include <util/delay.h>

24
md5.c
View File

@ -27,7 +27,7 @@
#include "md5.h"
#include "md5_sbox.h"
#include "uart.h"
#include "cli.h"
#include <stdint.h>
#include <string.h>
@ -73,12 +73,12 @@ void md5_core(uint32_t* a, void* block, uint8_t as, uint8_t s, uint8_t i, uint8_
/* a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
#ifdef DEBUG
char funcc[]={'*', '-', '+', '~'};
uart_putstr("\r\n DBG: md5_core [");
uart_putc(funcc[fi]);
uart_hexdump(&as, 1); uart_putc(' ');
uart_hexdump(&k, 1); uart_putc(' ');
uart_hexdump(&s, 1); uart_putc(' ');
uart_hexdump(&i, 1); uart_putc(']');
cli_putstr("\r\n DBG: md5_core [");
cli_putc(funcc[fi]);
cli_hexdump(&as, 1); cli_putc(' ');
cli_hexdump(&k, 1); cli_putc(' ');
cli_hexdump(&s, 1); cli_putc(' ');
cli_hexdump(&i, 1); cli_putc(']');
#endif
t = a[as] + funcs[fi](a[(as+1)&3], a[(as+2)&3], a[(as+3)&3])
+ *((uint32_t*)block) + pgm_read_dword(md5_T+i) ;
@ -90,11 +90,11 @@ void md5_nextBlock(md5_ctx_t *state, const void* block){
uint8_t m,n,i=0;
/* this requires other mixed sboxes */
#ifdef DEBUG
uart_putstr("\r\n DBG: md5_nextBlock: block:\r\n");
uart_hexdump(block, 16); uart_putstr("\r\n");
uart_hexdump(block+16, 16); uart_putstr("\r\n");
uart_hexdump(block+32, 16); uart_putstr("\r\n");
uart_hexdump(block+48, 16); uart_putstr("\r\n");
cli_putstr("\r\n DBG: md5_nextBlock: block:\r\n");
cli_hexdump(block, 16); cli_putstr("\r\n");
cli_hexdump(block+16, 16); cli_putstr("\r\n");
cli_hexdump(block+32, 16); cli_putstr("\r\n");
cli_hexdump(block+48, 16); cli_putstr("\r\n");
#endif
a[0]=state->a[0];

View File

@ -1 +1,2 @@
CLI_STD = debug.o uart.o hexdigit_tab.o dbz_strings.o cli.o string-extras.o
CLI_STD = cli-stub.o cli-basics.o cli-core.o cli-hexdump.o debug.o hexdigit_tab.o \
dbz_strings.o string-extras-asm.o uart_i-asm.o circularbytebuffer-asm.o

View File

@ -5,8 +5,7 @@ ALGO_NAME := A51
STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := A5_1.o
$(ALGO_NAME)_TEST_BIN := main-a5_1-test.o debug.o uart.o hexdigit_tab.o \
nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o
$(ALGO_NAME)_TEST_BIN := main-a5_1-test.o nessie_stream_test.o nessie_common.o $(CLI_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -7,8 +7,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := aes_enc-asm.o aes_dec-asm.o aes_sbox-asm.o aes_invsbox-asm.o \
aes_keyschedule-asm.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -7,8 +7,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := aes_enc-asm.o aes_dec-asm_faster.o aes_sbox-asm.o aes_invsbox-asm.o \
aes_keyschedule-asm.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -9,8 +9,8 @@ $(ALGO_NAME)_OBJ := aes_enc.o aes_dec.o aes_sbox.o aes_invsbox.o \
aes_keyschedule.o gf256mul.o \
aes128_enc.o aes128_dec.o aes192_enc.o aes192_dec.o \
aes256_enc.o aes256_dec.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-aes-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -5,9 +5,8 @@ ALGO_NAME := ARCFOUR
STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := arcfour-asm.o
$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o hexdigit_tab.o \
nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o $(CLI_STD) \
nessie_stream_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := ARCFOUR_C
STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := arcfour.o
$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o debug.o uart.o hexdigit_tab.o \
nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
$(ALGO_NAME)_TEST_BIN := main-arcfour-test.o $(CLI_STD) \
nessie_stream_test.o nessie_common.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,9 +6,8 @@ ENCODINGS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := base64_enc.o base64_dec.o
$(ALGO_NAME)_TEST_BIN := main-base64-test.o debug.o uart.o hexdigit_tab.o \
cli.o string-extras.o performance_test.o noekeon_asm.o noekeon_prng.o \
memxor.o
$(ALGO_NAME)_TEST_BIN := main-base64-test.o $(CLI_STD) \
performance_test.o noekeon_asm.o noekeon_prng.o memxor.o
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -5,9 +5,8 @@ ALGO_NAME := CAMELLIA
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := camellia128-stub.o camellia-asm.o
$(ALGO_NAME)_TEST_BIN := main-camellia-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o \
dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-camellia-test.o $(CLI_STD) nessie_bc_test.o \
nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := CAST5
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := cast5.o
$(ALGO_NAME)_TEST_BIN := main-cast5-test.o debug.o uart.o hexdigit_tab.o cli.o string-extras.o\
nessie_bc_test.o dbz_strings.o nessie_common.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-cast5-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := cast6.o
$(ALGO_NAME)_TEST_BIN := main-cast6-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
nessie_bc_test.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-cast6-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -5,8 +5,8 @@ ALGO_NAME := DES
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-des-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-des-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,7 @@ ALGO_NAME := ENTROPIUM
PRNGS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := entropium.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-entropium-test.o debug.o uart.o hexdigit_tab.o \
cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-entropium-test.o $(CLI_STD) performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,9 +5,8 @@ ALGO_NAME := GRAIN
STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := grain.o
$(ALGO_NAME)_TEST_BIN := main-grain-test.o debug.o uart.o hexdigit_tab.o \
nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_TEST_BIN := main-grain-test.o $(CLI_STD) \
nessie_stream_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := HMAC-MD5
MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := hmac-md5.o md5-asm.o
$(ALGO_NAME)_TEST_BIN := main-hmac-md5-test.o debug.o uart.o hexdigit_tab.o cli.o string-extras.o \
nessie_mac_test.o dbz_strings.o nessie_common.o base64_enc.o base64_dec.o
$(ALGO_NAME)_TEST_BIN := main-hmac-md5-test.o $(CLI_STD) \
nessie_mac_test.o nessie_common.o base64_enc.o base64_dec.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := HMAC-SHA1
MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := hmac-sha1.o sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o debug.o uart.o hexdigit_tab.o cli.o string-extras.o \
nessie_mac_test.o dbz_strings.o nessie_common.o
$(ALGO_NAME)_TEST_BIN := main-hmac-sha1-test.o $(CLI_STD) \
nessie_mac_test.o nessie_common.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := HMAC-SHA256
MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := hmac-sha256.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-hmac-sha256-test.o debug.o uart.o hexdigit_tab.o \
nessie_mac_test.o dbz_strings.o nessie_common.o cli.o string-extras.o
$(ALGO_NAME)_TEST_BIN := main-hmac-sha256-test.o $(CLI_STD) \
nessie_mac_test.o nessie_common.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := MICKEY128
STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := mickey128.o
$(ALGO_NAME)_TEST_BIN := main-mickey128-test.o debug.o uart.o hexdigit_tab.o serial-tools.o \
nessie_stream_test.o nessie_common.o cli.o string-extras.o
$(ALGO_NAME)_TEST_BIN := main-mickey128-test.o $(CLI_STD) \
nessie_stream_test.o nessie_common.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := MUGI_C
STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := mugi.o gf256mul.o aes_sbox.o
$(ALGO_NAME)_TEST_BIN := main-mugi-test.o debug.o uart.o hexdigit_tab.o \
nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
$(ALGO_NAME)_TEST_BIN := main-mugi-test.o $(CLI_STD) \
nessie_stream_test.o nessie_common.o \
performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := noekeon_asm.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := noekeon.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-noekeon-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -6,8 +6,8 @@ MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o hexdigit_tab.o \
nessie_mac_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o $(CLI_STD) \
nessie_mac_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -6,8 +6,8 @@ MACS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := noekeon_asm.o omac_noekeon_C.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o debug.o uart.o hexdigit_tab.o \
nessie_mac_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-omac-noekeon-test.o $(CLI_STD) \
nessie_mac_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := present.o
$(ALGO_NAME)_TEST_BIN := main-present-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-present-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,9 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := rc5.o
$(ALGO_NAME)_TEST_BIN := main-rc5-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o \
dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-rc5-test.o $(CLI_STD) nessie_bc_test.o \
nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := rc6.o
$(ALGO_NAME)_TEST_BIN := main-rc6-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-rc6-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -5,9 +5,8 @@ ALGO_NAME := SEED
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := seed-asm.o
$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o \
cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-seed-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,9 +5,8 @@ ALGO_NAME := SEED_C
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := seed_C.o
$(ALGO_NAME)_TEST_BIN := main-seed-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o \
cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-seed-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-bitslice-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent-sboxes-bitslice-asm.o serpent-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-fast.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent-asm.o serpent-sboxes-small.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := serpent.o serpent-sboxes_c.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-serpent-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,7 +5,7 @@ ALGO_NAME := SHA1
HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o hfal_sha1.o $(CLI_STD) $(HFAL_STD) dump.o
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o hfal_sha1.o $(CLI_STD) $(HFAL_STD) dump-decl.o dump-asm.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,7 +5,7 @@ ALGO_NAME := SHA1_C
HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := sha1.o
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o hfal_sha1.o dump.o $(CLI_STD) $(HFAL_STD)
$(ALGO_NAME)_TEST_BIN := main-sha1-test.o hfal_sha1.o dump-asm.o dump-decl.o $(CLI_STD) $(HFAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,7 @@ ALGO_NAME := SHA256
HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o dump.o hfal_sha256.o $(CLI_STD) $(HFAL_STD)
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o dump-asm.o dump-decl.o hfal_sha256.o $(CLI_STD) $(HFAL_STD)
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,7 +5,7 @@ ALGO_NAME := SHA256_C
HASHES += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := sha256.o
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o $(CLI_STD) $(HFAL_STD) hfal_sha256.o dump.o
$(ALGO_NAME)_TEST_BIN := main-sha256-test.o $(CLI_STD) $(HFAL_STD) hfal_sha256.o dump-asm.o dump-decl.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := SHABEA
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := shabea.o sha256-asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-shabea-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-shabea-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := shacal1_enc.o sha1-asm.o
$(ALGO_NAME)_TEST_BIN := main-shacal1_enc-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-shacal1_enc-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -6,8 +6,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := shacal2_enc.o sha256-asm.o
$(ALGO_NAME)_TEST_BIN := main-shacal2_enc-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-shacal2_enc-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,9 +5,8 @@ ALGO_NAME := SKIPJACK
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := skipjack.o
$(ALGO_NAME)_TEST_BIN := main-skipjack-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_TEST_BIN := main-skipjack-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := TDES
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := des.o
$(ALGO_NAME)_TEST_BIN := main-tdes-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-tdes-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,8 +8,8 @@ BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := threefish256_enc_asm.o threefish512_enc_asm.o threefish1024_enc_asm.o\
threefish_mix.o threefish_invmix.o \
threefish256_dec_asm.o threefish512_dec_asm.o threefish1024_dec_asm.o
$(ALGO_NAME)_TEST_BIN := main-threefish-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-threefish-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -5,9 +5,8 @@ ALGO_NAME := TRIVIUM
STREAM_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := trivium.o
$(ALGO_NAME)_TEST_BIN := main-trivium-test.o debug.o uart.o hexdigit_tab.o \
nessie_stream_test.o dbz_strings.o nessie_common.o cli.o string-extras.o \
performance_test.o
$(ALGO_NAME)_TEST_BIN := main-trivium-test.o $(CLI_STD) \
nessie_stream_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -8,8 +8,8 @@ AUX += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := threefish_mix.o threefish256_enc_asm.o ubi256_asm.o \
threefish512_enc_asm.o ubi512_asm.o threefish1024_enc_asm.o \
ubi1024_asm.o memxor.o
$(ALGO_NAME)_TEST_BIN := main-ubi-test.o debug.o uart.o hexdigit_tab.o \
dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-ubi-test.o $(CLI_STD) \
nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := test nessie
$(ALGO_NAME)_PERFORMANCE_TEST := performance

View File

@ -5,8 +5,8 @@ ALGO_NAME := XTEA
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := xtea-asm.o
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -5,8 +5,8 @@ ALGO_NAME := XTEA_C
BLOCK_CIPHERS += $(ALGO_NAME)
$(ALGO_NAME)_OBJ := xtea.o
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o debug.o uart.o hexdigit_tab.o \
nessie_bc_test.o dbz_strings.o nessie_common.o cli.o string-extras.o performance_test.o
$(ALGO_NAME)_TEST_BIN := main-xtea-test.o $(CLI_STD) \
nessie_bc_test.o nessie_common.o performance_test.o
$(ALGO_NAME)_NESSIE_TEST := "nessie"
$(ALGO_NAME)_PERFORMANCE_TEST := "performance"

View File

@ -32,7 +32,7 @@
#include <avr/pgmspace.h>
#endif
#include "noekeon.h"
// #include "uart.h"
// #include "cli.h"
#define ROUND_NR 16
@ -172,8 +172,8 @@ void noekeon_dec(void* buffer, const void* key){
changendian(dkey);
theta((uint32_t*)nullv, (uint32_t*)dkey);
// uart_putstr_P(PSTR("\r\nTheta: "));
// uart_hexdump(dkey, 16);
// cli_putstr_P(PSTR("\r\nTheta: "));
// cli_hexdump(dkey, 16);
for(i=ROUND_NR-1; i>=0; --i){
#ifdef __AVR__

View File

@ -29,7 +29,7 @@
#include <avr/pgmspace.h>
#include <string.h>
#include "seed_sbox.h"
#include "uart.h"
#include "cli.h"
#include "debug.h"
@ -221,19 +221,19 @@ void seed_enc(void * buffer, const seed_ctx_t * ctx){
for(r=0; r<8; ++r){
k = getnextkeys(((seed_ctx_t*)ctx)->k, 2*r);
/*
DEBUG_S("\r\n\tDBG ka,0: "); uart_hexdump(&k.k0, 4);
DEBUG_S("\r\n\tDBG ka,1: "); uart_hexdump(&k.k1, 4);
DEBUG_S("\r\n\t DBG L: "); uart_hexdump((uint8_t*)buffer+0, 8);
DEBUG_S("\r\n\t DBG R: "); uart_hexdump((uint8_t*)buffer+8, 8);
DEBUG_S("\r\n\tDBG ka,0: "); cli_hexdump(&k.k0, 4);
DEBUG_S("\r\n\tDBG ka,1: "); cli_hexdump(&k.k1, 4);
DEBUG_S("\r\n\t DBG L: "); cli_hexdump((uint8_t*)buffer+0, 8);
DEBUG_S("\r\n\t DBG R: "); cli_hexdump((uint8_t*)buffer+8, 8);
*/
L ^= f_function(&R,k.k0,k.k1);
k = getnextkeys(((seed_ctx_t*)ctx)->k, 2*r+1);
/*
DEBUG_S("\r\n\tDBG kb,0: "); uart_hexdump(&k.k0, 4);
DEBUG_S("\r\n\tDBG kb,1: "); uart_hexdump(&k.k1, 4);
DEBUG_S("\r\n\t DBG L: "); uart_hexdump((uint8_t*)buffer+8, 8);
DEBUG_S("\r\n\t DBG R: "); uart_hexdump((uint8_t*)buffer+0, 8);
DEBUG_S("\r\n\tDBG kb,0: "); cli_hexdump(&k.k0, 4);
DEBUG_S("\r\n\tDBG kb,1: "); cli_hexdump(&k.k1, 4);
DEBUG_S("\r\n\t DBG L: "); cli_hexdump((uint8_t*)buffer+8, 8);
DEBUG_S("\r\n\t DBG R: "); cli_hexdump((uint8_t*)buffer+0, 8);
*/
R ^= f_function(&L,k.k0,k.k1);
}
@ -254,19 +254,19 @@ void seed_dec(void * buffer, seed_ctx_t * ctx){
for(r=7; r>=0; --r){
k = getprevkeys(((seed_ctx_t*)ctx)->k, 2*r+1);
/*
DEBUG_S("\r\n\tDBG ka,0: "); uart_hexdump(&k.k0, 4);
DEBUG_S("\r\n\tDBG ka,1: "); uart_hexdump(&k.k1, 4);
DEBUG_S("\r\n\t DBG L: "); uart_hexdump((uint8_t*)buffer+0, 8);
DEBUG_S("\r\n\t DBG R: "); uart_hexdump((uint8_t*)buffer+8, 8);
DEBUG_S("\r\n\tDBG ka,0: "); cli_hexdump(&k.k0, 4);
DEBUG_S("\r\n\tDBG ka,1: "); cli_hexdump(&k.k1, 4);
DEBUG_S("\r\n\t DBG L: "); cli_hexdump((uint8_t*)buffer+0, 8);
DEBUG_S("\r\n\t DBG R: "); cli_hexdump((uint8_t*)buffer+8, 8);
*/
L ^= f_function(&R,k.k0,k.k1);
k = getprevkeys(((seed_ctx_t*)ctx)->k, 2*r+0);
/*
DEBUG_S("\r\n\tDBG kb,0: "); uart_hexdump(&k.k0, 4);
DEBUG_S("\r\n\tDBG kb,1: "); uart_hexdump(&k.k1, 4);
DEBUG_S("\r\n\t DBG L: "); uart_hexdump((uint8_t*)buffer+8, 8);
DEBUG_S("\r\n\t DBG R: "); uart_hexdump((uint8_t*)buffer+0, 8);
DEBUG_S("\r\n\tDBG kb,0: "); cli_hexdump(&k.k0, 4);
DEBUG_S("\r\n\tDBG kb,1: "); cli_hexdump(&k.k1, 4);
DEBUG_S("\r\n\t DBG L: "); cli_hexdump((uint8_t*)buffer+8, 8);
DEBUG_S("\r\n\t DBG R: "); cli_hexdump((uint8_t*)buffer+0, 8);
*/
R ^= f_function(&L,k.k0,k.k1);
}

12
sha1.c
View File

@ -110,7 +110,7 @@ void sha1_nextBlock (sha1_ctx_t *state, const void* block){
DEBUG_B(dbgi);
DEBUG_C(':');
#ifdef DEBUG
uart_hexdump(&(w[dbgi]) ,4);
cli_hexdump(&(w[dbgi]) ,4);
#endif
}
@ -124,12 +124,12 @@ void sha1_nextBlock (sha1_ctx_t *state, const void* block){
s = t & MASK;
if(t>=16){
#ifdef DEBUG
DEBUG_S("\r\n ws = "); uart_hexdump(&ws, 4);
DEBUG_S("\r\n ws = "); cli_hexdump(&ws, 4);
#endif
w[s] = rotl32( w[(s+13)&MASK] ^ w[(s+8)&MASK] ^
w[(s+ 2)&MASK] ^ w[s] ,1);
#ifdef DEBUG
DEBUG_S(" --> ws = "); uart_hexdump(&(w[s]), 4);
DEBUG_S(" --> ws = "); cli_hexdump(&(w[s]), 4);
#endif
}
@ -143,15 +143,15 @@ void sha1_nextBlock (sha1_ctx_t *state, const void* block){
DEBUG_S("\r\nt = "); DEBUG_B(t);
DEBUG_S("; a[]: ");
#ifdef DEBUG
uart_hexdump(a, 5*4);
cli_hexdump(a, 5*4);
#endif
DEBUG_S("; k = ");
#ifdef DEBUG
uart_hexdump(&(k[t/20]), 4);
cli_hexdump(&(k[t/20]), 4);
#endif
DEBUG_S("; f(b,c,d) = ");
#ifdef DEBUG
uart_hexdump(&dtemp, 4);
cli_hexdump(&dtemp, 4);
#endif
}

View File

@ -0,0 +1,372 @@
/* circularbytebuffer-asm.S */
/*
This file is part of the AVR-circularbytebuffer.
Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file circularbytebuffer-asm.S
* \email daniel.otte@rub.de
* \author Daniel Otte
* \date 2009-07-25
* \license GPLv3 or later
* \ingroup circularbytebuffer
* \brief declaration for circular byte buffer
*/
/*
typedef struct {
uint8_t buffer_size;
uint8_t fillcount;
uint8_t* buffer;
uint8_t* head;
uint8_t* tail;
uint8_t* top;
} circularbytebuffer_t;
*/
#include "config.h"
#define BUFFER_SIZE_OFFSET 0
#define FILLCOUNT_OFFSET 1
#define BUFFER_OFFSET 2
#define HEAD_OFFSET 4
#define TAIL_OFFSET 6
#define TOP_OFFSET 8
#ifndef CIRCULARBYTEBUFFER_NO_MALLOC
# define CIRCULARBYTEBUFFER_NO_MALLOC 0
#endif
#ifndef CIRCULARBYTEBUFFER_NO_INIT2
# define CIRCULARBYTEBUFFER_NO_INIT2 0
#endif
#if CIRCULARBYTEBUFFER_NO_MALLOC==0
/******************************************************************************/
/*
* uint8_t circularbytebuffer_init(uint8_t buffersize, circularbytebuffer_t* cb){
* cb->buffer_size = buffersize;
* cb->buffer = malloc(buffersize);
* cb->head = cb->tail = cb->buffer;
* cb->top = cb->buffer + cb->buffer_size;
* cb->fillcount = 0;
* if(cb->buffer)
* return 1; / * success * /
* return 0; / * malloc failed * /
* }
*
* param buffersize: r24
* param cb: r22:r23
*/
.global circularbytebuffer_init
circularbytebuffer_init:
push r28
push r29
movw r28, r22
std Y+0, r24 /* set buffer_size */
std Y+1, r1 /* set fillcount to 0 */
clr r25
call malloc
adiw r24, 0
brne 10f
clr r24
rjmp 99f
10:
std Y+2, r24
std Y+3, r25
std Y+4, r24
std Y+5, r25
std Y+6, r24
std Y+7, r25
ld r22, Y
add r24, r22
adc r25, r1
std Y+8, r24
std Y+9, r25
ldi r24, 1
99:
clr r25
pop r29
pop r28
ret
/******************************************************************************/
/*
* void circularbytebuffer_free(circularbytebuffer_t* cb){
* free(cb->buffer);
* }
*
* param cb: r24:r25
*/
.global circularbytebuffer_free
circularbytebuffer_free:
movw r30, r24
ldd r24, Z+BUFFER_OFFSET
ldd r25, Z+BUFFER_OFFSET+1
jmp free
#endif /* CIRCULARBYTEBUFFER_NO_MALLOC==0 */
#if CIRCULARBYTEBUFFER_NO_INIT2==0
/******************************************************************************/
/*
* void circularbytebuffer_init2(uint8_t buffersize, circularbytebuffer_t* cb, void* buffer){
* cb->buffer_size = buffersize;
* cb->buffer = buffer
* cb->head = cb->tail = cb->buffer;
* cb->top = cb->buffer + cb->buffer_size;
* cb->fillcount = 0;
* }
*
* param buffersize: r24
* param cb: r22:r23
* param buffer: r20:r21
*/
.global circularbytebuffer_init2
circularbytebuffer_init2:
movw r30, r22
std Z+0, r24 /* set buffer_size */
std Z+1, r1 /* set fillcount to 0 */
std Z+2, r20
std Z+3, r21
std Z+4, r20
std Z+5, r21
std Z+6, r20
std Z+7, r21
add r20, r24
adc r21, r1
std Z+8, r20
std Z+9, r21
ret
#endif /* CIRCULARBYTEBUFFER_NO_INIT2==0 */
/******************************************************************************/
/*
* uint8_t circularbytebuffer_cnt(circularbytebuffer_t* cb){
* return (cb->fillcount);
* }
*
* param cb: r24:r25
*/
.global circularbytebuffer_cnt
circularbytebuffer_cnt:
movw r30, r24
ldd r24, Z+FILLCOUNT_OFFSET
clr r25
ret
/******************************************************************************/
/*
* uint16_t circularbytebuffer_get_lifo(circularbytebuffer_t* cb){
* uint8_t ret;
* if(cb->fillcount==0)
* return 0xffff;
* --cb->fillcount;
* ret=*(cb->tail);
* cb->tail = (uint8_t*)(cb->tail) + 1;
* if(cb->tail>=cb->top)
* cb->tail = (uint8_t*)(cb->tail) - cb->buffer_size;
* return ret;
* }
* param cb: r24:r25
*/
.global circularbytebuffer_get_lifo
circularbytebuffer_get_lifo:
movw r30, r24
ldd r23, Z+FILLCOUNT_OFFSET
tst r23
brne 10f
ser r24
ser r25
ret
10:
dec r23
std Z+FILLCOUNT_OFFSET, r23
ldd r26, Z+TAIL_OFFSET
ldd r27, Z+TAIL_OFFSET+1
ld r24, X+
clr r25
ldd r22, Z+TOP_OFFSET
ldd r23, Z+TOP_OFFSET+1
cp r26, r22
cpc r27, r23
brlo 20f
ldd r22, Z+BUFFER_SIZE_OFFSET
sub r26, r22
sbc r27, r1
20:
std Z+TAIL_OFFSET, r26
std Z+TAIL_OFFSET+1, r27
ret
/******************************************************************************/
/*
* uint16_t circularbytebuffer_get_fifo(circularbytebuffer_t* cb){
* uint8_t ret;
* if(cb->fillcount==0)
* return 0xffff;
* --cb->fillcount;
* ret=*(cb->head);
* cb->head = (uint8_t*)(cb->head) - 1;
* if(cb->head<cb->buffer)
* cb->head = (uint8_t*)(cb->head) + cb->buffer_size;
* return ret;
* }
*
* param cb: r24:r25
*/
.global circularbytebuffer_get_fifo
circularbytebuffer_get_fifo:
movw r30, r24
ldd r23, Z+FILLCOUNT_OFFSET
tst r23
brne 10f
ser r24
ser r25
ret
10:
dec r23
std Z+FILLCOUNT_OFFSET, r23
ldd r26, Z+HEAD_OFFSET
ldd r27, Z+HEAD_OFFSET+1
ld r24, X
clr 25
sbiw r26, 1
ldd r22, Z+BUFFER_OFFSET
ldd r23, Z+BUFFER_OFFSET+1
cp r26, r22
cpc r27, r23
brge 20f
ldd r22, Z+BUFFER_SIZE_OFFSET
add r26, r22
adc r27, r1
20:
std Z+HEAD_OFFSET, r26
std Z+HEAD_OFFSET+1, r27
ret
/******************************************************************************/
/*
* uint8_t circularbytebuffer_append(uint8_t elem, circularbytebuffer_t* cb){
* if(cb->fillcount==cb->buffer_size)
* return 1;
* cb->fillcount++;
* cb->tail = cb->tail - 1;
* if(cb->tail<cb->buffer)
* cb->tail = (uint8_t*)(cb->tail) + cb->buffer_size;
* if(cb->fillcount==1)
* cb->head = cb->tail;
* *(cb->tail) = elem;
* return 0;
* }
*
* param elem: r24
* param cb: r22:r23
*/
.global circularbytebuffer_append
circularbytebuffer_append:
movw r30, r22
ldd r22, Z+FILLCOUNT_OFFSET
ldd r23, Z+BUFFER_SIZE_OFFSET
cp r22, r23
brne 10f
ldi r24, 1
ret
10:
clt
tst r22
brne 11f
set
11:
inc r22
std Z+FILLCOUNT_OFFSET, r22
ldd r26, Z+TAIL_OFFSET
ldd r27, Z+TAIL_OFFSET+1
sbiw r26, 1
ldd r22, Z+BUFFER_OFFSET
ldd r23, Z+BUFFER_OFFSET+1
cp r26, r22
cpc r27, r23
brge 20f
ldd r22, Z+BUFFER_SIZE_OFFSET
add r26, r22
adc r27, r1
20:
std Z+TAIL_OFFSET, r26
std Z+TAIL_OFFSET+1, r27
brtc 30f
std Z+HEAD_OFFSET, r26
std Z+HEAD_OFFSET+1, r27
30:
st X, r24
clr r24
ret
/******************************************************************************/
/*
* uint8_t circularbytebuffer_push(uint8_t elem, circularbytebuffer_t* cb){
* if(cb->fillcount==cb->buffer_size)
* return 1;
* cb->fillcount++;
* cb->head = cb->head + 1;
* if(cb->head>=cb->top)
* cb->head = (uint8_t*)(cb->head) - cb->buffer_size;
* if(cb->fillcount==1)
* cb->tail = cb->head;
* *(cb->head) = elem;
* return 0;
* }
*
* param elem: r24
* param cb: r22:r23
*/
.global circularbytebuffer_push
circularbytebuffer_push:
movw r30, r22
ldd r22, Z+FILLCOUNT_OFFSET
ldd r23, Z+BUFFER_SIZE_OFFSET
cp r22, r23
brne 10f
ldi r24, 1
ret
10:
clt
tst r22
brne 11f
set
11:
inc r22
std Z+FILLCOUNT_OFFSET, r22
ldd r26, Z+HEAD_OFFSET
ldd r27, Z+HEAD_OFFSET+1
adiw r26, 1
ldd r22, Z+TOP_OFFSET
ldd r23, Z+TOP_OFFSET+1
cp r26, r22
cpc r27, r23
brlo 20f
ldd r22, Z+BUFFER_SIZE_OFFSET
sub r26, r22
sbc r27, r1
20:
std Z+HEAD_OFFSET, r26
std Z+HEAD_OFFSET+1, r27
brtc 30b
std Z+TAIL_OFFSET, r26
std Z+TAIL_OFFSET+1, r27
rjmp 30b

View File

@ -0,0 +1,59 @@
/* circularbytebuffer.h */
/*
This file is part of the AVR-circularbytebuffer.
Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file circularbytebuffer.h
* \email daniel.otte@rub.de
* \author Daniel Otte
* \date 2009-07-24
* \license GPLv3 or later
* \ingroup circularbytebuffer
* \brief declaration for circular byte buffer
*/
#ifndef CIRCULARBYTEBUFFER_H_
#define CIRCULARBYTEBUFFER_H_
#include <stdint.h>
#include <stdlib.h>
#include "config.h"
typedef struct {
uint8_t buffer_size;
uint8_t fillcount;
uint8_t* buffer;
uint8_t* head;
uint8_t* tail;
uint8_t* top;
} circularbytebuffer_t;
#if CIRCULARBYTEBUFFER_NO_MALLOC==0
uint8_t circularbytebuffer_init(uint8_t buffersize, circularbytebuffer_t* cb);
#endif
#if CIRCULARBYTEBUFFER_NO_INIT2==0
void circularbytebuffer_init2(uint8_t buffersize, circularbytebuffer_t* cb, void* buffer);
#endif
uint16_t circularbytebuffer_get_lifo(circularbytebuffer_t* cb);
uint16_t circularbytebuffer_get_fifo(circularbytebuffer_t* cb);
uint8_t circularbytebuffer_append(uint8_t, circularbytebuffer_t* cb);
uint8_t circularbytebuffer_push(uint8_t, circularbytebuffer_t* cb);
uint8_t circularbytebuffer_cnt(circularbytebuffer_t* cb);
void circularbytebuffer_free(circularbytebuffer_t* cb);
#endif /* CIRCULARBYTEBUFFER_H_ */

150
test_src/cli-basics.S Normal file
View File

@ -0,0 +1,150 @@
/* cli-basics.S */
/*
This file is part of the AVR-Huffman.
Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "avr-asm-macros.S"
.extern cli_tx
.extern cli_rx
.extern cli_echo
/******************************************************************************/
.global cli_putc
cli_putc:
lds r30, cli_tx
lds r31, cli_tx+1
adiw r30, 0
breq 2f
ijmp
/******************************************************************************/
.global cli_getc
cli_getc:
lds r30, cli_rx
lds r31, cli_rx+1
adiw r30, 0
breq 1f
ijmp
1:
ser r24
ser r25
2:
ret
/******************************************************************************/
.global cli_getc_cecho
cli_getc_cecho:
lds r30, cli_rx
lds r31, cli_rx+1
adiw r30, 0
brne 1f
ser r25
ser r24
ret
1:
icall
lds r20, cli_echo
tst r20
brne 2f
ret
2:
push r2
mov r2, r24
rcall cli_putc
mov r24, r2
clr r25
pop r2
ret
/******************************************************************************/
.global cli_putstr
cli_putstr:
push r28
push r29
movw r28, r24
1:
ld r24, Y+
clr r25
tst r24
breq 2f
rcall cli_putc
rjmp 1b
2:
pop r29
pop r28
ret
/******************************************************************************/
.global cli_putstr_P
cli_putstr_P:
push r28
push r29
movw r28, r24
1:
movw r30, r28
lpm r24, Z
clr r25
tst r24
breq 2f
rcall cli_putc
adiw r28, 1
rjmp 1b
2:
pop r29
pop r28
ret
/******************************************************************************/
/*
* param s: r24:r25
* param n: r22:r23
*/
.global cli_getsn
cli_getsn:
push r28
push r29
push r16
push r17
movw r28, r24
ldi r20, 2
movw r24, r22
adiw r24, 0
breq 9f
1:
movw r16, r22
2: clr r20
rcall cli_getc
cpi r24, '\r'
breq 9f
ldi r20, 1
tst r24
breq 9f
st Y+, r24
movw r26, r16
sbiw r26, 1
movw r16, r24
brne 2b
9:
clr r25
mov r24, r20
st Y, r1
pop r17
pop r16
pop r28
pop r29
ret

406
test_src/cli-core.S Normal file
View File

@ -0,0 +1,406 @@
/* cli-core.S */
/*
This file is part of the AVR-Huffman.
Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "avr-asm-macros.S"
#define CMDLIST_ENTRY_SIZE 8
/******************************************************************************/
/* uint16_t max_cmd_length(PGM_VOID_P cmdlist){
uint16_t t,ret=0;
char* str;
for(;;){
str = (char*)pgm_read_word(cmdlist);
cmdlist = (uint8_t*)cmdlist + CMDLIST_ENTRY_SIZE;
if(str==NULL)
return ret;
t = strlen_P(str);
if(t>ret)
ret=t;
}
}
* param cmdlist: r24:r25
*/
TMP_CNT_0 = 26
TMP_CNT_1 = 27
.global max_cmd_length
max_cmd_length:
movw r30, r24
clr r24
clr r25
1:
lpm r26, Z+
lpm r27, Z+
movw r20, r30
adiw r26, 0
brne 3f
ret
3:
movw r30, r26
clr TMP_CNT_0
clr TMP_CNT_1
4:
lpm r1, Z+
adiw TMP_CNT_0, 1
tst r1
brne 4b
sbiw TMP_CNT_0, 1
movw r30, r20
adiw r30, CMDLIST_ENTRY_SIZE-2
cp r24, TMP_CNT_0
cpc r25, TMP_CNT_1
brge 1b
movw r24, TMP_CNT_0
rjmp 1b
/******************************************************************************/
.global echo_ctrl
echo_ctrl:
call strstrip
tst r24
brne 3f
tst r25
breq print_echo_status
3:
call strlwr
movw r26, r24
ld r20, X+
tst r20
breq print_echo_status
cpi r20, '1'
breq exit_1
cpi r20, '0'
breq exit_0
cpi r20, 't'
breq exit_1
cpi r20, 'f'
breq exit_0
ld r20, X+
cpi r20, 'n'
breq exit_1
cpi r20, 'f'
breq exit_0
ret
exit_1:
ldi r20, 1
rjmp exit
exit_0:
ldi r20, 0
exit:
sts cli_echo, r20
ret
print_echo_status:
ldi r24, lo8(pecho)
ldi r25, hi8(pecho)
rcall cli_putstr_P
lds r20, cli_echo
tst r20
breq 3f
clr r25
ldi r24, 'n'
rcall cli_putc
rjmp 4f
3: clr r25
ldi r24, 'f'
rcall cli_putc
clr r25
ldi r24, 'f'
rcall cli_putc
4: clr r25
ldi r24, '\r'
rcall cli_putc
clr r25
ldi r24, '\n'
rcall cli_putc
ret
pecho:
.asciz "\r\necho is o"
/******************************************************************************/
/* int8_t search_and_call(char* cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist)
* param cmd: r24:r25
* param maxcmdlength: r22:r23
* param cmdlist: r20:r21
*/
LEN_0 = 14
LEN_1 = 15
CMD_0 = 16
CMD_1 = 17
snc_auto_help:
movw r24, r22
movw r22, r20
rcall cli_auto_help
snc_return_1:
ldi r24, 1
rjmp snc_return
snc_return_2:
ldi r24, 2
snc_return:
clr r25
ret
.global search_and_call
search_and_call:
adiw r24, 0
breq snc_return_1
1: movw r26, r24
ld r18, X+
cpi r18, 0
breq snc_return_1
cpi r18, '#'
breq snc_return_1
cpi r18, '?'
breq 2f
cpi r18, 'h'
brne 1f
ld r18, X+
cpi r18, 'e'
brne 1f
ld r18, X+
cpi r18, 'l'
brne 1f
ld r18, X+
cpi r18, 'p'
brne 1f
ld r18, X+
tst r18
brne 1f
2: rjmp snc_auto_help
1:
push r28
push r29
push CMD_0
push CMD_1
push LEN_0
push LEN_1
movw CMD_0, r24
movw r28, r20
rcall firstword_length
movw LEN_0, r24
movw r26, CMD_0
add r26, LEN_0
adc r27, LEN_1
st X, r1
movw r24, CMD_0
ldi r22, lo8(exit_str)
ldi r23, hi8(exit_str)
call strcmp_P
adiw r24, 0
breq snc_return_0
1:
movw r30, r28
lpm r24, Z+
lpm r25, Z+
adiw r24, 0
brne 3f
ldi r24, lo8(nocommand_str)
ldi r25, hi8(nocommand_str)
rcall cli_putstr_P
ldi r24, 1
rjmp 5f
3: movw r22, r24
movw r24, CMD_0
call strcmp_P
adiw r24, 0
breq snc_found
adiw r28, CMDLIST_ENTRY_SIZE
rjmp 1b
snc_found:
movw r24, CMD_0
add r24, LEN_0
adc r25, LEN_1
adiw r24, 1
movw r30, r28
adiw r30, 4
lpm r22, Z+
lpm r23, Z+
movw r30, r22
adiw r30, 0
breq 4f ;snc_return_2
icall
ldi r24, 1
rjmp 5f
4: ldi r24, 2
snc_return_0:
clr r24
5: pop LEN_1
pop LEN_0
pop CMD_1
pop CMD_0
pop r29
pop r28
rjmp snc_return
exit_str:
.asciz "exit"
help_str:
.asciz "help"
nocommand_str:
.asciz "\r\ncommand not found, try 'help'"
/******************************************************************************/
/* void cli_option_listing(char* buffer, PGM_VOID_P cmdlist)
* param buffer: r24:r25
* param cmdlist: r22:r23
*/
ITM_0 = 12
ITM_1 = 13
CMD_0 = 14
CMD_1 = 15
LEN_0 = 16
LEN_1 = 17
LST_0 = 28
LST_1 = 29
.global cli_option_listing
cli_option_listing:
push_range 12, 17
push_range 28, 29
movw CMD_0, r24
movw LST_0, r22
call strlen
sbiw r24, 1
movw LEN_0, r24
1:
movw r30, LST_0
lpm r24, Z+
lpm r25, Z+
movw ITM_0, r24
adiw r24, 0
breq 99f
movw r22, r24
movw r24, CMD_0
movw r20, LEN_0
adiw r28, CMDLIST_ENTRY_SIZE
call strncmp_P
adiw r24, 0
brne 1b
ldi r24, lo8(itemprefix_str)
ldi r25, hi8(itemprefix_str)
rcall cli_putstr_P
movw r24, ITM_0
rcall cli_putstr_P
rjmp 1b
99:
ldi r24, lo8(prompt_str)
ldi r25, hi8(prompt_str)
rcall cli_putstr_P
movw r24, CMD_0
rcall cli_putstr
pop_range 28, 29
pop_range 12, 17
ret
prompt_str:
.asciz "\r\n>"
itemprefix_str:
.asciz "\r\n "
/******************************************************************************/
/* void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist)
* param maxcmdlength: r24:r25
* param cmdlist: r22:r23
*/
TMP_0 = 14
TMP_1 = 15
LEN_0 = 16
LEN_1 = 17
LST_0 = 28
LST_1 = 29
cli_auto_help:
push_range 16, 17
push_range 28, 29
movw LEN_0, r24
movw r28, r22
ldi r24, lo8(ahelphead_str)
ldi r25, hi8(ahelphead_str)
rcall cli_putstr_P
1:
movw r30, r28
lpm r24, Z+
lpm r25, Z+
movw r28, r30
adiw r24, 0
breq 99f
movw TMP_0, r24
rcall cli_putstr_P
movw r24, TMP_0
call strlen_P
movw TMP_0, LEN_0
sub TMP_0, r24
sbc TMP_1, r25
breq 4f
2: ldi r24, ' '
clr r25
rcall cli_putc
dec TMP_0
brne 2b
4: ldi r24, lo8(sep_str)
ldi r25, hi8(sep_str)
ldi r22, lo8(none_str)
ldi r23, hi8(none_str)
rcall cli_putstr_P
movw r30, r28
lpm r24, Z+
lpm r25, Z+
movw r28, r30
adiw r24, 0
breq 5f
ldi r22, lo8(yes_str)
ldi r23, hi8(yes_str)
5: movw r24, r22
rcall cli_putstr_P
ldi r24, lo8(sep2_str)
ldi r25, hi8(sep2_str)
rcall cli_putstr_P
movw r30, r28
adiw r30, 1
lpm r24, Z
rcall cli_hexdump_byte
movw r30, r28
lpm r24, Z
rcall cli_hexdump_byte
ldi r24, '\r'
clr r25
rcall cli_putc
ldi r24, '\n'
clr r25
rcall cli_putc
adiw r28, CMDLIST_ENTRY_SIZE-4
rjmp 1b
99:
pop_range 28, 29
pop_range 14, 17
ret
ahelphead_str:
.asciz "\r\n[auto help] available commands:\r\n <command> - <params> - <address>\r\n"
sep_str:
.asciz " - "
none_str:
.asciz "none"
yes_str:
.asciz "yes "
sep2_str:
.asciz" \t - 0x"
.byte 0

205
test_src/cli-hexdump.S Normal file
View File

@ -0,0 +1,205 @@
/* cli-hexdump.S */
/*
This file is part of the AVR-Huffman.
Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "avr-asm-macros.S"
/******************************************************************************/
/* cli_hexdump_byte
* param data: r24
*/
.global cli_hexdump_byte
cli_hexdump_byte:
push r24
swap r24
andi r24, 0x0f
ldi r30, lo8(hexdigit_tab_P)
ldi r31, hi8(hexdigit_tab_P)
add r30, r24
adc r31, r1
clr r25
lpm r24, Z
rcall cli_putc
pop r24
andi r24, 0x0f
ldi r30, lo8(hexdigit_tab_P)
ldi r31, hi8(hexdigit_tab_P)
add r30, r24
adc r31, r1
clr r25
lpm r24, Z
rcall cli_putc
ret
/******************************************************************************/
/* cli_hexdump
* param data: r24:r25
* param length: r22:r23
*/
.global cli_hexdump
cli_hexdump:
push r28
push r29
push r16
push r17
movw r28, r24
movw r16, r22
movw r26, r22
adiw r26, 0
breq hexdump_exit
2:
ld r24, Y+
rcall cli_hexdump_byte
subi r16, 1
sbc r17, r1
brne 2b
hexdump_exit:
pop r17
pop r16
pop r29
pop r28
ret
/******************************************************************************/
/* cli_hexdump_rev
* param data: r24:r25
* param length: r22:r23
*/
.global cli_hexdump_rev
cli_hexdump_rev:
push r28
push r29
push r16
push r17
movw r28, r24
movw r16, r22
add r28, r22
adc r29, r23
movw r26, r22
adiw r26, 0
1:
breq hexdump_exit
ld r24, -Y
rcall cli_hexdump_byte
subi r16, 1
sbci r17, 0
rjmp 1b
/******************************************************************************/
/* cli_hexdump2
* param data: r24:r25
* param length: r22:r23
*/
.global cli_hexdump2
cli_hexdump2:
push r28
push r29
push r16
push r17
movw r28, r24
movw r16, r22
movw r26, r16
adiw r26, 0
1:
breq hexdump_exit
ld r24, Y+
rcall cli_hexdump_byte
clr r25
ldi r24,' '
rcall cli_putc
subi r16, 1
sbci r17, 0
rjmp 1b
/******************************************************************************/
/* void cli_hexdump_block(const void* data, uint16_t length, uint8_t indent, uint8_t width)
* param data: r24:r25
* param length: r22:r23
* param indent: r20
* param width: r18
*/
WIDTH = 2
INDENT = 3
DATA_0 = 28
DATA_1 = 29
LENG_0 = 16
LENG_1 = 17
.global cli_hexdump_block
cli_hexdump_block:
tst r22
brne 1f
tst r23
brne 1f
ret
1:
push WIDTH
push INDENT
push DATA_0
push DATA_1
push LENG_0
push LENG_1
push r4
mov WIDTH, r18
mov INDENT, r20
movw DATA_0, r24
movw LENG_0, r22
2:
clr r25
ldi r24, '\r'
rcall cli_putc
clr r25
ldi r24, '\n'
rcall cli_putc
mov r4, INDENT
tst r4
breq 4f
3: clr r25
ldi r24, ' '
rcall cli_putc
dec r4
brne 3b
4:
movw r24, DATA_0
clr r23
mov r22, WIDTH
tst LENG_1
brne 7f
cp WIDTH, LENG_0
breq 6f
brmi 7f
mov r22, LENG_0
6: inc r4
7:
rcall cli_hexdump2
add DATA_0, WIDTH
adc DATA_1, r1
sub LENG_0, WIDTH
sbc LENG_0, r1
tst r4
breq 2b
pop r4
pop LENG_1
pop LENG_0
pop DATA_1
pop DATA_0
pop INDENT
pop WIDTH
ret

189
test_src/cli-stub.c Normal file
View File

@ -0,0 +1,189 @@
/* cli.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*
* author: Daniel Otte
* email: daniel.otte@rub.de
* license: GPLv3 or later
*
* components to help implementing simple command based interaction
*
**/
#include <stdlib.h>
#include <stdint.h>
#include <ctype.h>
#include <string.h>
#include <avr/pgmspace.h>
#include "string-extras.h"
#include "cli.h"
#include "config.h"
#include "hexdigit_tab.h"
cli_rx_fpt cli_rx = NULL;
cli_tx_fpt cli_tx = NULL;
uint8_t cli_echo=1;
void echo_ctrl(char* s);
uint16_t max_cmd_length(PGM_VOID_P cmdlist);
int8_t search_and_call(char* cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist);
void cli_option_listing(char* buffer, PGM_VOID_P cmdlist);
void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist);/*
{
cmdlist_entry_t item;
uint16_t i;
if(!cli_tx)
return;
cli_putstr_P(PSTR("\r\n[auto help] available commands:\r\n"
" <command> - <params> - <address>\r\n"));
for(;;){
item.cmd_name = (void*)pgm_read_word(cmdlist+0);
item.cmd_param_str = (void*)pgm_read_word(cmdlist+2);
item.cmd_function = (void_fpt)pgm_read_word(cmdlist+4);
cmdlist = (uint8_t*)cmdlist+CMDLIST_ENTRY_SIZE;
if(item.cmd_name==NULL){
return;
}
cli_tx(' ');
cli_putstr_P(item.cmd_name);
i=maxcmdlength-strlen_P(item.cmd_name);
while(i--)
cli_tx(' ');
cli_putstr_P(PSTR(" - "));
if(item.cmd_param_str==NULL){
cli_putstr_P(PSTR("none \t- 0x"));
} else {
if(item.cmd_param_str==(void*)1){
cli_putstr_P(PSTR("yes \t- 0x"));
} else {
cli_putstr_P(item.cmd_param_str);
cli_putstr_P(PSTR(" \t- 0x"));
}
}
cli_hexdump_rev(&item.cmd_function, 2);
cli_putstr_P(PSTR("\r\n"));
}
}
*/
typedef void(*str_fpt)(char*);
#define CLI_ENTER 13
#define CLI_BACKSPACE 8
#define CLI_TABULATOR 9
uint8_t cli_completion(char* buffer, uint16_t maxcmdlength, PGM_VOID_P cmdlist){
uint8_t i=0;
char ref[maxcmdlength+1];
char* itemstr;
ref[0]='\0';
/* check if we are behind the first word */
while(buffer[i]){
if(!isgraph(buffer[i++]))
return 0;
}
for(;;){
itemstr = (char*)pgm_read_word(cmdlist);
if(itemstr==NULL)
break;
cmdlist = (uint8_t*)cmdlist +CMDLIST_ENTRY_SIZE;
if(!strncmp_P(buffer, itemstr, i)){
if(!ref[0]){
strcpy_P(ref, itemstr);
}else{
ref[stridentcnt_P(ref, itemstr)]='\0';
}
}
}
i = strcmp(buffer, ref);
if(i)
strcpy(buffer, ref);
return ~i;
}
int8_t cmd_interface(PGM_VOID_P cmd_desc){
uint16_t cli_buffer_size;
uint16_t cli_buffer_index;
int8_t exit_code;
uint8_t completion_failed=0;
char* cli_buffer;
char c;
uint16_t maxcmdlength = max_cmd_length(cmd_desc);
cli_buffer = calloc(1,cli_buffer_size=maxcmdlength+2);
cli_buffer_index=0;
if(!cli_rx)
return -1;
if(cli_tx)
cli_tx('>');
for(;;){
c = cli_rx();
switch (c){
case CLI_ENTER:
if((exit_code=search_and_call(cli_buffer, maxcmdlength, cmd_desc))<=0){
free(cli_buffer);
return exit_code;
}
memset(cli_buffer, 0, cli_buffer_size);
cli_buffer_index=0;
cli_putstr_P(PSTR("\r\n>"));
completion_failed=0;
break;
case CLI_BACKSPACE:
completion_failed=0;
if(cli_buffer_index==0)
break;
cli_buffer_index--;
cli_buffer[cli_buffer_index] = '\0';
if(cli_echo && cli_tx){
cli_tx(c);
}
break;
case CLI_TABULATOR:
if(completion_failed || cli_buffer_index==0){
if(cli_tx)
cli_option_listing(cli_buffer, cmd_desc);
} else {
uint16_t old_idx = cli_buffer_index;
completion_failed =
~cli_completion(cli_buffer, maxcmdlength, cmd_desc);
cli_buffer_index = strlen(cli_buffer);
if(cli_echo && cli_tx){
while(old_idx<cli_buffer_index){
cli_tx(cli_buffer[old_idx++]);
}
}
}
break;
default:
completion_failed=0;
if(cli_echo && cli_tx){
cli_tx(c);
}
if(cli_buffer_index+1==cli_buffer_size){
cli_buffer = realloc(cli_buffer, cli_buffer_size+=CLI_BUFFER_BS);
if(!cli_buffer){
return -2;
}
memset(cli_buffer+cli_buffer_index+1, 0, CLI_BUFFER_BS);
}
cli_buffer[cli_buffer_index++] = c;
}
}
}

View File

@ -1,430 +0,0 @@
/* cli.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*
* author: Daniel Otte
* email: daniel.otte@rub.de
* license: GPLv3 or later
*
* components to help implementing simple command based interaction
*
**/
#include <stdlib.h>
#include <stdint.h>
#include <ctype.h>
#include <string.h>
#include <avr/pgmspace.h>
#include "string-extras.h"
#include "cli.h"
#include "config.h"
#include "hexdigit_tab.h"
cli_rx_fpt cli_rx = NULL;
cli_tx_fpt cli_tx = NULL;
uint8_t cli_echo=1;
/**
* \brief output a character to the console
*
*/
void cli_putc(char c){
if(cli_tx)
cli_tx(c);
}
/**
* \brief get a character from the console
* Gets a character from the console input and blocks
* until a character is recieved
*/
uint16_t cli_getc(void){
if(cli_rx)
return cli_rx();
return ((uint16_t)-1);
}
/**
* \brief get a character from the console
* Gets a char from the console input (like cli_getc())
* and echos it back to the console if echo is enabled.
*/
uint16_t cli_getc_cecho(void){
char c;
if(cli_rx){
c = cli_rx();
if(cli_tx && cli_echo)
cli_tx(c);
return c;
}
return ((uint16_t)-1);
}
/**
* \brief ouputs a zero-terminated string from ram to the console
*/
void cli_putstr(const char* s){
if(!cli_tx)
return;
while(*s)
cli_tx(*s++);
}
/**
* \brief ouputs a zero-terminated string from flash to the console
*/
void cli_putstr_P(PGM_P s){
char c;
if(!cli_tx)
return;
for(;;){
c = pgm_read_byte(s++);
if(!c)
return;
cli_tx(c);
}
}
/**
* \brief reads a line or max n characters from the console
* Writes characters from the console into the supplyed buffer until a '\r'
* character is recieved or until n character a read (whatever happens first).
* The string will always be terminated by a '\0' character, so the buffer
* should have at least a size of n+1.
*/
uint8_t cli_getsn(char* s, uint16_t n){
char c;
if(n==0)
return 2;
while((c=cli_getc_cecho())!='\0' && c!='\r' && n--){
*s++=c;
}
*s='\0';
return (c=='\r')?0:1;
}
/**
* \brief dumps the contents of a buffer to the console
* Dumps length bytes from data to the console ouput. The dump
* will have 2*n continous hexadecimal characters.
*/
void cli_hexdump(const void* data, uint16_t length){
if(!cli_tx)
return;
while(length--){
cli_tx(pgm_read_byte(hexdigit_tab_P +((*((uint8_t*)data))>>4)));
cli_tx(pgm_read_byte(hexdigit_tab_P +((*((uint8_t*)data))&0xf)));
data = (uint8_t*)data +1;
}
}
/**
* \brief dumps the contents of a buffer to the console
* This function behaves like cli_hexdump except that the
* bytes are dumped in reverse order. This is usefull to dump
* integers which ar e in little endian order.
*/
void cli_hexdump_rev(const void* data, uint16_t length){
if(!cli_tx)
return;
data = (uint8_t*)data + length -1;
while(length--){
cli_tx(pgm_read_byte(hexdigit_tab_P +((*((uint8_t*)data))>>4)));
cli_tx(pgm_read_byte(hexdigit_tab_P +((*((uint8_t*)data))&0xf)));
data = (uint8_t*)data -1;
}
}
/**
* \brief dumps the contents of a buffer to the console
* Like cli_hexdump but bytes are seperated with a single space
* on the console output.
*/
void cli_hexdump2(const void* data, uint16_t length){
if(!cli_tx)
return;
while(length--){
cli_tx(pgm_read_byte(hexdigit_tab_P +((*((uint8_t*)data))>>4)));
cli_tx(pgm_read_byte(hexdigit_tab_P +((*((uint8_t*)data))&0xf)));
cli_tx(' ');
data = (uint8_t*)data +1;
}
}
/**
* \brief dumps the contents of a buffer to the console
* Like cli_hexdump but bytes are seperated with a single space
* on the console output.
*/
void cli_hexdump_block(const void* data, uint16_t length, uint8_t indent, uint8_t width){
uint16_t i;
uint8_t j;
if(!cli_tx)
return;
for(i=0; i<length; ++i){
if(i%width==0){
cli_putstr_P(PSTR("\r\n"));
for(j=0; j<indent; ++j){
cli_tx(' ');
}
}
cli_tx(pgm_read_byte(hexdigit_tab_P +((*((uint8_t*)data))>>4)));
cli_tx(pgm_read_byte(hexdigit_tab_P +((*((uint8_t*)data))&0xf)));
cli_tx(' ');
data = (uint8_t*)data +1;
}
}
static
void cli_auto_help(uint16_t maxcmdlength, PGM_VOID_P cmdlist){
cmdlist_entry_t item;
uint16_t i;
if(!cli_tx)
return;
cli_putstr_P(PSTR("\r\n[auto help] available commands:\r\n"
" <command> - <params> - <address>\r\n"));
for(;;){
item.cmd_name = (void*)pgm_read_word(cmdlist+0);
item.cmd_param_str = (void*)pgm_read_word(cmdlist+2);
item.cmd_function = (void_fpt)pgm_read_word(cmdlist+4);
cmdlist = (uint8_t*)cmdlist+CMDLIST_ENTRY_SIZE;
if(item.cmd_name==NULL){
return;
}
cli_tx(' ');
cli_putstr_P(item.cmd_name);
i=maxcmdlength-strlen_P(item.cmd_name);
while(i--)
cli_tx(' ');
cli_putstr_P(PSTR(" - "));
if(item.cmd_param_str==NULL){
cli_putstr_P(PSTR("none \t- 0x"));
} else {
if(item.cmd_param_str==(void*)1){
cli_putstr_P(PSTR("yes \t- 0x"));
} else {
cli_putstr_P(item.cmd_param_str);
cli_putstr_P(PSTR(" \t- 0x"));
}
}
cli_hexdump_rev(&item.cmd_function, 2);
cli_putstr_P(PSTR("\r\n"));
}
}
void echo_ctrl(char* s){
s = strstrip(s);
if(s==NULL || *s=='\0'){
cli_putstr_P(PSTR("\r\necho is "));
cli_putstr_P(cli_echo?PSTR("on"):PSTR("off"));
cli_putstr_P(PSTR("\r\n"));
}
strlwr(s);
if(!strcmp_P(s, PSTR("true")) || !strcmp_P(s, PSTR("on")) || *s=='1'){
cli_echo=1;
}
if(!strcmp_P(s, PSTR("false")) || !strcmp_P(s, PSTR("off")) || *s=='0'){
cli_echo=0;
}
}
typedef void(*str_fpt)(char*);
#define CLI_ENTER 13
#define CLI_BACKSPACE 8
#define CLI_TABULATOR 9
int8_t search_and_call(char* cmd, uint16_t maxcmdlength, PGM_VOID_P cmdlist){
PGM_VOID_P cmdlist_orig = cmdlist;
if(*cmd=='\0' || *cmd=='#')
return 1;
if(!strcmp_P(cmd, PSTR("exit")))
return 0;
if((!strcmp_P(cmd, PSTR("help"))) || (!strcmp_P(cmd, PSTR("?")))){
cli_auto_help(maxcmdlength, cmdlist);
return 1;
}
uint16_t fwlength=firstword_length(cmd);
char fw[fwlength+1];
memcpy(fw, cmd, fwlength);
fw[fwlength] = '\0';
cmdlist_entry_t item;
do{
item.cmd_name = (void*)pgm_read_word(cmdlist+0);
item.cmd_param_str = (void*)pgm_read_word(cmdlist+2);
item.cmd_function = (void_fpt)pgm_read_word(cmdlist+4);
cmdlist = (uint8_t*)cmdlist+CMDLIST_ENTRY_SIZE;
}while(item.cmd_name!=NULL && strcmp_P(fw, item.cmd_name));
if(item.cmd_name==NULL){
cli_auto_help(maxcmdlength, cmdlist_orig);
} else {
if(item.cmd_function==NULL)
return 2;
switch((uint16_t)item.cmd_param_str){
case 0:
item.cmd_function();
break;
case 1:
if(cmd[fwlength]=='\0'){
((str_fpt)item.cmd_function)(cmd+fwlength);
} else {
((str_fpt)item.cmd_function)(cmd+fwlength+1);
}
break;
default:
cli_putstr_P(PSTR("\r\nparam parsing currently not implemented!\r\n"));
break;
}
}
return 1;
}
uint16_t max_cmd_length(PGM_VOID_P cmdlist){
uint16_t t,ret=0;
char* str;
for(;;){
str = (char*)pgm_read_word(cmdlist);
cmdlist = (uint8_t*)cmdlist + CMDLIST_ENTRY_SIZE;
if(str==NULL)
return ret;
t = strlen_P(str);
if(t>ret)
ret=t;
}
}
uint8_t cli_completion(char* buffer, uint16_t maxcmdlength, PGM_VOID_P cmdlist){
uint8_t i=0;
char ref[maxcmdlength+1];
char* itemstr;
ref[0]='\0';
/* check if we are behind the first word */
while(buffer[i]){
if(!isgraph(buffer[i++]))
return 0;
}
for(;;){
itemstr = (char*)pgm_read_word(cmdlist);
if(itemstr==NULL)
break;
cmdlist = (uint8_t*)cmdlist +CMDLIST_ENTRY_SIZE;
if(!strncmp_P(buffer, itemstr, i)){
if(!ref[0]){
strcpy_P(ref, itemstr);
}else{
ref[stridentcnt_P(ref, itemstr)]='\0';
}
}
}
i = strcmp(buffer, ref);
if(i)
strcpy(buffer, ref);
return ~i;
}
void cli_option_listing(char* buffer, PGM_VOID_P cmdlist){
char* itemstr;
uint16_t len=strlen(buffer);
for(;;){
itemstr = (char*)pgm_read_word(cmdlist);
if(itemstr==NULL){
cli_putstr_P(PSTR("\r\n>"));
cli_putstr(buffer);
return;
}
cmdlist = (uint8_t*)cmdlist +CMDLIST_ENTRY_SIZE;
if(!strncmp_P(buffer, itemstr, len)){
cli_putstr_P(PSTR("\r\n "));
cli_putstr_P(itemstr);
}
}
}
int8_t cmd_interface(PGM_VOID_P cmd_desc){
uint16_t cli_buffer_size;
uint16_t cli_buffer_index;
int8_t exit_code;
uint8_t completion_failed=0;
char* cli_buffer;
char c;
uint16_t maxcmdlength = max_cmd_length(cmd_desc);
cli_buffer = calloc(1,cli_buffer_size=maxcmdlength+2);
cli_buffer_index=0;
if(!cli_rx)
return -1;
if(cli_tx)
cli_tx('>');
for(;;){
c = cli_rx();
switch (c){
case CLI_ENTER:
if((exit_code=search_and_call(cli_buffer, maxcmdlength, cmd_desc))<=0){
free(cli_buffer);
return exit_code;
}
memset(cli_buffer, 0, cli_buffer_size);
cli_buffer_index=0;
cli_putstr_P(PSTR("\r\n>"));
completion_failed=0;
break;
case CLI_BACKSPACE:
completion_failed=0;
if(cli_buffer_index==0)
break;
cli_buffer_index--;
cli_buffer[cli_buffer_index] = '\0';
if(cli_echo && cli_tx){
cli_tx(c);
}
break;
case CLI_TABULATOR:
if(completion_failed || cli_buffer_index==0){
if(cli_tx)
cli_option_listing(cli_buffer, cmd_desc);
} else {
uint16_t old_idx = cli_buffer_index;
completion_failed =
~cli_completion(cli_buffer, maxcmdlength, cmd_desc);
cli_buffer_index = strlen(cli_buffer);
if(cli_echo && cli_tx){
while(old_idx<cli_buffer_index){
cli_tx(cli_buffer[old_idx++]);
}
}
}
break;
default:
completion_failed=0;
if(cli_echo && cli_tx){
cli_tx(c);
}
if(cli_buffer_index+1==cli_buffer_size){
cli_buffer = realloc(cli_buffer, cli_buffer_size+=CLI_BUFFER_BS);
if(!cli_buffer){
return -2;
}
memset(cli_buffer+cli_buffer_index+1, 0, CLI_BUFFER_BS);
}
cli_buffer[cli_buffer_index++] = c;
}
}
}

View File

@ -24,7 +24,7 @@
#include "config.h"
#if DEBUG == uart
#include "uart.h"
#include "uart_i.h"
#else
#error "Your DEBUG methode is not suported!"
#endif
@ -32,7 +32,7 @@
#ifdef DEBUG
void debug_init(void){
#if DBUG==uart
uart_init();
uart0_init();
#else
#error "Your DEBUG methode is not suported!"
#endif
@ -41,10 +41,10 @@
void debug_char(char c){
static char initialised = 0;
if (!initialised){
uart_init();
uart0_init();
initialised=1;
}
uart_putc(c);
uart0_putc(c);
}
void debug_str(char* s){

436
test_src/dump-asm.S Normal file
View File

@ -0,0 +1,436 @@
/* dump-asm.S */
/*
This file is part of the AVR-Huffman.
Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "avr-asm-macros.S"
#include <avr/io.h>
#include <avr/sfr_defs.h>
#define DUMP_WIDTH 16
#define ADDR_BASE 16
/******************************************************************************/
/* uint8_t charisinstr_P(char c, PGM_P str)
* param c: r24
* param str: r22:r23
*/
charisinstr_P:
movw r30, r22
1:
lpm r22, Z+
tst r22
brne 2f
clr r24
ret
2:
cp r22, r24
brne 1b
ldi r24, 1
ret
/******************************************************************************/
/* void dump_chars(uint8_t* buffer, uint8_t len)
* param buffer: r24:r25
* param len: r22
*/
dump_chars:
push r16
push r17
push r28
push r29
movw r28, r24
mov r16, r22
ldi r24, '|'
clr r25
call cli_putc
mov r17, r16
1:
ld r24, Y
clr r25
call isprint
tst r24
brne 2f
ldi r24, '.'
adiw r28, 1
rjmp 3f
2: ld r24, Y+
3:
clr r25
call cli_putc
dec r17
brne 1b
subi r16, DUMP_WIDTH
tst r16
breq 5f
neg r16
4:
ldi r24, ' '
clr r25
call cli_putc
dec r16
brne 4b
5:
ldi r24, '|'
clr r25
call cli_putc
pop r29
pop r28
pop r17
pop r16
ret
/*****************************************************************************/
/* void print_aligned(unsigned long value, uint8_t align)
* param value: r22:r25
* param align: r20
*/
print_aligned:
push r16
push r28
push r29
stack_alloc 12, r28, r29
adiw r28, 1
mov r16, r20
movw r20, r28
ldi r18, ADDR_BASE
clr r19
call ultoa
movw r24, r28
call strlen
sub r16, r24
brmi 3f
breq 3f
1:
ldi r24, ' '
clr r25
call cli_putc
dec r16
brne 1b
3:
movw r24, r28
call cli_putstr
stack_free 12
pop r29
pop r28
pop r16
ret
/*****************************************************************************/
/* void dump(char* s)
* param s: r24:r25
*/
STR_0 = 4
STR_1 = 5
ADDR_0 = 6
ADDR_1 = 7
ADDR_2 = 8
ADDR_3 = 9
SIZE_0 = 10
SIZE_1 = 11
SIZE_2 = 12
SIZE_3 = 13
MEM_0 = 14
MEM_1 = 15
xREADLEN = 16
TMP = 17
.global dump
dump:
call strstrip
push_range 4, 17
push_range 28, 29
movw r26, r24
ld TMP, X
movw STR_0, r26
ldi r30, lo8(memtype_desc)
ldi r31, hi8(memtype_desc)
1:
lpm r22, Z+
lpm r23, Z+
tst r22
brne 2f
tst r23
breq 5f
2:
movw r28, r30
mov r24, TMP
clr r25
rcall charisinstr_P
movw r30, r28
tst r24
brne 6f
adiw r30, 4
rjmp 1b
5:
ldi r30, lo8(memtype_desc+2)
ldi r31, hi8(memtype_desc+2)
6:
movw MEM_0, r30
movw r26, STR_0
61:
ld r20, X+
ori r20, 'A'^'a'
cpi r20, 'a'
brmi 7f
cpi r20, 'z'+1
brge 7f
rjmp 61b
7:
sbiw r26, 1
stack_alloc 2+DUMP_WIDTH, r28, r29
adiw r28, 1
movw r24, r26
movw r22, r28
clr r20
clr r21
call strtoul
movw ADDR_0, r22
movw ADDR_2, r24
ld r24, Y+
ld r25, Y+
clr r23
clr r22
clr r21
clr r20
call strtoul
movw SIZE_0, r22
movw SIZE_2, r24
tst SIZE_0
brne 72f
tst SIZE_1
brne 72f
tst SIZE_2
brne 72f
tst SIZE_3
brne 72f
ldi TMP, 128
mov SIZE_0, TMP
72:
ldi r24, lo8(dumping)
ldi r25, hi8(dumping)
call cli_putstr_P
movw r24, SIZE_2
movw r22, SIZE_0
movw r20, r28
clr r19
ldi r18, 10
call ultoa
movw r24, r28
call cli_putstr
ldi r24, lo8(bytesof)
ldi r25, hi8(bytesof)
call cli_putstr_P
movw r30, MEM_0
lpm r24, Z+
lpm r25, Z+
call cli_putstr_P
ldi r24, lo8(beginning)
ldi r25, hi8(beginning)
call cli_putstr_P
movw r24, ADDR_2
movw r22, ADDR_0
movw r20, r28
clr r19
ldi r18, 16
call ultoa
movw r24, r28
call cli_putstr
ldi r24, lo8(suffix)
ldi r25, hi8(suffix)
call cli_putstr_P
movw r30, MEM_0
adiw r30, 2
lpm MEM_0, Z+
lpm MEM_1, Z
1:
ldi xREADLEN, DUMP_WIDTH
tst SIZE_3
brne 3f
tst SIZE_2
brne 3f
tst SIZE_1
brne 3f
tst SIZE_0
brne 2f
rjmp 90f
2:
cp DUMP_WIDTH, SIZE_0
brmi 3f
mov xREADLEN, SIZE_0
3:
movw r24, r28
movw r22, ADDR_2
movw r20, ADDR_0
clr r19
mov r18, xREADLEN
movw r30, MEM_0
icall
movw r24, ADDR_2
movw r22, ADDR_0
clr r21
ldi r20, 6
rcall print_aligned
clr r25
ldi r24, ':'
call cli_putc
clr r25
ldi r24, ' '
call cli_putc
movw r24, r28
clr r23
mov r22, xREADLEN
call cli_hexdump2
ldi TMP, DUMP_WIDTH
sub TMP, xREADLEN
tst TMP
breq 5f
4:
clr r25
ldi r24, ' '
call cli_putc
clr r25
ldi r24, ' '
call cli_putc
clr r25
ldi r24, ' '
call cli_putc
dec TMP
brne 4b
5:
clr r25
ldi r24, '\t'
call cli_putc
movw r24, r28
clr r23
mov r22, xREADLEN
rcall dump_chars
add ADDR_0, xREADLEN
adc ADDR_1, r1
adc ADDR_2, r1
adc ADDR_3, r1
sub SIZE_0, xREADLEN
sbc SIZE_1, r1
sbc SIZE_2, r1
sbc SIZE_3, r1
clr r25
ldi r24, '\r'
call cli_putc
clr r25
ldi r24, '\n'
call cli_putc
rjmp 1b
90:
stack_free 2+DUMP_WIDTH
pop_range 28,29
pop_range 4, 17
ret
dumping:
.asciz "\r\ndumping "
bytesof:
.asciz " bytes of "
beginning:
.asciz ", beginnig at 0x"
suffix:
.asciz ":\r\n"
.byte 0
/******************************************************************************/
/* void pgm_read_block(void* buffer, uint32_t addr, uint8_t length)
* param buffer: r24:r25
* param addr: r20:r23
* param length: r18
*/
.global pgm_read_block
pgm_read_block:
#if RAMEND<0x10000
movw r26, r24
movw r30, r20
tst r18
breq 3f
1:
lpm r20, Z+
st X+, r20
dec r18
brne 1b
3:
ret
#else
movw r26, r24
movw r30, r20
out RAMPZ, r22
tst r18
breq 3f
1:
elpm r20, Z+
st X+, r20
dec r18
brne 1b
3:
ret
#endif
/******************************************************************************/
/* void ram_read_block(void* buffer, uint32_t addr, uint8_t length)
* param buffer: r24:r25
* param addr: r20:r23
* param length: r18
*/
.global ram_read_block
ram_read_block:
movw r26, r24
movw r30, r20
tst r18
breq 3f
1:
ld r20, Z+
st X+, r20
dec r18
brne 1b
3:
ret
/******************************************************************************/
/* void ee_read_block(void* buffer, uint32_t addr, uint8_t length)
* param buffer: r24:r25
* param addr: r20:r23
* param length: r18
*/
.global ee_read_block
ee_read_block:
movw r26, r24
movw r30, r20
tst r18
breq 3f
1:
sbic _SFR_IO_ADDR(EECR), EEPE
rjmp 1b
out _SFR_IO_ADDR(EEARH), r31
out _SFR_IO_ADDR(EEARL), r30
sbi _SFR_IO_ADDR(EECR), EERE
adiw r30, 1
in r20, _SFR_IO_ADDR(EEDR)
st X+, r20
dec r18
brne 1b
3:
ret

64
test_src/dump-decl.c Normal file
View File

@ -0,0 +1,64 @@
/* dump.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file dump.c
* \email daniel.otte@rub.de
* \author Daniel Otte
* \date 2009-02-04
* \license GPLv3 or later
*
*/
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include "cli.h"
#include "string-extras.h"
#define DUMP_WIDTH 16
void pgm_read_block(void* buffer, uint32_t addr, uint8_t length);
void ee_read_block(void* buffer, uint32_t addr, uint8_t length);
void ram_read_block(void* buffer, uint32_t addr, uint8_t length);
const char flash_trigger[] PROGMEM = "fF";
const char ram_trigger[] PROGMEM = "sSrRmM";
const char eeprom_trigger[] PROGMEM = "eE";
const char flash_desc[] PROGMEM = "flash";
const char ram_desc[] PROGMEM = "ram";
const char eeprom_desc[] PROGMEM = "eeprom";
typedef struct {
PGM_P trigger;
PGM_P desc;
void (*fpt)(void*, uint32_t, uint8_t);
} memtype_desc_t;
memtype_desc_t memtype_desc[] PROGMEM = {
{ flash_trigger, flash_desc, pgm_read_block },
{ eeprom_trigger, eeprom_desc, ee_read_block },
{ ram_trigger, ram_desc , ram_read_block },
{ NULL, NULL, NULL }
};
void dump(char* s);

View File

@ -1,127 +0,0 @@
/* dump.c */
/*
This file is part of the AVR-Crypto-Lib.
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file dump.c
* \email daniel.otte@rub.de
* \author Daniel Otte
* \date 2009-02-04
* \license GPLv3 or later
*
*/
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <avr/pgmspace.h>
#include "cli.h"
#include "string-extras.h"
#define DUMP_WIDTH 16
static
void dump_chars(uint8_t* buffer){
uint8_t i;
cli_putc('|');
for(i=0; i<DUMP_WIDTH; ++i){
if(isprint(buffer[i])){
cli_putc(buffer[i]);
}else{
cli_putc('.');
}
}
cli_putc('|');
}
void dump(char* s){
uint8_t flash=1;
uint32_t addr=0;
uint32_t size=128;
uint8_t i,buffer[DUMP_WIDTH];
char tstr[9];
s=strstrip(s);
if(*s=='r' || *s=='R' || *s=='m' || *s=='M')
flash=0;
if(isalpha(*s)){
while(isalpha(*s))
++s;
}
char* eptr;
if(*s)
addr = strtoul(s, &eptr, 0);
if(eptr)
size = strtoul(eptr, NULL, 0);
if(!size)
size = 32;
cli_putstr_P(PSTR("\r\ndumping "));
ultoa(size, tstr, 10);
cli_putstr(tstr);
cli_putstr_P(PSTR(" bytes of "));
cli_putstr_P(flash?PSTR("flash"):PSTR("ram"));
cli_putstr_P(PSTR(", beginning at 0x"));
ultoa(addr, tstr, 16);
cli_putstr(tstr);
cli_putstr_P(PSTR(":\r\n"));
while(size>=DUMP_WIDTH){
if(flash){
for(i=0; i<DUMP_WIDTH; ++i){
#ifdef pgm_read_byte_far
buffer[i]=pgm_read_byte_far(addr+i);
#else
buffer[i]=pgm_read_byte(addr+i);
#endif
}
}else{
memcpy(buffer, (void*)((uint16_t)addr), DUMP_WIDTH);
}
ultoa(addr, tstr, 16);
sprintf(tstr,"%6lX", addr);
cli_putstr(tstr);
cli_putstr_P(PSTR(": "));
cli_hexdump2(buffer, DUMP_WIDTH);
cli_putc('\t');
dump_chars(buffer);
addr+=DUMP_WIDTH;
size-=DUMP_WIDTH;
cli_putstr_P(PSTR("\r\n"));
}
if(size){
if(flash){
for(i=0; i<size; ++i){
#ifdef pgm_read_byte_far
buffer[i]=pgm_read_byte_far(addr+i);
#else
buffer[i]=pgm_read_byte(addr+i);
#endif
}
}else{
memcpy(buffer, (void*)((uint16_t)addr), size);
}
ultoa(addr, tstr, 16);
sprintf(tstr,"%6lX", addr);
cli_putstr(tstr);
cli_putstr_P(PSTR(": "));
cli_hexdump2(buffer, size);
cli_putstr_P(PSTR("\r\n"));
}
}

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include <A5_1.h>
@ -79,8 +79,8 @@ int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "aes.h"
@ -319,8 +319,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "aes.h"
@ -170,8 +170,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "aes.h"
@ -149,8 +149,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "aes.h"
@ -151,8 +151,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include <arcfour.h>
@ -107,8 +107,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "noekeon.h"
@ -154,8 +154,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "blake_small.h"
@ -132,8 +132,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&blake32_desc;
for(;;){

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "bmw_small.h"
@ -134,8 +134,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&bmw256_desc;
for(;;){

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "camellia.h"
@ -158,8 +158,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include <cast5.h>
@ -209,8 +209,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -5,7 +5,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "cast6.h"
@ -156,8 +156,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "des.h"
@ -113,8 +113,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "entropium.h"
@ -45,7 +45,7 @@ void testrun_entropium(void){
char c, str[16];
uint8_t data[32];
uint32_t i=0;
while(!uart_getc_nb(&c)){
while('q'!=cli_getc()){
entropium_getRandomBlock(data);
cli_putstr_P(PSTR("\r\n "));
ultoa(i, str, 10);
@ -106,8 +106,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "cli.h"
@ -169,8 +169,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "groestl_small.h"
@ -134,8 +134,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
shavs_algolist=(hfdesc_t**)algolist;
shavs_algo=(hfdesc_t*)&groestl256_desc;
for(;;){

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "md5.h"
@ -181,8 +181,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "sha1.h"
@ -76,8 +76,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "sha256.h"
@ -94,8 +94,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "md5.h"
@ -142,8 +142,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -5,7 +5,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "cli.h"
@ -137,8 +137,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "mugi.h"
@ -129,8 +129,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include <noekeon.h>
@ -231,8 +231,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "noekeon.h"
@ -168,8 +168,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include <present.h>
@ -143,8 +143,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "rc5.h"
@ -121,8 +121,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -23,7 +23,7 @@
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "rc6.h"
@ -128,8 +128,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

View File

@ -28,7 +28,7 @@
*/
#include "config.h"
#include "serial-tools.h"
#include "uart.h"
#include "uart_i.h"
#include "debug.h"
#include "seed.h"
@ -179,8 +179,8 @@ cmdlist_entry_t cmdlist[] PROGMEM = {
int main (void){
DEBUG_INIT();
cli_rx = uart_getc;
cli_tx = uart_putc;
cli_rx = (cli_rx_fpt)uart0_getc;
cli_tx = (cli_tx_fpt)uart0_putc;
for(;;){
cli_putstr_P(PSTR("\r\n\r\nCrypto-VS ("));
cli_putstr(algo_name);

Some files were not shown because too many files have changed in this diff Show More