text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE eagle SYSTEM "eagle.dtd">
<eagle version="6.5.0">
<drawing>
<settings>
<setting alwaysvectorfont="no"/>
<setting verticaltext="up"/>
</settings>
<grid distance="0.05" unitdist="inch" unit="inch" style="lines" multiple="1" display="no" altdistance="0.01" altunitdist="inch" altunit="inch"/>
<layers>
<layer number="1" name="Top" color="4" fill="1" visible="yes" active="yes"/>
<layer number="2" name="Route2" color="1" fill="3" visible="no" active="no"/>
<layer number="3" name="Route3" color="4" fill="3" visible="no" active="no"/>
<layer number="4" name="Route4" color="1" fill="4" visible="no" active="no"/>
<layer number="5" name="Route5" color="4" fill="4" visible="no" active="no"/>
<layer number="6" name="Route6" color="1" fill="8" visible="no" active="no"/>
<layer number="7" name="Route7" color="4" fill="8" visible="no" active="no"/>
<layer number="8" name="Route8" color="1" fill="2" visible="no" active="no"/>
<layer number="9" name="Route9" color="4" fill="2" visible="no" active="no"/>
<layer number="10" name="Route10" color="1" fill="7" visible="no" active="no"/>
<layer number="11" name="Route11" color="4" fill="7" visible="no" active="no"/>
<layer number="12" name="Route12" color="1" fill="5" visible="no" active="no"/>
<layer number="13" name="Route13" color="4" fill="5" visible="no" active="no"/>
<layer number="14" name="Route14" color="1" fill="6" visible="no" active="no"/>
<layer number="15" name="Route15" color="4" fill="6" visible="no" active="no"/>
<layer number="16" name="Bottom" color="1" fill="1" visible="yes" active="yes"/>
<layer number="17" name="Pads" color="2" fill="1" visible="yes" active="yes"/>
<layer number="18" name="Vias" color="2" fill="1" visible="yes" active="yes"/>
<layer number="19" name="Unrouted" color="6" fill="1" visible="yes" active="yes"/>
<layer number="20" name="Dimension" color="15" fill="1" visible="yes" active="yes"/>
<layer number="21" name="tPlace" color="7" fill="1" visible="yes" active="yes"/>
<layer number="22" name="bPlace" color="7" fill="1" visible="yes" active="yes"/>
<layer number="23" name="tOrigins" color="15" fill="1" visible="yes" active="yes"/>
<layer number="24" name="bOrigins" color="15" fill="1" visible="yes" active="yes"/>
<layer number="25" name="tNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="26" name="bNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="27" name="tValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="28" name="bValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="29" name="tStop" color="7" fill="3" visible="yes" active="yes"/>
<layer number="30" name="bStop" color="7" fill="6" visible="yes" active="yes"/>
<layer number="31" name="tCream" color="7" fill="4" visible="yes" active="yes"/>
<layer number="32" name="bCream" color="7" fill="5" visible="yes" active="yes"/>
<layer number="33" name="tFinish" color="6" fill="3" visible="yes" active="yes"/>
<layer number="34" name="bFinish" color="6" fill="6" visible="yes" active="yes"/>
<layer number="35" name="tGlue" color="7" fill="4" visible="yes" active="yes"/>
<layer number="36" name="bGlue" color="7" fill="5" visible="yes" active="yes"/>
<layer number="37" name="tTest" color="7" fill="1" visible="yes" active="yes"/>
<layer number="38" name="bTest" color="7" fill="1" visible="yes" active="yes"/>
<layer number="39" name="tKeepout" color="4" fill="11" visible="yes" active="yes"/>
<layer number="40" name="bKeepout" color="1" fill="11" visible="yes" active="yes"/>
<layer number="41" name="tRestrict" color="4" fill="10" visible="yes" active="yes"/>
<layer number="42" name="bRestrict" color="1" fill="10" visible="yes" active="yes"/>
<layer number="43" name="vRestrict" color="2" fill="10" visible="yes" active="yes"/>
<layer number="44" name="Drills" color="7" fill="1" visible="yes" active="yes"/>
<layer number="45" name="Holes" color="7" fill="1" visible="yes" active="yes"/>
<layer number="46" name="Milling" color="3" fill="1" visible="yes" active="yes"/>
<layer number="47" name="Measures" color="7" fill="1" visible="yes" active="yes"/>
<layer number="48" name="Document" color="7" fill="1" visible="yes" active="yes"/>
<layer number="49" name="Reference" color="7" fill="1" visible="yes" active="yes"/>
<layer number="50" name="dxf" color="7" fill="1" visible="no" active="no"/>
<layer number="51" name="tDocu" color="7" fill="1" visible="yes" active="yes"/>
<layer number="52" name="bDocu" color="7" fill="1" visible="yes" active="yes"/>
<layer number="53" name="tGND_GNDA" color="7" fill="9" visible="no" active="no"/>
<layer number="54" name="bGND_GNDA" color="1" fill="9" visible="no" active="no"/>
<layer number="56" name="wert" color="7" fill="1" visible="no" active="no"/>
<layer number="57" name="tCAD" color="7" fill="1" visible="no" active="no"/>
<layer number="59" name="tCarbon" color="7" fill="1" visible="no" active="no"/>
<layer number="60" name="bCarbon" color="7" fill="1" visible="no" active="no"/>
<layer number="90" name="Modules" color="5" fill="1" visible="yes" active="yes"/>
<layer number="91" name="Nets" color="2" fill="1" visible="no" active="no"/>
<layer number="92" name="Busses" color="1" fill="1" visible="no" active="no"/>
<layer number="93" name="Pins" color="2" fill="1" visible="no" active="no"/>
<layer number="94" name="Symbols" color="4" fill="1" visible="no" active="no"/>
<layer number="95" name="Names" color="7" fill="1" visible="no" active="no"/>
<layer number="96" name="Values" color="7" fill="1" visible="no" active="no"/>
<layer number="97" name="Info" color="7" fill="1" visible="no" active="no"/>
<layer number="98" name="Guide" color="6" fill="1" visible="no" active="no"/>
<layer number="99" name="SpiceOrder" color="7" fill="1" visible="no" active="no"/>
<layer number="100" name="Muster" color="7" fill="1" visible="no" active="no"/>
<layer number="101" name="Patch_Top" color="12" fill="4" visible="yes" active="yes"/>
<layer number="102" name="Vscore" color="7" fill="1" visible="yes" active="yes"/>
<layer number="103" name="tMap" color="7" fill="1" visible="yes" active="yes"/>
<layer number="104" name="Name" color="16" fill="1" visible="yes" active="yes"/>
<layer number="105" name="tPlate" color="7" fill="1" visible="yes" active="yes"/>
<layer number="106" name="bPlate" color="7" fill="1" visible="yes" active="yes"/>
<layer number="107" name="Crop" color="7" fill="1" visible="yes" active="yes"/>
<layer number="108" name="tplace-old" color="10" fill="1" visible="yes" active="yes"/>
<layer number="109" name="ref-old" color="11" fill="1" visible="yes" active="yes"/>
<layer number="110" name="fp0" color="7" fill="1" visible="yes" active="yes"/>
<layer number="111" name="LPC17xx" color="7" fill="1" visible="yes" active="yes"/>
<layer number="112" name="tSilk" color="7" fill="1" visible="yes" active="yes"/>
<layer number="113" name="IDFDebug" color="4" fill="1" visible="yes" active="yes"/>
<layer number="114" name="Badge_Outline" color="7" fill="1" visible="yes" active="yes"/>
<layer number="115" name="ReferenceISLANDS" color="7" fill="1" visible="yes" active="yes"/>
<layer number="116" name="Patch_BOT" color="9" fill="4" visible="yes" active="yes"/>
<layer number="118" name="Rect_Pads" color="7" fill="1" visible="yes" active="yes"/>
<layer number="121" name="_tsilk" color="7" fill="1" visible="yes" active="yes"/>
<layer number="122" name="_bsilk" color="7" fill="1" visible="yes" active="yes"/>
<layer number="123" name="tTestmark" color="7" fill="1" visible="yes" active="yes"/>
<layer number="124" name="bTestmark" color="7" fill="1" visible="yes" active="yes"/>
<layer number="125" name="_tNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="126" name="_bNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="127" name="_tValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="128" name="_bValues" color="7" fill="1" visible="yes" active="yes"/>
<layer number="129" name="Mask" color="7" fill="1" visible="yes" active="yes"/>
<layer number="131" name="tAdjust" color="7" fill="1" visible="yes" active="yes"/>
<layer number="132" name="bAdjust" color="7" fill="1" visible="yes" active="yes"/>
<layer number="144" name="Drill_legend" color="7" fill="1" visible="yes" active="yes"/>
<layer number="150" name="Notes" color="7" fill="1" visible="yes" active="yes"/>
<layer number="151" name="HeatSink" color="7" fill="1" visible="yes" active="yes"/>
<layer number="152" name="_bDocu" color="7" fill="1" visible="yes" active="yes"/>
<layer number="153" name="FabDoc1" color="7" fill="1" visible="yes" active="yes"/>
<layer number="154" name="FabDoc2" color="7" fill="1" visible="yes" active="yes"/>
<layer number="155" name="FabDoc3" color="7" fill="1" visible="yes" active="yes"/>
<layer number="199" name="Contour" color="7" fill="1" visible="yes" active="yes"/>
<layer number="200" name="200bmp" color="1" fill="10" visible="yes" active="yes"/>
<layer number="201" name="201bmp" color="2" fill="10" visible="yes" active="yes"/>
<layer number="202" name="202bmp" color="3" fill="10" visible="yes" active="yes"/>
<layer number="203" name="203bmp" color="4" fill="10" visible="yes" active="yes"/>
<layer number="204" name="204bmp" color="5" fill="10" visible="yes" active="yes"/>
<layer number="205" name="205bmp" color="6" fill="10" visible="yes" active="yes"/>
<layer number="206" name="206bmp" color="7" fill="10" visible="yes" active="yes"/>
<layer number="207" name="207bmp" color="8" fill="10" visible="yes" active="yes"/>
<layer number="208" name="208bmp" color="9" fill="10" visible="yes" active="yes"/>
<layer number="209" name="209bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="210" name="210bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="211" name="211bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="212" name="212bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="213" name="213bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="214" name="214bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="215" name="215bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="216" name="216bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="217" name="217bmp" color="18" fill="1" visible="no" active="no"/>
<layer number="218" name="218bmp" color="19" fill="1" visible="no" active="no"/>
<layer number="219" name="219bmp" color="20" fill="1" visible="no" active="no"/>
<layer number="220" name="220bmp" color="21" fill="1" visible="no" active="no"/>
<layer number="221" name="221bmp" color="22" fill="1" visible="no" active="no"/>
<layer number="222" name="222bmp" color="23" fill="1" visible="no" active="no"/>
<layer number="223" name="223bmp" color="24" fill="1" visible="no" active="no"/>
<layer number="224" name="224bmp" color="25" fill="1" visible="no" active="no"/>
<layer number="225" name="225bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="226" name="226bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="227" name="227bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="228" name="228bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="229" name="229bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="230" name="230bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="231" name="231bmp" color="7" fill="1" visible="yes" active="yes"/>
<layer number="248" name="Housing" color="7" fill="1" visible="yes" active="yes"/>
<layer number="249" name="Edge" color="7" fill="1" visible="yes" active="yes"/>
<layer number="250" name="Descript" color="3" fill="1" visible="no" active="no"/>
<layer number="251" name="SMDround" color="12" fill="11" visible="no" active="no"/>
<layer number="254" name="cooling" color="7" fill="1" visible="yes" active="yes"/>
<layer number="255" name="routoute" color="7" fill="1" visible="yes" active="yes"/>
</layers>
<board>
<plain>
<wire x1="0" y1="0" x2="50.78" y2="0" width="0" layer="20"/>
<wire x1="50.78" y1="0" x2="50.78" y2="32.69" width="0" layer="20"/>
<wire x1="50.78" y1="32.69" x2="0" y2="32.69" width="0" layer="20"/>
<wire x1="0" y1="32.69" x2="0" y2="0" width="0" layer="20"/>
<wire x1="0" y1="33.02" x2="50.8" y2="33.02" width="0.4064" layer="29"/>
<wire x1="50.8" y1="33.02" x2="50.8" y2="0" width="0.4064" layer="29"/>
<wire x1="50.8" y1="0" x2="0" y2="0" width="0.4064" layer="29"/>
<wire x1="0" y1="0" x2="0" y2="33.02" width="0.4064" layer="29"/>
<text x="2.54" y="28.448" size="1.778" layer="1">MARS</text>
<text x="40.386" y="28.448" size="1.778" layer="1">AQUA</text>
<text x="2.54" y="2.54" size="1.778" layer="1">PWM</text>
<rectangle x1="44.704" y1="20.828" x2="46.736" y2="22.352" layer="1"/>
<rectangle x1="44.958" y1="13.208" x2="46.482" y2="14.732" layer="1"/>
<rectangle x1="44.704" y1="15.748" x2="46.482" y2="17.272" layer="1"/>
<rectangle x1="44.704" y1="18.288" x2="46.736" y2="19.812" layer="1"/>
</plain>
<libraries>
<library name="SMD-RJ45">
<packages>
<package name="MOLEX-RJ45-SMT">
<wire x1="-5.06" y1="-7.47" x2="8.83" y2="-7.47" width="0.127" layer="51"/>
<wire x1="-5.06" y1="-7.47" x2="-5.06" y2="7.77" width="0.127" layer="21"/>
<wire x1="-5.06" y1="7.77" x2="8.83" y2="7.77" width="0.127" layer="51"/>
<wire x1="8.83" y1="7.77" x2="8.83" y2="-7.47" width="0.127" layer="21"/>
<wire x1="-5.06" y1="7.77" x2="-4.42" y2="7.77" width="0.127" layer="21"/>
<wire x1="0.31" y1="7.77" x2="8.83" y2="7.77" width="0.127" layer="21"/>
<wire x1="-5.06" y1="-7.47" x2="-4.4" y2="-7.47" width="0.127" layer="21"/>
<wire x1="8.83" y1="-7.47" x2="0.32" y2="-7.47" width="0.127" layer="21"/>
<smd name="P$1" x="-0.16" y="-8.97" dx="3" dy="4.5" layer="1" rot="R90"/>
<smd name="P$2" x="-0.06" y="9.28" dx="3" dy="4.5" layer="1" rot="R90"/>
<smd name="1" x="10.48" y="3.61" dx="3" dy="0.6" layer="1" rot="R180"/>
<smd name="2" x="10.48" y="2.64" dx="3" dy="0.6" layer="1" rot="R180"/>
<smd name="3" x="10.48" y="1.57" dx="3" dy="0.6" layer="1" rot="R180"/>
<smd name="4" x="10.48" y="0.5" dx="3" dy="0.6" layer="1" rot="R180"/>
<smd name="5" x="10.48" y="-0.57" dx="3" dy="0.6" layer="1" rot="R180"/>
<smd name="6" x="10.48" y="-1.64" dx="3" dy="0.6" layer="1" rot="R180"/>
<smd name="7" x="10.48" y="-2.61" dx="3" dy="0.6" layer="1" rot="R180"/>
<smd name="8" x="10.48" y="-3.68" dx="3" dy="0.6" layer="1" rot="R180"/>
<hole x="-0.1" y="6.8" drill="3.2"/>
<hole x="-0.1" y="-6.4" drill="3.2"/>
</package>
</packages>
</library>
<library name="SparkFun-Connectors">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find connectors and sockets- basically anything that can be plugged into or onto.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/

You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="1X04_LONGPADS">
<wire x1="-1.27" y1="0.635" x2="-1.27" y2="-0.635" width="0.2032" layer="21"/>
<wire x1="8.89" y1="0.635" x2="8.89" y2="-0.635" width="0.2032" layer="21"/>
<pad name="1" x="0" y="0" drill="1.1176" diameter="1.8796" shape="long" rot="R90"/>
<pad name="2" x="2.54" y="0" drill="1.1176" diameter="1.8796" shape="long" rot="R90"/>
<pad name="3" x="5.08" y="0" drill="1.1176" diameter="1.8796" shape="long" rot="R90"/>
<pad name="4" x="7.62" y="0" drill="1.1176" diameter="1.8796" shape="long" rot="R90"/>
<text x="-1.3462" y="2.4638" size="1.27" layer="25" ratio="10">>NAME</text>
<text x="-1.27" y="-3.81" size="1.27" layer="27">>VALUE</text>
<rectangle x1="7.366" y1="-0.254" x2="7.874" y2="0.254" layer="51"/>
<rectangle x1="4.826" y1="-0.254" x2="5.334" y2="0.254" layer="51"/>
<rectangle x1="2.286" y1="-0.254" x2="2.794" y2="0.254" layer="51"/>
<rectangle x1="-0.254" y1="-0.254" x2="0.254" y2="0.254" layer="51"/>
</package>
</packages>
</library>
<library name="SparkFun-Resistors">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find resistors, capacitors, inductors, test points, jumper pads, etc.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/

You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="1206">
<wire x1="-2.4003" y1="1.1049" x2="2.4003" y2="1.1049" width="0.0508" layer="39"/>
<wire x1="2.4003" y1="-1.1049" x2="-2.4003" y2="-1.1049" width="0.0508" layer="39"/>
<wire x1="-2.4003" y1="-1.1049" x2="-2.4003" y2="1.1049" width="0.0508" layer="39"/>
<wire x1="2.4003" y1="1.1049" x2="2.4003" y2="-1.1049" width="0.0508" layer="39"/>
<wire x1="-0.965" y1="0.787" x2="0.965" y2="0.787" width="0.1016" layer="51"/>
<wire x1="-0.965" y1="-0.787" x2="0.965" y2="-0.787" width="0.1016" layer="51"/>
<smd name="1" x="-1.4" y="0" dx="1.6" dy="1.8" layer="1"/>
<smd name="2" x="1.4" y="0" dx="1.6" dy="1.8" layer="1"/>
<text x="-1.27" y="1.143" size="0.4064" layer="25">>NAME</text>
<text x="-1.397" y="-1.524" size="0.4064" layer="27">>VALUE</text>
<rectangle x1="-1.7018" y1="-0.8509" x2="-0.9517" y2="0.8491" layer="51"/>
<rectangle x1="0.9517" y1="-0.8491" x2="1.7018" y2="0.8509" layer="51"/>
<rectangle x1="-0.1999" y1="-0.4001" x2="0.1999" y2="0.4001" layer="35"/>
</package>
</packages>
</library>
<library name="SparkFun-Capacitors">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find resistors, capacitors, inductors, test points, jumper pads, etc.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/

You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="1206">
<wire x1="-2.473" y1="0.983" x2="2.473" y2="0.983" width="0.0508" layer="39"/>
<wire x1="2.473" y1="-0.983" x2="-2.473" y2="-0.983" width="0.0508" layer="39"/>
<wire x1="-2.473" y1="-0.983" x2="-2.473" y2="0.983" width="0.0508" layer="39"/>
<wire x1="2.473" y1="0.983" x2="2.473" y2="-0.983" width="0.0508" layer="39"/>
<wire x1="-0.965" y1="0.787" x2="0.965" y2="0.787" width="0.1016" layer="51"/>
<wire x1="-0.965" y1="-0.787" x2="0.965" y2="-0.787" width="0.1016" layer="51"/>
<smd name="1" x="-1.4" y="0" dx="1.6" dy="1.8" layer="1"/>
<smd name="2" x="1.4" y="0" dx="1.6" dy="1.8" layer="1"/>
<text x="-1.27" y="1.143" size="0.4064" layer="25">>NAME</text>
<text x="-1.397" y="-1.524" size="0.4064" layer="27">>VALUE</text>
<rectangle x1="-1.7018" y1="-0.8509" x2="-0.9517" y2="0.8491" layer="51"/>
<rectangle x1="0.9517" y1="-0.8491" x2="1.7018" y2="0.8509" layer="51"/>
<rectangle x1="-0.1999" y1="-0.4001" x2="0.1999" y2="0.4001" layer="35"/>
</package>
</packages>
</library>
<library name="SparkFun-AnalogIC">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find all manner of analog ICs- DACs, ADCs, video chips, op-amps, and others.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing:Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/

You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="SO08">
<description>Small Outline Package Fits JEDEC packages (narrow SOIC-8)</description>
<circle x="-2.7813" y="-1.5748" radius="0.1436" width="0.2032" layer="21"/>
<wire x1="-2.362" y1="-1.803" x2="2.362" y2="-1.803" width="0.1524" layer="51"/>
<wire x1="2.362" y1="-1.803" x2="2.362" y2="1.803" width="0.1524" layer="21"/>
<wire x1="2.362" y1="1.803" x2="-2.362" y2="1.803" width="0.1524" layer="51"/>
<wire x1="-2.362" y1="1.803" x2="-2.362" y2="-1.803" width="0.1524" layer="21"/>
<rectangle x1="-2.0828" y1="-2.8702" x2="-1.7272" y2="-1.8542" layer="51"/>
<rectangle x1="-0.8128" y1="-2.8702" x2="-0.4572" y2="-1.8542" layer="51"/>
<rectangle x1="0.4572" y1="-2.8702" x2="0.8128" y2="-1.8542" layer="51"/>
<rectangle x1="1.7272" y1="-2.8702" x2="2.0828" y2="-1.8542" layer="51"/>
<rectangle x1="-2.0828" y1="1.8542" x2="-1.7272" y2="2.8702" layer="51"/>
<rectangle x1="-0.8128" y1="1.8542" x2="-0.4572" y2="2.8702" layer="51"/>
<rectangle x1="0.4572" y1="1.8542" x2="0.8128" y2="2.8702" layer="51"/>
<rectangle x1="1.7272" y1="1.8542" x2="2.0828" y2="2.8702" layer="51"/>
<smd name="1" x="-1.905" y="-2.6162" dx="0.6096" dy="2.2098" layer="1"/>
<smd name="2" x="-0.635" y="-2.6162" dx="0.6096" dy="2.2098" layer="1"/>
<smd name="3" x="0.635" y="-2.6162" dx="0.6096" dy="2.2098" layer="1"/>
<smd name="4" x="1.905" y="-2.6162" dx="0.6096" dy="2.2098" layer="1"/>
<smd name="5" x="1.905" y="2.6162" dx="0.6096" dy="2.2098" layer="1"/>
<smd name="6" x="0.635" y="2.6162" dx="0.6096" dy="2.2098" layer="1"/>
<smd name="7" x="-0.635" y="2.6162" dx="0.6096" dy="2.2098" layer="1"/>
<smd name="8" x="-1.905" y="2.6162" dx="0.6096" dy="2.2098" layer="1"/>
<text x="-1.27" y="-0.635" size="0.4064" layer="27">>VALUE</text>
<text x="-1.27" y="0" size="0.4064" layer="25">>NAME</text>
</package>
</packages>
</library>
<library name="SparkFun-DiscreteSemi">
<description>
SparkFun Electronics' preferred foot prints

In this library you'll find discrete semiconductors- transistors, diodes, TRIACs, optoisolators, etc.

We've spent an enormous amount of time creating and checking these footprints and parts, but it is the end user's responsibility to ensure correctness and suitablity for a given componet or application. If you enjoy using this library, please buy one of our products at www.sparkfun.com.

Licensing: Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/

You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage.</description>
<packages>
<package name="SOT23-3">
<wire x1="1.4224" y1="0.6604" x2="1.4224" y2="-0.6604" width="0.1524" layer="51"/>
<wire x1="1.4224" y1="-0.6604" x2="-1.4224" y2="-0.6604" width="0.1524" layer="51"/>
<wire x1="-1.4224" y1="-0.6604" x2="-1.4224" y2="0.6604" width="0.1524" layer="51"/>
<wire x1="-1.4224" y1="0.6604" x2="1.4224" y2="0.6604" width="0.1524" layer="51"/>
<wire x1="-0.8" y1="0.7" x2="-1.4" y2="0.7" width="0.2032" layer="21"/>
<wire x1="-1.4" y1="0.7" x2="-1.4" y2="-0.1" width="0.2032" layer="21"/>
<wire x1="0.8" y1="0.7" x2="1.4" y2="0.7" width="0.2032" layer="21"/>
<wire x1="1.4" y1="0.7" x2="1.4" y2="-0.1" width="0.2032" layer="21"/>
<smd name="1" x="-0.95" y="-1" dx="0.8" dy="0.9" layer="1"/>
<smd name="2" x="0.95" y="-1" dx="0.8" dy="0.9" layer="1"/>
<smd name="3" x="0" y="1.1" dx="0.8" dy="0.9" layer="1"/>
<text x="-0.8255" y="1.778" size="0.4064" layer="25">>NAME</text>
<text x="-1.016" y="-0.1905" size="0.4064" layer="27">>VALUE</text>
</package>
</packages>
</library>
</libraries>
<attributes>
</attributes>
<variantdefs>
</variantdefs>
<classes>
<class number="0" name="default" width="0" drill="0">
</class>
</classes>
<designrules name="default">
<description language="de">EAGLE Design Rules

Die Standard-Design-Rules sind so gewählt, dass sie für
die meisten Anwendungen passen. Sollte ihre Platine
besondere Anforderungen haben, treffen Sie die erforderlichen
Einstellungen hier und speichern die Design Rules unter
einem neuen Namen ab.</description>
<description language="en">EAGLE Design Rules

The default Design Rules have been set to cover
a wide range of applications. Your particular design
may have different requirements, so please make the
necessary adjustments and save your customized
design rules under a new name.</description>
<param name="layerSetup" value="(1*16)"/>
<param name="mtCopper" value="0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm"/>
<param name="mtIsolate" value="1.5mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm"/>
<param name="mdWireWire" value="8mil"/>
<param name="mdWirePad" value="8mil"/>
<param name="mdWireVia" value="8mil"/>
<param name="mdPadPad" value="8mil"/>
<param name="mdPadVia" value="8mil"/>
<param name="mdViaVia" value="8mil"/>
<param name="mdSmdPad" value="8mil"/>
<param name="mdSmdVia" value="8mil"/>
<param name="mdSmdSmd" value="8mil"/>
<param name="mdViaViaSameLayer" value="8mil"/>
<param name="mnLayersViaInSmd" value="2"/>
<param name="mdCopperDimension" value="40mil"/>
<param name="mdDrill" value="8mil"/>
<param name="mdSmdStop" value="0mil"/>
<param name="msWidth" value="10mil"/>
<param name="msDrill" value="24mil"/>
<param name="msMicroVia" value="9.99mm"/>
<param name="msBlindViaRatio" value="0.5"/>
<param name="rvPadTop" value="0.25"/>
<param name="rvPadInner" value="0.25"/>
<param name="rvPadBottom" value="0.25"/>
<param name="rvViaOuter" value="0.25"/>
<param name="rvViaInner" value="0.25"/>
<param name="rvMicroViaOuter" value="0.25"/>
<param name="rvMicroViaInner" value="0.25"/>
<param name="rlMinPadTop" value="10mil"/>
<param name="rlMaxPadTop" value="20mil"/>
<param name="rlMinPadInner" value="10mil"/>
<param name="rlMaxPadInner" value="20mil"/>
<param name="rlMinPadBottom" value="10mil"/>
<param name="rlMaxPadBottom" value="20mil"/>
<param name="rlMinViaOuter" value="8mil"/>
<param name="rlMaxViaOuter" value="20mil"/>
<param name="rlMinViaInner" value="8mil"/>
<param name="rlMaxViaInner" value="20mil"/>
<param name="rlMinMicroViaOuter" value="4mil"/>
<param name="rlMaxMicroViaOuter" value="20mil"/>
<param name="rlMinMicroViaInner" value="4mil"/>
<param name="rlMaxMicroViaInner" value="20mil"/>
<param name="psTop" value="-1"/>
<param name="psBottom" value="-1"/>
<param name="psFirst" value="-1"/>
<param name="psElongationLong" value="100"/>
<param name="psElongationOffset" value="100"/>
<param name="mvStopFrame" value="1"/>
<param name="mvCreamFrame" value="0"/>
<param name="mlMinStopFrame" value="4mil"/>
<param name="mlMaxStopFrame" value="4mil"/>
<param name="mlMinCreamFrame" value="0mil"/>
<param name="mlMaxCreamFrame" value="0mil"/>
<param name="mlViaStopLimit" value="0mil"/>
<param name="srRoundness" value="0"/>
<param name="srMinRoundness" value="0mil"/>
<param name="srMaxRoundness" value="0mil"/>
<param name="slThermalIsolate" value="10mil"/>
<param name="slThermalsForVias" value="0"/>
<param name="dpMaxLengthDifference" value="10mm"/>
<param name="dpGapFactor" value="2.5"/>
<param name="checkGrid" value="0"/>
<param name="checkAngle" value="0"/>
<param name="checkFont" value="1"/>
<param name="checkRestrict" value="1"/>
<param name="useDiameter" value="13"/>
<param name="maxErrors" value="50"/>
</designrules>
<autorouter>
<pass name="Default">
<param name="RoutingGrid" value="50mil"/>
<param name="tpViaShape" value="round"/>
<param name="PrefDir.1" value="|"/>
<param name="PrefDir.2" value="0"/>
<param name="PrefDir.3" value="0"/>
<param name="PrefDir.4" value="0"/>
<param name="PrefDir.5" value="0"/>
<param name="PrefDir.6" value="0"/>
<param name="PrefDir.7" value="0"/>
<param name="PrefDir.8" value="0"/>
<param name="PrefDir.9" value="0"/>
<param name="PrefDir.10" value="0"/>
<param name="PrefDir.11" value="0"/>
<param name="PrefDir.12" value="0"/>
<param name="PrefDir.13" value="0"/>
<param name="PrefDir.14" value="0"/>
<param name="PrefDir.15" value="0"/>
<param name="PrefDir.16" value="-"/>
<param name="cfVia" value="8"/>
<param name="cfNonPref" value="5"/>
<param name="cfChangeDir" value="2"/>
<param name="cfOrthStep" value="2"/>
<param name="cfDiagStep" value="3"/>
<param name="cfExtdStep" value="0"/>
<param name="cfBonusStep" value="1"/>
<param name="cfMalusStep" value="1"/>
<param name="cfPadImpact" value="4"/>
<param name="cfSmdImpact" value="4"/>
<param name="cfBusImpact" value="0"/>
<param name="cfHugging" value="3"/>
<param name="cfAvoid" value="4"/>
<param name="cfPolygon" value="10"/>
<param name="cfBase.1" value="0"/>
<param name="cfBase.2" value="1"/>
<param name="cfBase.3" value="1"/>
<param name="cfBase.4" value="1"/>
<param name="cfBase.5" value="1"/>
<param name="cfBase.6" value="1"/>
<param name="cfBase.7" value="1"/>
<param name="cfBase.8" value="1"/>
<param name="cfBase.9" value="1"/>
<param name="cfBase.10" value="1"/>
<param name="cfBase.11" value="1"/>
<param name="cfBase.12" value="1"/>
<param name="cfBase.13" value="1"/>
<param name="cfBase.14" value="1"/>
<param name="cfBase.15" value="1"/>
<param name="cfBase.16" value="0"/>
<param name="mnVias" value="20"/>
<param name="mnSegments" value="9999"/>
<param name="mnExtdSteps" value="9999"/>
<param name="mnRipupLevel" value="10"/>
<param name="mnRipupSteps" value="100"/>
<param name="mnRipupTotal" value="100"/>
</pass>
<pass name="Follow-me" refer="Default" active="yes">
</pass>
<pass name="Busses" refer="Default" active="yes">
<param name="cfNonPref" value="4"/>
<param name="cfBusImpact" value="4"/>
<param name="cfHugging" value="0"/>
<param name="mnVias" value="0"/>
</pass>
<pass name="Route" refer="Default" active="yes">
</pass>
<pass name="Optimize1" refer="Default" active="yes">
<param name="cfVia" value="99"/>
<param name="cfExtdStep" value="10"/>
<param name="cfHugging" value="1"/>
<param name="mnExtdSteps" value="1"/>
<param name="mnRipupLevel" value="0"/>
</pass>
<pass name="Optimize2" refer="Optimize1" active="yes">
<param name="cfNonPref" value="0"/>
<param name="cfChangeDir" value="6"/>
<param name="cfExtdStep" value="0"/>
<param name="cfBonusStep" value="2"/>
<param name="cfMalusStep" value="2"/>
<param name="cfPadImpact" value="2"/>
<param name="cfSmdImpact" value="2"/>
<param name="cfHugging" value="0"/>
</pass>
<pass name="Optimize3" refer="Optimize2" active="yes">
<param name="cfChangeDir" value="8"/>
<param name="cfPadImpact" value="0"/>
<param name="cfSmdImpact" value="0"/>
</pass>
<pass name="Optimize4" refer="Optimize3" active="yes">
<param name="cfChangeDir" value="25"/>
</pass>
</autorouter>
<elements>
<element name="U$1" library="SMD-RJ45" package="MOLEX-RJ45-SMT" value="MOLEX-RJ45-SMT" x="24.13" y="29.21" rot="R270"/>
<element name="J2" library="SparkFun-Connectors" package="1X04_LONGPADS" value="" x="45.72" y="13.97" rot="R90">
<attribute name="PROD_ID" value="CONN-09696" x="83.82" y="48.26" size="1.778" layer="27" rot="R90" display="off"/>
</element>
<element name="RC2VD" library="SparkFun-Resistors" package="1206" value="20k" x="36.576" y="6.35" rot="R90"/>
<element name="RC2VU" library="SparkFun-Resistors" package="1206" value="330k" x="40.132" y="13.97" rot="R90"/>
<element name="R2" library="SparkFun-Resistors" package="1206" value="20k" x="12.7" y="15.24" rot="R270"/>
<element name="RF2A" library="SparkFun-Resistors" package="1206" value="330k" x="25.654" y="8.382" rot="R90"/>
<element name="RF2B" library="SparkFun-Resistors" package="1206" value="100k" x="19.177" y="4.572"/>
<element name="C2" library="SparkFun-Capacitors" package="1206" value="0.1 uF" x="15.113" y="15.24" rot="R90"/>
<element name="IC3" library="SparkFun-AnalogIC" package="SO08" value="LMV358SOIC" x="19.05" y="8.89" rot="R270">
<attribute name="PROD_ID" value="IC-09657" x="19.05" y="8.89" size="1.778" layer="27" rot="R270" display="off"/>
</element>
<element name="Q2" library="SparkFun-DiscreteSemi" package="SOT23-3" value="MMBT4403" x="39.37" y="20.32">
<attribute name="PROD_ID" value="TRANS-09245" x="39.37" y="20.32" size="1.778" layer="27" display="off"/>
</element>
<element name="U$2" library="SparkFun-AnalogIC" package="SO08" value="LM393" x="30.734" y="6.35"/>
<element name="R4" library="SparkFun-Resistors" package="1206" value="10k" x="34.544" y="13.97" rot="R90"/>
<element name="R6" library="SparkFun-Resistors" package="1206" value="18k" x="37.338" y="13.97" rot="R90"/>
<element name="C3" library="SparkFun-Capacitors" package="1206" value="0.1 uF" x="7.62" y="9.398" rot="R270"/>
<element name="RC1VU1" library="SparkFun-Resistors" package="1206" value="330k" x="10.16" y="9.398" rot="R90"/>
<element name="RC1VU2" library="SparkFun-Resistors" package="1206" value="330k" x="12.7" y="9.398" rot="R270"/>
<element name="RC1VU4" library="SparkFun-Resistors" package="1206" value="0" x="10.16" y="21.59" rot="R90"/>
<element name="RC1VU5" library="SparkFun-Resistors" package="1206" value="0" x="12.7" y="21.59" rot="R90"/>
<element name="J1" library="SparkFun-Connectors" package="1X04_LONGPADS" value="" x="3.81" y="20.32" rot="R270">
<attribute name="PROD_ID" value="CONN-09696" x="3.81" y="20.32" size="1.778" layer="27" rot="R270" display="off"/>
</element>
<element name="RC2VD1" library="SparkFun-Resistors" package="1206" value="4.7k" x="42.926" y="5.08" rot="R180"/>
<element name="RC2VU1" library="SparkFun-Resistors" package="1206" value="330k" x="10.16" y="15.24" rot="R90"/>
</elements>
<signals>
<signal name="12V">
<contactref element="RC2VU" pad="2"/>
<contactref element="IC3" pad="8"/>
<contactref element="Q2" pad="2"/>
<contactref element="J2" pad="3"/>
<contactref element="U$2" pad="8"/>
<contactref element="R6" pad="2"/>
<contactref element="C3" pad="1"/>
<contactref element="RC1VU1" pad="2"/>
<wire x1="30.48" y1="15.24" x2="28.829" y2="15.24" width="0.4064" layer="1"/>
<wire x1="28.829" y1="15.24" x2="21.59" y2="15.24" width="0.4064" layer="1"/>
<wire x1="21.59" y1="15.24" x2="8.89" y2="15.24" width="0.4064" layer="1"/>
<wire x1="7.62" y1="10.798" x2="10.16" y2="10.798" width="0.4064" layer="1"/>
<wire x1="40.32" y1="19.32" x2="40.32" y2="15.558" width="0.4064" layer="1"/>
<wire x1="21.6662" y1="15.1638" x2="21.59" y2="15.24" width="0.4064" layer="1"/>
<wire x1="21.6662" y1="10.795" x2="21.6662" y2="15.1638" width="0.4064" layer="1"/>
<wire x1="28.829" y1="8.9662" x2="28.829" y2="15.24" width="0.4064" layer="1"/>
<wire x1="40.32" y1="19.32" x2="45.45" y2="19.32" width="0.4064" layer="1"/>
<wire x1="45.45" y1="19.32" x2="45.72" y2="19.05" width="0.4064" layer="1"/>
<wire x1="30.48" y1="15.24" x2="35.56" y2="20.32" width="0.4064" layer="1"/>
<wire x1="40.32" y1="19.32" x2="40.32" y2="19.37" width="0.4064" layer="1"/>
<wire x1="40.32" y1="19.37" x2="39.37" y2="20.32" width="0.4064" layer="1"/>
<wire x1="39.37" y1="20.32" x2="35.56" y2="20.32" width="0.4064" layer="1"/>
<wire x1="40.32" y1="15.558" x2="40.132" y2="15.37" width="0.4064" layer="1"/>
<wire x1="40.132" y1="15.37" x2="37.338" y2="15.37" width="0.4064" layer="1"/>
<wire x1="8.89" y1="15.24" x2="7.62" y2="13.97" width="0.4064" layer="1"/>
<wire x1="7.62" y1="13.97" x2="7.62" y2="10.798" width="0.4064" layer="1"/>
</signal>
<signal name="BLUE_ENABLE">
<contactref element="Q2" pad="3"/>
<contactref element="J2" pad="4"/>
<wire x1="39.37" y1="21.42" x2="45.55" y2="21.42" width="0.4064" layer="1"/>
<wire x1="45.55" y1="21.42" x2="45.72" y2="21.59" width="0.4064" layer="1"/>
</signal>
<signal name="N$6">
<contactref element="RF2B" pad="2"/>
<contactref element="RF2A" pad="1"/>
<contactref element="IC3" pad="6"/>
<wire x1="21.6662" y1="8.255" x2="23.495" y2="8.255" width="0.4064" layer="1"/>
<wire x1="23.495" y1="8.255" x2="24.13" y2="7.62" width="0.4064" layer="1"/>
<wire x1="24.13" y1="7.62" x2="25.016" y2="7.62" width="0.4064" layer="1"/>
<wire x1="25.016" y1="7.62" x2="25.654" y2="6.982" width="0.4064" layer="1"/>
<wire x1="20.577" y1="4.572" x2="24.892" y2="4.572" width="0.4064" layer="1"/>
<wire x1="24.892" y1="4.572" x2="25.4" y2="5.08" width="0.4064" layer="1"/>
<wire x1="25.4" y1="5.08" x2="25.4" y2="6.728" width="0.4064" layer="1"/>
<wire x1="25.4" y1="6.728" x2="25.654" y2="6.982" width="0.4064" layer="1"/>
</signal>
<signal name="N$7">
<contactref element="IC3" pad="3"/>
<contactref element="RC1VU1" pad="1"/>
<contactref element="RC1VU2" pad="2"/>
<wire x1="10.16" y1="7.998" x2="12.7" y2="7.998" width="0.4064" layer="1"/>
<wire x1="16.4338" y1="8.255" x2="12.957" y2="8.255" width="0.4064" layer="1"/>
<wire x1="12.957" y1="8.255" x2="12.7" y2="7.998" width="0.4064" layer="1"/>
</signal>
<signal name="N$8">
<contactref element="R2" pad="2"/>
<contactref element="C2" pad="1"/>
<contactref element="IC3" pad="5"/>
<wire x1="12.7" y1="13.84" x2="14.478" y2="13.84" width="0.4064" layer="1"/>
<wire x1="14.478" y1="13.84" x2="15.113" y2="13.84" width="0.4064" layer="1"/>
<wire x1="15.24" y1="13.713" x2="15.113" y2="13.84" width="0.4064" layer="1"/>
<wire x1="21.6662" y1="6.985" x2="19.685" y2="6.985" width="0.4064" layer="1"/>
<wire x1="19.685" y1="6.985" x2="19.05" y2="7.62" width="0.4064" layer="1"/>
<wire x1="19.05" y1="7.62" x2="19.05" y2="12.7" width="0.4064" layer="1"/>
<wire x1="19.05" y1="12.7" x2="18.034" y2="13.716" width="0.4064" layer="1"/>
<wire x1="18.034" y1="13.716" x2="14.602" y2="13.716" width="0.4064" layer="1"/>
<wire x1="14.602" y1="13.716" x2="14.478" y2="13.84" width="0.4064" layer="1"/>
</signal>
<signal name="GND">
<contactref element="C2" pad="2"/>
<contactref element="RF2B" pad="1"/>
<contactref element="U$1" pad="2"/>
<contactref element="U$1" pad="1"/>
<contactref element="J2" pad="1"/>
<polygon width="0.4064" layer="1" isolate="0.3048">
<vertex x="0" y="33.02"/>
<vertex x="50.8" y="33.02"/>
<vertex x="50.8" y="0"/>
<vertex x="0" y="0"/>
</polygon>
<contactref element="IC3" pad="4"/>
<contactref element="U$2" pad="4"/>
<contactref element="C3" pad="2"/>
<contactref element="RC1VU2" pad="1"/>
<contactref element="U$2" pad="2"/>
<contactref element="U$2" pad="3"/>
<contactref element="J1" pad="1"/>
<contactref element="J1" pad="4"/>
<contactref element="RC2VD1" pad="1"/>
<contactref element="RC2VU1" pad="1"/>
</signal>
<signal name="BLUE_OUTPUT">
<contactref element="RF2A" pad="2"/>
<contactref element="J2" pad="2"/>
<contactref element="IC3" pad="7"/>
<contactref element="U$2" pad="6"/>
<wire x1="25.654" y1="9.782" x2="25.27" y2="10.29" width="0.4064" layer="1"/>
<wire x1="21.6662" y1="9.525" x2="25.397" y2="9.525" width="0.4064" layer="1"/>
<wire x1="25.397" y1="9.525" x2="25.654" y2="9.782" width="0.4064" layer="1"/>
<wire x1="45.72" y1="16.51" x2="43.434" y2="16.51" width="0.4064" layer="1"/>
<wire x1="43.434" y1="16.51" x2="42.164" y2="15.24" width="0.4064" layer="1"/>
<wire x1="42.164" y1="15.24" x2="42.164" y2="9.144" width="0.4064" layer="1"/>
<wire x1="42.164" y1="9.144" x2="39.37" y2="6.35" width="0.4064" layer="1"/>
<wire x1="39.37" y1="6.35" x2="31.242" y2="6.35" width="0.4064" layer="1"/>
<wire x1="31.242" y1="6.35" x2="28.702" y2="6.35" width="0.4064" layer="1"/>
<wire x1="28.702" y1="6.35" x2="27.686" y2="7.366" width="0.4064" layer="1"/>
<wire x1="27.686" y1="7.366" x2="27.686" y2="8.89" width="0.4064" layer="1"/>
<wire x1="27.686" y1="8.89" x2="26.924" y2="9.652" width="0.4064" layer="1"/>
<wire x1="26.924" y1="9.652" x2="25.784" y2="9.652" width="0.4064" layer="1"/>
<wire x1="25.784" y1="9.652" x2="25.654" y2="9.782" width="0.4064" layer="1"/>
<wire x1="31.369" y1="8.9662" x2="31.369" y2="6.477" width="0.4064" layer="1"/>
<wire x1="31.369" y1="6.477" x2="31.242" y2="6.35" width="0.4064" layer="1"/>
</signal>
<signal name="N$5">
<contactref element="RC2VU" pad="1"/>
<contactref element="RC2VD" pad="2"/>
<contactref element="U$2" pad="5"/>
<wire x1="36.446" y1="7.62" x2="36.576" y2="7.75" width="0.4064" layer="1"/>
<wire x1="36.576" y1="7.75" x2="38.23" y2="7.75" width="0.4064" layer="1"/>
<wire x1="38.23" y1="7.75" x2="40.132" y2="9.652" width="0.4064" layer="1"/>
<wire x1="32.639" y1="8.9662" x2="35.3598" y2="8.9662" width="0.4064" layer="1"/>
<wire x1="35.3598" y1="8.9662" x2="36.576" y2="7.75" width="0.4064" layer="1"/>
<wire x1="40.132" y1="12.57" x2="40.132" y2="9.652" width="0.4064" layer="1"/>
</signal>
<signal name="BLUE_INPUT">
<contactref element="U$1" pad="3"/>
<wire x1="25.7" y1="18.73" x2="25.654" y2="18.776" width="0.4064" layer="1"/>
<wire x1="25.654" y1="18.776" x2="25.654" y2="22.606" width="0.4064" layer="1"/>
<contactref element="RC1VU4" pad="2"/>
<contactref element="J1" pad="2"/>
<wire x1="22.86" y1="25.4" x2="25.654" y2="22.606" width="0.4064" layer="1"/>
<wire x1="22.86" y1="25.4" x2="11.43" y2="25.4" width="0.4064" layer="1"/>
<wire x1="11.43" y1="25.4" x2="10.16" y2="24.13" width="0.4064" layer="1"/>
<wire x1="10.16" y1="24.13" x2="10.16" y2="22.99" width="0.4064" layer="1"/>
<wire x1="10.16" y1="22.99" x2="9.02" y2="22.99" width="0.4064" layer="1"/>
<wire x1="9.02" y1="22.99" x2="6.35" y2="20.32" width="0.4064" layer="1"/>
<wire x1="6.35" y1="20.32" x2="6.35" y2="19.05" width="0.4064" layer="1"/>
<wire x1="6.35" y1="19.05" x2="5.08" y2="17.78" width="0.4064" layer="1"/>
<wire x1="5.08" y1="17.78" x2="3.81" y2="17.78" width="0.4064" layer="1"/>
</signal>
<signal name="WHITE_INPUT">
<wire x1="21.52" y1="21.66" x2="20.19" y2="22.99" width="0.4064" layer="1"/>
<contactref element="U$1" pad="7"/>
<wire x1="21.52" y1="18.73" x2="21.52" y2="21.66" width="0.4064" layer="1"/>
<contactref element="RC1VU5" pad="2"/>
<contactref element="J1" pad="3"/>
<wire x1="12.7" y1="22.99" x2="12.7" y2="22.86" width="0.4064" layer="1"/>
<wire x1="12.7" y1="22.86" x2="11.43" y2="21.59" width="0.4064" layer="1"/>
<wire x1="11.43" y1="21.59" x2="8.89" y2="21.59" width="0.4064" layer="1"/>
<wire x1="8.89" y1="21.59" x2="7.62" y2="20.32" width="0.4064" layer="1"/>
<wire x1="12.7" y1="22.99" x2="20.19" y2="22.99" width="0.4064" layer="1"/>
<wire x1="7.62" y1="20.32" x2="7.62" y2="16.51" width="0.4064" layer="1"/>
<wire x1="7.62" y1="16.51" x2="6.35" y2="15.24" width="0.4064" layer="1"/>
<wire x1="6.35" y1="15.24" x2="3.81" y2="15.24" width="0.4064" layer="1"/>
</signal>
<signal name="N$1">
<contactref element="Q2" pad="1"/>
<contactref element="R4" pad="2"/>
<wire x1="34.544" y1="15.37" x2="34.544" y2="16.764" width="0.4064" layer="1"/>
<wire x1="34.544" y1="16.764" x2="36.83" y2="19.05" width="0.4064" layer="1"/>
<wire x1="36.83" y1="19.05" x2="38.15" y2="19.05" width="0.4064" layer="1"/>
<wire x1="38.15" y1="19.05" x2="38.42" y2="19.32" width="0.4064" layer="1"/>
</signal>
<signal name="N$11">
<contactref element="U$2" pad="7"/>
<contactref element="R4" pad="1"/>
<contactref element="R6" pad="1"/>
<wire x1="29.972" y1="10.668" x2="29.972" y2="9.0932" width="0.4064" layer="1"/>
<wire x1="29.972" y1="9.0932" x2="30.099" y2="8.9662" width="0.4064" layer="1"/>
<wire x1="37.338" y1="12.57" x2="34.544" y2="12.57" width="0.4064" layer="1"/>
<wire x1="34.544" y1="12.57" x2="31.874" y2="12.57" width="0.4064" layer="1"/>
<wire x1="31.874" y1="12.57" x2="29.972" y2="10.668" width="0.4064" layer="1"/>
</signal>
<signal name="N$4">
<contactref element="IC3" pad="1"/>
<contactref element="IC3" pad="2"/>
<wire x1="16.4338" y1="10.795" x2="16.4338" y2="9.525" width="0.4064" layer="1"/>
</signal>
<signal name="INPUT">
<contactref element="R2" pad="1"/>
<contactref element="RC1VU5" pad="1"/>
<contactref element="RC1VU4" pad="1"/>
<wire x1="10.16" y1="20.19" x2="12.7" y2="20.19" width="0.4064" layer="1"/>
<wire x1="12.7" y1="20.19" x2="12.7" y2="16.64" width="0.4064" layer="1"/>
<contactref element="RC2VU1" pad="2"/>
<wire x1="10.16" y1="16.64" x2="12.7" y2="16.64" width="0.4064" layer="1"/>
</signal>
<signal name="N$2">
<contactref element="RC2VD" pad="1"/>
<contactref element="RC2VD1" pad="2"/>
<wire x1="36.576" y1="4.95" x2="41.526" y2="4.95" width="0.4064" layer="1"/>
<wire x1="41.526" y1="4.95" x2="41.526" y2="5.08" width="0.4064" layer="1"/>
</signal>
</signals>
</board>
</drawing>
</eagle>

repository: Ranthalion/AquariumLED

repo_name: Ranthalion/AquariumLED

extension: brd


text:
/**
 * @file unit-crypto.cc
 *
 * @section LICENSE
 *
 * The MIT License
 *
 * @copyright Copyright (c) 2017-2021 TileDB, Inc.
 * @copyright Copyright (c) 2016 MIT and Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * @section DESCRIPTION
 *
 * Tests the `Crypto` class
 */

#include "tiledb/sm/buffer/buffer.h"
#include "tiledb/sm/crypto/crypto.h"

#include <test/support/tdb_catch.h>
#include <iostream>

using namespace tiledb::sm;

TEST_CASE("Crypto: Test AES-256-GCM", "[crypto][aes]") {
  SECTION("- Basic") {
    unsigned nelts = 123;
    Buffer input;
    REQUIRE(input.realloc(123 * sizeof(unsigned)).ok());
    for (unsigned i = 0; i < nelts; i++)
      REQUIRE(input.write(&i, sizeof(unsigned)).ok());
    ConstBuffer input_cb(&input);

    // Set up key
    char key_bytes[] = "0123456789abcdeF0123456789abcdeF";
    ConstBuffer key(key_bytes, sizeof(key_bytes) - 1);  // -1 to ignore NUL

    // Encrypt input.
    Buffer encrypted;
    char tag_array[16], iv_array[12];
    PreallocatedBuffer output_iv(&iv_array[0], sizeof(iv_array));
    PreallocatedBuffer output_tag(&tag_array[0], sizeof(tag_array));
    CHECK(Crypto::encrypt_aes256gcm(
              &key, nullptr, &input_cb, &encrypted, &output_iv, &output_tag)
              .ok());
    CHECK(encrypted.size() == 492);

    // Check decryption.
    Buffer decrypted;
    ConstBuffer iv(output_iv.data(), output_iv.size());
    ConstBuffer tag(output_tag.data(), output_tag.size());
    ConstBuffer encrypted_cb(&encrypted);
    CHECK(Crypto::decrypt_aes256gcm(&key, &iv, &tag, &encrypted_cb, &decrypted)
              .ok());
    CHECK(decrypted.size() == input.size());
    for (unsigned i = 0; i < nelts; i++)
      REQUIRE(decrypted.value<unsigned>(i * sizeof(unsigned)) == i);

    // Check invalid tag gives error on decrypt.
    char tag_copy[16];
    memcpy(tag_copy, tag_array, sizeof(tag_array));
    memset(tag_array, 0, sizeof(tag_array));
    decrypted.reset_offset();
    decrypted.reset_size();
    CHECK(!Crypto::decrypt_aes256gcm(&key, &iv, &tag, &encrypted_cb, &decrypted)
               .ok());

    // Check with proper tag again.
    memcpy(tag_array, tag_copy, sizeof(tag_array));
    decrypted.reset_offset();
    decrypted.reset_size();
    CHECK(Crypto::decrypt_aes256gcm(&key, &iv, &tag, &encrypted_cb, &decrypted)
              .ok());
    CHECK(decrypted.size() == input.size());
    for (unsigned i = 0; i < nelts; i++)
      REQUIRE(decrypted.value<unsigned>(i * sizeof(unsigned)) == i);

    // Check incorrect key gives error.
    char key_copy[32];
    memcpy(key_copy, key_bytes, sizeof(key_bytes) - 1);
    key_bytes[0] = 'z';
    decrypted.reset_offset();
    decrypted.reset_size();
    CHECK(!Crypto::decrypt_aes256gcm(&key, &iv, &tag, &encrypted_cb, &decrypted)
               .ok());

    // Check with proper key again
    memcpy(key_bytes, key_copy, sizeof(key_copy) - 1);
    decrypted.reset_offset();
    decrypted.reset_size();
    CHECK(Crypto::decrypt_aes256gcm(&key, &iv, &tag, &encrypted_cb, &decrypted)
              .ok());
    CHECK(decrypted.size() == input.size());
    for (unsigned i = 0; i < nelts; i++)
      REQUIRE(decrypted.value<unsigned>(i * sizeof(unsigned)) == i);

    // Check wrong key length
    ConstBuffer short_key(key_bytes, 16);
    decrypted.reset_offset();
    decrypted.reset_size();
    CHECK(!Crypto::decrypt_aes256gcm(
               &short_key, &iv, &tag, &encrypted_cb, &decrypted)
               .ok());

    // Check ciphertext modification gives error.
    *((unsigned*)encrypted.value_ptr(0)) += 1;
    decrypted.reset_offset();
    decrypted.reset_size();
    CHECK(!Crypto::decrypt_aes256gcm(&key, &iv, &tag, &encrypted_cb, &decrypted)
               .ok());
  }

  SECTION("- Plaintext encrypts differently") {
    unsigned nelts = 123;
    Buffer input;
    REQUIRE(input.realloc(123 * sizeof(unsigned)).ok());
    for (unsigned i = 0; i < nelts; i++)
      REQUIRE(input.write(&i, sizeof(unsigned)).ok());
    ConstBuffer input_cb(&input);

    // Set up key
    char key_bytes[] = "0123456789abcdeF0123456789abcdeF";
    ConstBuffer key(key_bytes, sizeof(key_bytes) - 1);  // -1 to ignore NUL

    // Encrypt the same plaintext twice.
    Buffer encrypted, encrypted2;
    char tag_array[16], iv_array[12];
    PreallocatedBuffer output_iv(&iv_array[0], sizeof(iv_array));
    PreallocatedBuffer output_tag(&tag_array[0], sizeof(tag_array));
    CHECK(Crypto::encrypt_aes256gcm(
              &key, nullptr, &input_cb, &encrypted, &output_iv, &output_tag)
              .ok());
    CHECK(Crypto::encrypt_aes256gcm(
              &key, nullptr, &input_cb, &encrypted2, &output_iv, &output_tag)
              .ok());

    // Check encrypted bytes are different.
    CHECK(encrypted.size() == encrypted2.size());
    bool all_same = true;
    for (unsigned i = 0; i < encrypted.size(); i++)
      all_same &= encrypted.value<uint8_t>(i) == encrypted2.value<uint8_t>(i);
    CHECK(!all_same);

    // Check decryption.
    Buffer decrypted;
    ConstBuffer iv(output_iv.data(), output_iv.size());
    ConstBuffer tag(output_tag.data(), output_tag.size());
    ConstBuffer encrypted_cb(&encrypted2);
    CHECK(Crypto::decrypt_aes256gcm(&key, &iv, &tag, &encrypted_cb, &decrypted)
              .ok());
    CHECK(decrypted.size() == input.size());
    for (unsigned i = 0; i < nelts; i++)
      REQUIRE(decrypted.value<unsigned>(i * sizeof(unsigned)) == i);
  }

  SECTION("- Different input lengths") {
    std::vector<unsigned> nelt_values = {0, 1, 100, 1231, 1000, 10000};
    for (unsigned nelts : nelt_values) {
      Buffer input;
      REQUIRE(input.realloc(123 * sizeof(unsigned)).ok());
      for (unsigned i = 0; i < nelts; i++)
        REQUIRE(input.write(&i, sizeof(unsigned)).ok());
      ConstBuffer input_cb(&input);

      // Set up key
      char key_bytes[] = "0123456789abcdeF0123456789abcdeF";
      ConstBuffer key(key_bytes, sizeof(key_bytes) - 1);  // -1 to ignore NUL

      // Encrypt input.
      Buffer encrypted;
      char tag_array[16], iv_array[12];
      PreallocatedBuffer output_iv(&iv_array[0], sizeof(iv_array));
      PreallocatedBuffer output_tag(&tag_array[0], sizeof(tag_array));
      CHECK(Crypto::encrypt_aes256gcm(
                &key, nullptr, &input_cb, &encrypted, &output_iv, &output_tag)
                .ok());
      CHECK(encrypted.size() == input.size());

      // Check decryption.
      Buffer decrypted;
      ConstBuffer iv(output_iv.data(), output_iv.size());
      ConstBuffer tag(output_tag.data(), output_tag.size());
      ConstBuffer encrypted_cb(&encrypted);
      CHECK(
          Crypto::decrypt_aes256gcm(&key, &iv, &tag, &encrypted_cb, &decrypted)
              .ok());
      CHECK(decrypted.size() == input.size());
      for (unsigned i = 0; i < nelts; i++)
        REQUIRE(decrypted.value<unsigned>(i * sizeof(unsigned)) == i);
    }
  }

  SECTION("- NIST test vectors") {
    // From:
    // https://csrc.nist.gov/Projects/Cryptographic-Algorithm-Validation-Program/CAVP-TESTING-BLOCK-CIPHER-MODES#GCMVS
    //
    // These are test vectors where:
    // Keylen = 256, IVlen = 96, PTlen = 408, AADlen = 0, Taglen = 128.
    struct TestCase {
      char key[64 + 1];
      char iv[24 + 1];
      char pt[102 + 1];
      char ct[102 + 1];
      char tag[32 + 1];

      TestCase(
          const char* key_arg,
          const char* iv_arg,
          const char* pt_arg,
          const char* ct_arg,
          const char* tag_arg) {
        std::memcpy(key, key_arg, sizeof(key));
        std::memcpy(iv, iv_arg, sizeof(iv));
        std::memcpy(pt, pt_arg, sizeof(pt));
        std::memcpy(ct, ct_arg, sizeof(ct));
        std::memcpy(tag, tag_arg, sizeof(tag));
      }

      Buffer get_buffer(
          unsigned buf_size, unsigned num_chars, const char* field) const {
        Buffer result;
        REQUIRE(result.realloc(buf_size).ok());
        for (unsigned i = 0; i < num_chars; i += 2) {
          char byte_str[3] = {field[i], field[i + 1], '\0'};
          auto byte = (uint8_t)strtoul(byte_str, nullptr, 16);
          REQUIRE(result.write(&byte, sizeof(uint8_t)).ok());
        }
        return result;
      }

      Buffer get_key() const {
        return get_buffer(256 / 8, 64, key);
      }

      Buffer get_iv() const {
        return get_buffer(96 / 8, 24, iv);
      }

      Buffer get_plaintext() const {
        return get_buffer(408 / 8, 102, pt);
      }

      Buffer get_tag() const {
        return get_buffer(128 / 8, 32, tag);
      }

      Buffer get_ciphertext() const {
        return get_buffer(408 / 8, 102, ct);
      }
    };

    std::vector<TestCase> tests = {
        TestCase(
            "1fded32d5999de4a76e0f8082108823aef60417e1896cf4218a2fa90f632ec8a",
            "1f3afa4711e9474f32e70462",
            "06b2c75853df9aeb17befd33cea81c630b0fc53667ff45199c629c8e15dce41e53"
            "0aa"
            "792f796b8138eeab2e86c7b7bee1d40b0",
            "91fbd061ddc5a7fcc9513fcdfdc9c3a7c5d4d64cedf6a9c24ab8a77c36eefbf1c5"
            "dc0"
            "0bc50121b96456c8cd8b6ff1f8b3e480f",
            "30096d340f3d5c42d82a6f475def23eb"),

        TestCase(
            "b405ac89724f8b555bfee1eaa369cd854003e9fae415f28c5a199d4d6efc83d6",
            "cec71a13b14c4d9bd024ef29",
            "ab4fd35bef66addfd2856b3881ff2c74fdc09c82abe339f49736d69b2bd0a71a6b"
            "4fe"
            "8fc53f50f8b7d6d6d6138ab442c7f653f",
            "69a079bca9a6a26707bbfa7fd83d5d091edc88a7f7ff08bd8656d8f2c92144ff23"
            "400"
            "fcb5c370b596ad6711f386e18f2629e76",
            "6d2b7861a3c59ba5a3e3a11c92bb2b14"),

        TestCase(
            "fad40c82264dc9b8d9a42c10a234138344b0133a708d8899da934bfee2bdd6b8",
            "0dade2c95a9b85a8d2bc13ef",
            "664ea95d511b2cfdb9e5fb87efdd41cbfb88f3ff47a7d2b8830967e39071a89b94"
            "875"
            "4ffb0ed34c357ed6d4b4b2f8a76615c03",
            "ea94dcbf52b22226dda91d9bfc96fb382730b213b66e30960b0d20d2417036cbaa"
            "9e3"
            "59984eea947232526e175f49739095e69",
            "5ca8905d469fffec6fba7435ebdffdaf"),

        TestCase(
            "aa5fca688cc83283ecf39454679948f4d30aa8cb43db7cc4da4eff1669d6c52f",
            "4b2d7b699a5259f9b541fa49",
            "c691f3b8f3917efb76825108c0e37dc33e7a8342764ce68a62a2dc1a5c94059496"
            "1fc"
            "d5c0df05394a5c0fff66c254c6b26a549",
            "2cd380ebd6b2cf1b80831cff3d6dc2b6770778ad0d0a91d03eb8553696800f8431"
            "1d3"
            "37302519d1036feaab8c8eb845882c5f0",
            "5de4ef67bf8896fbe82c01dca041d590"),

        TestCase(
            "1c7690d5d845fceabba227b11ca221f4d6d302233641016d9cd3a158c3e36017",
            "93bca8de6b11a4830c5f5f64",
            "3c79a39878a605f3ac63a256f68c8a66369cc3cd7af680d19692b485a7ba58ce1d"
            "536"
            "707c55eda5b256c8b29bbf0b4cbeb4fc4",
            "c9e48684df13afccdb1d9ceaa483759022e59c3111188c1eceb02eaf308035b042"
            "8db"
            "826de862d925a3c55af0b61fd8f09a74d",
            "8f577e8730c19858cad8e0124f311dd9"),

        TestCase(
            "dbdb5132f126e62ce5b74bf85a2ac33b276588a3fc91d1bb5c7405a1bf68418b",
            "64f9e16489995e1a99568118",
            "b2740a3d5647aa5aaeb98a2e7bbf31edaea1ebacd63ad96b4e2688f1ff08af8ee4"
            "071"
            "bf26941c517d74523668ca1f9dfdbcaab",
            "e5fec362d26a1286b7fd2ec0fa876017437c7bce242293ff03d72c2f321d9e3931"
            "6a6"
            "aa7404a65ccd84890c2f527c1232b58d5",
            "dfa591ee2372699758d2cc43bfcbd2ba"),

        TestCase(
            "8433a85f16c7c921476c83d042cb713eb11a83fc0cffe31dde97907f060b4ee9",
            "55ffc85ffd1cdea8b8c48382",
            "23bc3983ba5b3be91c8a6aa148a99995241ee9e82ce44e1184beb742affbe48f54"
            "5c9"
            "a980480cf1fab758a46e4711ea9267466",
            "2f4bdc7b8b8cec1863e3145871554778c43963b527f8413bb9779935c138a34d86"
            "d7c"
            "76a9e6af689902f316191e12f34126a42",
            "7dc63156b12c9868e6b9a5843df2d79e"),

        TestCase(
            "5d7bf55457929c65e4f2a97cbdcc9b432405b1352451ccc958bceebce557491d",
            "f45ae70c264ed6e1cc132978",
            "ba5ac2a16d84b0df5a6e40f097d9d44bf21de1fcec06e4c7857463963e5c65c936"
            "d37"
            "d78867f253ce25690811bf39463e5702a",
            "47c16f87ebf00ba3e50416b44b99976c2db579423c3a3420479c477cd5ef57621c"
            "9c0"
            "cee7520acb55e739cc5435bc8665a2a0c",
            "456054ecb55cf7e75f9543def2c6e98c"),

        TestCase(
            "595f259c55abe00ae07535ca5d9b09d6efb9f7e9abb64605c337acbd6b14fc7e",
            "92f258071d79af3e63672285",
            "a6fee33eb110a2d769bbc52b0f36969c287874f665681477a25fc4c48015c541fb"
            "e23"
            "94133ba490a34ee2dd67b898177849a91",
            "bbca4a9e09ae9690c0f6f8d405e53dccd666aa9c5fa13c8758bc30abe1ddd1bcce"
            "0d3"
            "6a1eaaaaffef20cd3c5970b9673f8a65c",
            "26ccecb9976fd6ac9c2c0f372c52c821"),

        TestCase(
            "251227f72c481a7e064cbbaa5489bc85d740c1e6edea2282154507877ed56819",
            "db7193d9cd7aeced99062a1c",
            "cccffd58fded7e589481da18beec51562481f4b28c2944819c37f7125d56dceca0"
            "ef0"
            "bb6f7d7eeb5b7a2bd6b551254e9edff3a",
            "1cc08d75a03d32ee9a7ae88e0071406dbee1c306383cf41731f3c547f3377b92f7"
            "cc2"
            "8b3c1066601f54753fbd689af5dbc5448",
            "a0c7b7444229a8cfef24a31ee2de9961"),

        TestCase(
            "f256504fc78fff7139c42ed1510edf9ac5de27da706401aa9c67fd982d435911",
            "8adcf2d678abcef9dd45e8f9",
            "d1b6db2b2c81751170d9e1a39997539e3e926ca4a43298cdd3eb6fe8678b508cdb"
            "90a"
            "8a94171abe2673894405eda5977694d7a",
            "76205d63b9c5144e5daa8ac7e51f19fa96e71a3106ab779b67a8358ab5d60ef771"
            "977"
            "06266e2c214138334a3ed66ceccb5a6cd",
            "c1fe53cf85fbcbff932c6e1d026ea1d5"),

        TestCase(
            "21d296335f58515a90537a6ca3a38536eba1f899a2927447a3be3f0add70bea5",
            "2be3ad164fcbcf8ee6708535",
            "ad278650092883d348be63e991231ef857641e5efc0cab9bb28f360becc3c103d2"
            "794"
            "785024f187beaf9665b986380c92946a7",
            "b852aeba704e9d89448ba180a0bfde9e975a21cc073d0c02701215872ed7469f00"
            "fe3"
            "49294ba2d72bf3c7780b72c76101ba148",
            "bdd6d708b45ae54cd8482e4c5480a3c1"),

        TestCase(
            "d42380580e3491ddfbc0ec32424e3a281cbe71aa7505ff5ab8d24e64fbe47518",
            "fbed88de61d605a7137ffeb2",
            "4887a6ef947888bf80e4c40d9769650506eb4f4a5fd241b42c9046e3a2cf119db0"
            "02f"
            "89a9eba1d11b7a378be6b27d6f8fc86c9",
            "87aa27f96187ce27e26caf71ba5ba4e37705fd86ca9291ea68d6c6f9030291cdbf"
            "f58"
            "bff1e6741590b268367e1f1b8c4b94cd4",
            "d1690a6fe403c4754fd3773d89395ecd"),

        TestCase(
            "5511727ecd92acec510d5d8c0c49b3caacd2140431cf51e09437ebd8ca82e2ce",
            "ae80d03696e23464c881ccff",
            "184b086646ef95111ccb3d319f3124f4d4d241f9d731ce26662ea39e43457e30b0"
            "bd7"
            "39b5d5dbceb353ce0c3647a3a4c87e3b0",
            "aa28cb257698963dfc3e3fe86368d881ac066eb8ee215a7c0ed72e4d081db0b940"
            "071"
            "e2e64ff6204960da8e3464daf4cb7f37b",
            "c1578aa6e3325ee4b5e9fb9ee62a7028"),

        TestCase(
            "d48f3072bbd535a2df0a2864feb33b488596cd523ad1623b1cefe7b8cbefcf4a",
            "bbf2a537d285444d94f5e944",
            "060c585bd51539afdd8ff871440db36bfdce33b7f039321b0a63273a318bd25375"
            "a2d"
            "9615b236cfe63d627c6c561535ddfb6bd",
            "993d5d692c218570d294ab90d5f7aa683dc0e470efac279a776040f3b49386813f"
            "68b"
            "0db6a7aef59025cc38520fb318a1eac55",
            "8cd808438a8f5b6a69ff3ae255bf2cb2")};

    // Run all test vectors
    for (auto& test : tests) {
      auto key = test.get_key();
      auto iv = test.get_iv();
      auto plaintext = test.get_plaintext();
      auto tag_answer = test.get_tag();
      auto ciphertext_answer = test.get_ciphertext();
      REQUIRE(key.size() * 8 == 256);
      REQUIRE(iv.size() * 8 == 96);
      REQUIRE(plaintext.size() * 8 == 408);
      REQUIRE(tag_answer.size() * 8 == 128);
      REQUIRE(ciphertext_answer.size() * 8 == 408);

      // Encrypt plaintext
      char tag_array[16], iv_array[12];
      PreallocatedBuffer output_tag(&tag_array[0], sizeof(tag_array));
      PreallocatedBuffer output_iv(&iv_array[0], sizeof(iv_array));
      ConstBuffer key_const(key.data(), key.size());
      ConstBuffer iv_const(iv.data(), iv.size());
      Buffer encrypted;
      ConstBuffer plaintext_cb(&plaintext);
      CHECK(Crypto::encrypt_aes256gcm(
                &key_const,
                &iv_const,
                &plaintext_cb,
                &encrypted,
                &output_iv,
                &output_tag)
                .ok());

      // Check answer.
      for (unsigned i = 0; i < 16; i++)
        CHECK(
            output_tag.value<char>(i * sizeof(char)) ==
            tag_answer.value<char>(i * sizeof(char)));
      for (unsigned i = 0; i < 12; i++)
        CHECK(
            output_iv.value<char>(i * sizeof(char)) ==
            iv.value<char>(i * sizeof(char)));
      CHECK(encrypted.size() == ciphertext_answer.size());
      for (unsigned i = 0; i < ciphertext_answer.size(); i++)
        CHECK(
            encrypted.value<char>(i * sizeof(char)) ==
            ciphertext_answer.value<char>(i * sizeof(char)));

      // Decrypt and check answer.
      Buffer decrypted;
      ConstBuffer tag_const(output_tag.data(), output_tag.size());
      ConstBuffer encrypted_cb(&encrypted);
      CHECK(Crypto::decrypt_aes256gcm(
                &key_const, &iv_const, &tag_const, &encrypted_cb, &decrypted)
                .ok());
      CHECK(decrypted.size() == plaintext.size());
      for (unsigned i = 0; i < decrypted.size(); i++)
        CHECK(
            decrypted.value<char>(i * sizeof(char)) ==
            plaintext.value<char>(i * sizeof(char)));
    }
  }
}

TEST_CASE("Crypto: Test MD5", "[crypto][md5]") {
  SECTION("- Basic") {
    std::string expected_checksum = "e99a18c428cb38d5f260853678922e03";
    std::string text_to_checksum = "abc123";
    ConstBuffer input_buffer(
        text_to_checksum.data(), text_to_checksum.length());
    Buffer output_buffer;
    CHECK(output_buffer.realloc(Crypto::MD5_DIGEST_BYTES).ok());
    CHECK(Crypto::md5(&input_buffer, &output_buffer).ok());

    unsigned char* digest =
        reinterpret_cast<unsigned char*>(output_buffer.data());
    char md5string[33];
    for (uint64_t i = 0; i < output_buffer.alloced_size(); ++i) {
      sprintf(&md5string[i * 2], "%02x", (unsigned int)digest[i]);
    }
    CHECK(
        memcmp(
            expected_checksum.data(), md5string, expected_checksum.length()) ==
        0);
  }
}

TEST_CASE("Crypto: Test SHA256", "[crypto][sha256]") {
  SECTION("- Basic") {
    std::string expected_checksum =
        "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090";
    std::string text_to_checksum = "abc123";
    ConstBuffer input_buffer(
        text_to_checksum.data(), text_to_checksum.length());
    Buffer output_buffer;
    CHECK(output_buffer.realloc(Crypto::SHA256_DIGEST_BYTES).ok());
    CHECK(Crypto::sha256(&input_buffer, &output_buffer).ok());

    unsigned char* digest =
        reinterpret_cast<unsigned char*>(output_buffer.data());
    char shastring[65];
    for (uint64_t i = 0; i < output_buffer.alloced_size(); ++i) {
      sprintf(&shastring[i * 2], "%02x", (unsigned int)digest[i]);
    }

    CHECK(
        memcmp(
            expected_checksum.data(), shastring, expected_checksum.length()) ==
        0);
  }
}

license: MIT

repository: TileDB-Inc/TileDB

license_type: permissive

repo_name: TileDB-Inc/TileDB

branch_name: refs/heads/dev

gha_license_id: MIT

extension: cc


text:
SUMMARY = "Evolution database backend server"
HOMEPAGE = "http://www.gnome.org/projects/evolution/"
BUGTRACKER = "https://bugzilla.gnome.org/"

LICENSE = "LGPLv2 & LGPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=6a6e689d19255cf0557f3fe7d7068212 \
                    file://src/camel/camel.h;endline=24;md5=342fc5e9357254bc30c24e43ae47d9a1 \
                    file://src/libedataserver/e-data-server-util.h;endline=20;md5=8f21a9c80ea82a4fb80b5f959f672543 \
                    file://src/calendar/libecal/e-cal.h;endline=24;md5=e699ec3866f73f129f7a4ffffdcfc196"

DEPENDS = " \
    intltool-native gperf-native \
    glib-2.0 gtk+3 gconf libgnome-keyring libgdata \
    dbus db virtual/libiconv zlib libsoup-2.4 libglade libical nss libsecret \
"

inherit gnomebase cmake gtk-doc gettext gobject-introspection perlnative pythonnative

SRC_URI += " \
    file://0001-CMakeLists.txt-Remove-TRY_RUN-for-iconv.patch \
    file://0002-CMakeLists.txt-remove-CHECK_C_SOURCE_RUNS-check.patch \
    file://0003-contact-Replace-the-Novell-sample-contact-with-somet.patch \
    file://iconv-detect.h \
"
SRC_URI[archive.md5sum] = "568a21a4df4e0ec985c849b38fc66908"
SRC_URI[archive.sha256sum] = "63b1ae5f76be818862f455bf841b5ebb1ec3e1f4df6d3a16dc2be348b7e0a1c5"

LKSTRFTIME = "HAVE_LKSTRFTIME=ON"
LKSTRFTIME_libc-musl = "HAVE_LKSTRFTIME=OFF"

EXTRA_OECMAKE = " \
    -DWITH_KRB5=OFF \
    -DENABLE_GOA=OFF \
    -DENABLE_UOA=OFF \
    -DENABLE_GOOGLE_AUTH=OFF \
    -DENABLE_WEATHER=OFF \
    -D${LKSTRFTIME} \
"

PACKAGECONFIG ??= ""
PACKAGECONFIG[openldap] = "-DWITH_OPENLDAP=ON,-DWITH_OPENLDAP=OFF,openldap"

EXTRA_OECONF = "--with-libdb=${STAGING_DIR_HOST}${prefix} \
                --disable-nntp --disable-gtk-doc"

# -ldb needs this on some platforms
LDFLAGS += "-lpthread -lgmodule-2.0 -lgthread-2.0"

do_configure_append () {
    cp ${WORKDIR}/iconv-detect.h ${S}/src

    # fix native perl shebang
    sed -i 's:${STAGING_BINDIR_NATIVE}/perl-native:${bindir}:' ${B}/src/tools/addressbook-export/csv2vcard
}

do_compile_prepend() {
    export GIR_EXTRA_LIBS_PATH="${B}/camel/.libs:${B}/libedataserver/.libs"
}

PACKAGES =+ "libcamel libcamel-dev libebook libebook-dev libecal libecal-dev \
             libedata-book libedata-book-dev libedata-cal libedata-cal-dev \
             libedataserver libedataserver-dev \
             libedataserverui libedataserverui-dev"

FILES_${PN} =+ "${systemd_user_unitdir} \
                ${datadir}/dbus-1 \
                ${datadir}/evolution-data-server-*/ui/"
RDEPENDS_${PN} += "perl"

FILES_${PN}-dev =+ "${libdir}/pkgconfig/evolution-data-server-*.pc"
FILES_${PN}-dbg =+ "${libdir}/evolution-data-server*/camel-providers/.debug \
                    ${libdir}/evolution-data-server*/calendar-backends/.debug \
                    ${libdir}/evolution-data-server*/addressbook-backends/.debug \
                    ${libdir}/evolution-data-server*/extensions/.debug/"

RRECOMMENDS_${PN}-dev += "libecal-dev libebook-dev"

FILES_libcamel = "${libdir}/libcamel-*.so.* \
                  ${libdir}/libcamel-provider-*.so.* \
                  ${libdir}/evolution-data-server*/camel-providers/*.so \
                  ${libdir}/evolution-data-server*/camel-providers/*.urls"
FILES_libcamel-dev = "${libdir}/libcamel-*.so ${libdir}/libcamel-provider-*.so \
                      ${libdir}/pkgconfig/camel*pc \
                      ${libdir}/evolution-data-server*/camel-providers/*.la \
                      ${includedir}/evolution-data-server*/camel"

FILES_libebook = "${libdir}/libebook-*.so.*"
FILES_libebook-dev = "${libdir}/libebook-1.2.so \
                      ${libdir}/pkgconfig/libebook-*.pc \
                      ${includedir}/evolution-data-server*/libebook/*.h"
RRECOMMENDS_libebook = "libedata-book"

FILES_libecal = "${libdir}/libecal-*.so.* \
                 ${datadir}/evolution-data-server-1.4/zoneinfo"
FILES_libecal-dev = "${libdir}/libecal-*.so ${libdir}/pkgconfig/libecal-*.pc \
                     ${includedir}/evolution-data-server*/libecal/*.h \
                     ${includedir}/evolution-data-server*/libical/*.h"
RRECOMMENDS_libecal = "libedata-cal tzdata"

FILES_libedata-book = "${libexecdir}/e-addressbook-factory \
                       ${datadir}/dbus-1/services/*.AddressBook.service \
                       ${libdir}/libedata-book-*.so.* \
                       ${libdir}/evolution-data-server-*/extensions/libebook*.so \
                       ${datadir}/evolution-data-server-1.4/weather/Locations.xml"
FILES_libedata-book-dev = "${libdir}/libedata-book-*.so \
                           ${libdir}/pkgconfig/libedata-book-*.pc \
                           ${libdir}/evolution-data-server-*/extensions/libebook*.la \
                           ${includedir}/evolution-data-server-*/libedata-book"

FILES_libedata-cal = "${libexecdir}/e-calendar-factory \
                      ${datadir}/dbus-1/services/*.Calendar.service \
                      ${libdir}/libedata-cal-*.so.* \
                      ${libdir}/evolution-data-server-*/extensions/libecal*.so"
FILES_libedata-cal-dev = "${libdir}/libedata-cal-*.so \
                          ${libdir}/pkgconfig/libedata-cal-*.pc \
                          ${includedir}/evolution-data-server-*/libedata-cal \
                          ${libdir}/evolution-data-server-*/extensions/libecal*.la"

FILES_libedataserver = "${libdir}/libedataserver-*.so.*"
FILES_libedataserver-dev = "${libdir}/libedataserver-*.so \
                            ${libdir}/pkgconfig/libedataserver-*.pc \
                            ${includedir}/evolution-data-server-*/libedataserver/*.h"

FILES_libedataserverui = "${libdir}/libedataserverui-*.so.* ${datadir}/evolution-data-server-1.4/glade/*.glade"
FILES_libedataserverui-dev = "${libdir}/libedataserverui-*.so \
                              ${libdir}/pkgconfig/libedataserverui-*.pc \
                              ${includedir}/evolution-data-server-*/libedataserverui/*.h"

repository: nianfugu/meta-openembedded

repo_name: nianfugu/meta-openembedded

branch_name: refs/heads/master

extension: bb