diff --git a/key/HPAVKey.h b/key/HPAVKey.h index acd2082..139738f 100644 --- a/key/HPAVKey.h +++ b/key/HPAVKey.h @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/HPAVKeyDAK.c b/key/HPAVKeyDAK.c index 92e356a..66f2a07 100644 --- a/key/HPAVKeyDAK.c +++ b/key/HPAVKeyDAK.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/HPAVKeyNID.c b/key/HPAVKeyNID.c index 3d4d638..33c7cbe 100644 --- a/key/HPAVKeyNID.c +++ b/key/HPAVKeyNID.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/HPAVKeyNMK.c b/key/HPAVKeyNMK.c index c8408aa..9fe5d57 100644 --- a/key/HPAVKeyNMK.c +++ b/key/HPAVKeyNMK.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/HPAVKeyOut.c b/key/HPAVKeyOut.c index db789d3..c6f92e5 100644 --- a/key/HPAVKeyOut.c +++ b/key/HPAVKeyOut.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/HPAVKeySHA.c b/key/HPAVKeySHA.c index 65885ca..7913d6e 100644 --- a/key/HPAVKeySHA.c +++ b/key/HPAVKeySHA.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/HPAVKeySpec.c b/key/HPAVKeySpec.c index d4b1fd3..770957f 100644 --- a/key/HPAVKeySpec.c +++ b/key/HPAVKeySpec.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/MACPasswords.c b/key/MACPasswords.c index 314d38a..e6f304c 100644 --- a/key/MACPasswords.c +++ b/key/MACPasswords.c @@ -4,49 +4,69 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ /*====================================================================* * - * void MACPasswords (unsigned vendor, unsigned device, unsigned number, unsigned count, unsigned group, char space, flag_t flags); + * void MACPasswords (uint32_t vendor, uint32_t device, unsigned number, unsigned count, unsigned group, unsigned space, flag_t flags); * * keys.h * * print a range of device address/password pairs on stdout; print - * an optional usage flag in first column for PTS compatability; + * an optional usage flag in the first column for PTS compatability; + * + * vendor is the 24-bit OUI expressed as an integer; device is the + * 24-bit starting unit address expressed as an integer; number is + * the number of address/password pairs to generate; count is the + * number of letters in the password excluding delimiters; + * + * passwords consists of letters arranged in groups separated by + * spaces; count is the number of letters; group is the number of + * letters in each group; space is the character that separates + * each group; + * + * vendor is used to seed the random number generator and create + * a character set having the 256 random upper case letters used + * for all vendor passwords; most letters will appear more than + * once in the character set; + * + * device is used to seed the random number generator and select + * count random letters from the character set until the password + * has been constructed; + * * * Contributor(s): * Charles Maier @@ -61,6 +81,7 @@ #include #include #include +#include #include "../tools/types.h" #include "../tools/flags.h" @@ -75,59 +96,36 @@ static uint64_t MACSRand (uint64_t seed) return (temp); } -static unsigned MACRand () +static uint32_t MACRand () { MACSeed *= 0x41C64E6D; MACSeed += 0x00003029; - return ((unsigned)((MACSeed >> 0x10) & 0x7FFFFFFF)); + return ((uint32_t)((MACSeed >> 0x10) & 0x7FFFFFFF)); } -/*====================================================================* - * - * void MACPassword (unsigned device, char const charset [], unsigned limit, unsigned count, unsigned group, char space); - * - * keys.h - * - * Contributor(s): - * Charles Maier - * - *--------------------------------------------------------------------*/ - -void MACPassword (unsigned device, char const charset [], unsigned limit, unsigned count, unsigned group, char space) +static void MACPassword (uint32_t device, char const charset [], unsigned count, unsigned alpha, unsigned group, char space) { + unsigned letter = 0; MACSRand (device); - while (count--) + while (letter < alpha) { - unsigned index = MACRand () % limit; - putc (charset [index & limit], stdout); - if ((count) && (group) && !(count % group)) + unsigned offset = MACRand () % count; + if ((letter) && (group) && !(letter%group)) { putc (space, stdout); } + putc (charset [offset], stdout); + letter++; } return; } -/*====================================================================* - * - * void MACPasswords (unsigned vendor, unsigned device, unsigned number, unsigned count, unsigned group, char space, flag_t flags); - * - * keys.h - * - * print a range of device address/password pairs on stdout; print - * an optional usage flag in first column for PTS compatability; - * - * Contributor(s): - * Charles Maier - * - *--------------------------------------------------------------------*/ - -void MACPasswords (unsigned vendor, unsigned device, unsigned number, unsigned count, unsigned group, char space, flag_t flags) +void MACPasswords (uint32_t vendor, uint32_t device, unsigned count, unsigned alpha, unsigned group, unsigned space, flag_t flags) { - char charset [UCHAR_MAX]; + char charset [UCHAR_MAX + 1]; unsigned offset = 0; if (vendor >> 24) { @@ -137,7 +135,7 @@ void MACPasswords (unsigned vendor, unsigned device, unsigned number, unsigned c { return; } - if (number >> 24) + if (count >> 24) { return; } @@ -150,7 +148,7 @@ void MACPasswords (unsigned vendor, unsigned device, unsigned number, unsigned c charset [offset++] = c; } } - while (number--) + while (count--) { if (_anyset (flags, PASSWORD_VERBOSE)) { @@ -163,7 +161,7 @@ void MACPasswords (unsigned vendor, unsigned device, unsigned number, unsigned c printf ("%06X", device & 0x00FFFFFF); putc (' ', stdout); } - MACPassword (device, charset, sizeof (charset), count, group, space); + MACPassword (device, charset, sizeof (charset), alpha, group, space); putc ('\n', stdout); device++; } diff --git a/key/Makefile b/key/Makefile index de62a49..7de75ff 100755 --- a/key/Makefile +++ b/key/Makefile @@ -62,10 +62,10 @@ ignore: hpavkey: hpavkey.o HPAVKeyDAK.o HPAVKeyNID.o HPAVKeyNMK.o HPAVKeyOut.o HPAVKeySHA.o SHA256.o error.o getoptv.o hexout.o putoptv.o todigit.o uintspec.o version.o hpavkeys: hpavkeys.o HPAVKeyDAK.o HPAVKeyNID.o HPAVKeyNMK.o HPAVKeyOut.o HPAVKeySHA.o SHA256.o error.o getoptv.o hexout.o putoptv.o todigit.o uintspec.o version.o -mac2pw: mac2pw.o MACPasswords.o RNDPasswords.o putpwd.o error.o getoptv.o putoptv.o todigit.o uintspec.o version.o -mac2pwd: mac2pwd.o MACPasswords.o RNDPasswords.o putpwd.o error.o getoptv.o putoptv.o todigit.o uintspec.o version.o +mac2pw: mac2pw.o MACPasswords.o error.o getoptv.o putoptv.o todigit.o uintspec.o version.o +mac2pwd: mac2pwd.o MACPasswords.o error.o getoptv.o putoptv.o todigit.o uintspec.o version.o rkey: rkey.o HPAVKeyDAK.o HPAVKeyNID.o HPAVKeyNMK.o HPAVKeyOut.o HPAVKeySHA.o SHA256Block.o SHA256Fetch.o SHA256Reset.o SHA256Write.o error.o getoptv.o hexout.o putoptv.o strincr.o todigit.o uintspec.o version.o -libkeys.a: HPAVKeySHA.o HPAVKeyDAK.o HPAVKeyNMK.o HPAVKeyNID.o HPAVKeyOut.o SHA256.o strnpwd.o +libkeys.a: HPAVKeySHA.o HPAVKeyDAK.o HPAVKeyNMK.o HPAVKeyNID.o HPAVKeyOut.o SHA256.o MACPasswords.o rm -f ${@} $(AR) rc ${@} ${^} $(RANLIB) ${@} diff --git a/key/RNDPasswords.c b/key/RNDPasswords.c deleted file mode 100644 index 3dcda5b..0000000 --- a/key/RNDPasswords.c +++ /dev/null @@ -1,113 +0,0 @@ -/*====================================================================* - * - * Copyright (c) 2013 Qualcomm Atheros, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written - * permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *--------------------------------------------------------------------*/ - -/*====================================================================* - * - * void RNDPasswords (unsigned vendor, unsigned device, unsigned number, unsigned count, unsigned group, unsigned space, flag_t flags); - * - * keys.h - * - * print a number of device address/password pairs on stdout; print - * an optional usage flag in the first column for PTS compatability; - * - * vendor is the 24-bit OUI expressed as an integer; device is the - * 24-bit starting unit address expressed as an integer; number is - * the number of address/password pairs to generate; count is the - * number of letters/numbers in the password excluding delimiters; - * group is the number of letters or numbers appear between space - * characters; space characters are suppressed when group is zero - * or greater than count; - * - *--------------------------------------------------------------------*/ - -#ifndef RNDPASSWORDS_SOURCE -#define RNDPASSWORDS_SOURCE - -#include -#include -#include -#include - -#include "../tools/types.h" -#include "../tools/error.h" -#include "../tools/files.h" -#include "../tools/flags.h" -#include "../key/keys.h" - -void RNDPasswords (unsigned vendor, unsigned device, unsigned number, unsigned count, unsigned group, char space, flag_t flags) - -{ - if (vendor >> 24) - { - return; - } - if (device >> 24) - { - return; - } - if (number >> 24) - { - return; - } - while (number--) - { - if (_anyset (flags, PASSWORD_VERBOSE)) - { - putc ('0', stdout); - putc (' ', stdout); - } - if (_allclr (flags, PASSWORD_SILENCE)) - { - printf ("%06X", vendor); - printf ("%06X", device); - putc (' ', stdout); - } - putpwd (count, group, space); - putc ('\n', stdout); - device++; - } - return; -} - -#endif - - - diff --git a/key/SHA256Block.c b/key/SHA256Block.c index 279c88c..49dc68c 100644 --- a/key/SHA256Block.c +++ b/key/SHA256Block.c @@ -109,7 +109,7 @@ void SHA256Block (struct sha256 * sha256, void const * memory) W [word] |= (uint32_t)(*buffer++) << 8; W [word] |= (uint32_t)(*buffer++) << 0;; } - for ( ; word < sizeof (sha256->block); word++) + for (word = word; word < sizeof (sha256->block); word++) { uint32_t s0 = ROTR (W [word-15], 7) ^ ROTR (W [word-15], 18) ^ SHR (W [word-15], 3); uint32_t s1 = ROTR (W [word- 2], 17) ^ ROTR (W [word- 2], 19) ^ SHR (W [word- 2], 10); diff --git a/key/SHA256Match.c b/key/SHA256Match.c index ddbb81c..b0cd3ac 100644 --- a/key/SHA256Match.c +++ b/key/SHA256Match.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/example.keys b/key/example.keys old mode 100644 new mode 100755 diff --git a/key/hpavkey.1 b/key/hpavkey.1 old mode 100644 new mode 100755 index 4dfcec2..f2e8ac6 --- a/key/hpavkey.1 +++ b/key/hpavkey.1 @@ -1,4 +1,4 @@ -.TH hpavkey 1 "Feb 2015" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" +.TH hpavkey 1 "November 2013" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" .SH NAME hpavkey - HomePlug AV Key Generator @@ -25,7 +25,7 @@ Three keys of interest to users are the Device Access Key (DAK), the Network Mem Their purpose is described in the HomePlug AV Specification. .PP -The HomePlug AV Specification explains how to generate 16-byte binary DAK, NMK and NID values using the SHA-256 algorithm to hash user-supplied ASCII strings, called "pass phrases" in the specification. +The HomePlug AV Specification explains how to generate 16-btye binary DAK, NMK and NID values using the SHA-256 algorithm to hash user-supplied ASCII strings, called "pass phrases" in the specification. HomePlug AV compliant pass phrases have from 12 to 64 7-bit ASCII character values in the range 0x20 to 0x7F. In some cases, a specified 8-byte salt is added to the pass phrase before computing the 32-byte hash value. In all cases, the computed hash is then rehashed a specified number of times to produce the final 32-byte value. @@ -58,7 +58,7 @@ In such cases, you may need to include meta characters. -\fBL \fIlevel\fR Set security level. The security level is encoded into the NID. -Level \fB0\fR enables pushbutton pairing. +Level \fB0\fR enables pusbutton pairing. Level \fB1\fR disables it. This option has no effect unless a NID is computed. diff --git a/key/hpavkey.c b/key/hpavkey.c index 6acce75..f98f026 100644 --- a/key/hpavkey.c +++ b/key/hpavkey.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/hpavkeys.1 b/key/hpavkeys.1 old mode 100644 new mode 100755 index d792f7f..43a5ef3 --- a/key/hpavkeys.1 +++ b/key/hpavkeys.1 @@ -1,4 +1,4 @@ -.TH hpavkeys 1 "Feb 2015" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" +.TH hpavkeys 1 "November 2013" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" .SH NAME hpavkeys - HomePlug AV Key Generator @@ -25,7 +25,7 @@ Three keys of interest to users are the Device Access Key (DAK), the Network Mem Their purpose is described in the HomePlug AV Specification. .PP -The HomePlug AV Specification explains how to generate 16-byte binary DAK, NMK and NID values using the SHA-256 algorithm to hash user-supplied ASCII strings, called "pass phrases" in the specification. +The HomePlug AV Specification explains how to generate 16-btye binary DAK, NMK and NID values using the SHA-256 algorithm to hash user-supplied ASCII strings, called "pass phrases" in the specification. HomePlug AV compliant pass phrases have from 12 to 64 7-bit ASCII character values in the range 0x20 to 0x7F. In some cases, a specified 8-byte salt is added to the pass phrase before computing the 32-byte hash value. In all cases, the computed hash is then rehashed a specified number of times to produce the final 32-byte value. @@ -58,7 +58,7 @@ In such cases, you may need to include meta characters. -\fBL\fR \fIlevel\fR Set security level. The security level is encoded into the NID. -Level \fB0\fR enables pushbutton pairing. +Level \fB0\fR enables pusbutton pairing. Level \fB1\fR disables it. This option has no effect unless a NID is computed. diff --git a/key/hpavkeys.c b/key/hpavkeys.c index 1010a19..4744684 100644 --- a/key/hpavkeys.c +++ b/key/hpavkeys.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/key.mak b/key/key.mak index eafcdd9..3b00c6c 100644 --- a/key/key.mak +++ b/key/key.mak @@ -7,8 +7,8 @@ hpavkey.o: hpavkey.c HPAVKey.h HPAVKeyDAK.c HPAVKeyNID.c HPAVKeyNMK.c HPAVKeyOut.c HPAVKeySHA.c SHA256.c SHA256.h error.c error.h flags.h getoptv.c getoptv.h hexout.c number.h putoptv.c putoptv.h todigit.c types.h uintspec.c version.c version.h hpavkeys.o: hpavkeys.c HPAVKey.h HPAVKeyDAK.c HPAVKeyNID.c HPAVKeyNMK.c HPAVKeyOut.c HPAVKeySHA.c SHA256.c SHA256.h error.c error.h flags.h getoptv.c getoptv.h hexout.c number.h putoptv.c putoptv.h todigit.c types.h uintspec.c version.c version.h keys.o: keys.c keys.h -mac2pw.o: mac2pw.c MACPasswords.c RNDPasswords.c strnpwd.o error.c error.h flags.h getoptv.c getoptv.h keys.h memory.h number.h putoptv.c putoptv.h todigit.c types.h uintspec.c version.c -mac2pwd.o: mac2pwd.c MACPasswords.c RNDPasswords.c strnpwd.o error.c error.h flags.h getoptv.c getoptv.h keys.h memory.h number.h putoptv.c putoptv.h todigit.c types.h uintspec.c version.c +mac2pw.o: mac2pw.c MACPasswords.c error.c error.h flags.h getoptv.c getoptv.h keys.h memory.h number.h putoptv.c putoptv.h todigit.c types.h uintspec.c version.c +mac2pwd.o: mac2pwd.c MACPasswords.c error.c error.h flags.h getoptv.c getoptv.h keys.h memory.h number.h putoptv.c putoptv.h todigit.c types.h uintspec.c version.c rkey.o: rkey.c HPAVKey.h HPAVKeyDAK.c HPAVKeyNID.c HPAVKeyNMK.c HPAVKeyOut.c HPAVKeySHA.c SHA256.h SHA256Block.c SHA256Fetch.c SHA256Reset.c SHA256Write.c error.c error.h files.h flags.h getoptv.c getoptv.h hexout.c memory.h number.h putoptv.c putoptv.h strincr.c todigit.c uintspec.c version.c # ==================================================================== @@ -22,7 +22,6 @@ HPAVKeyOut.o: HPAVKeyOut.c HPAVKey.h flags.h memory.h number.h types.h HPAVKeySHA.o: HPAVKeySHA.c HPAVKey.h SHA256.h HPAVKeySpec.o: HPAVKeySpec.c HPAVKey.h error.h MACPasswords.o: MACPasswords.c flags.h keys.h types.h -RNDPasswords.o: RNDPasswords.c flags.h keys.h types.h SHA256.o: SHA256.c SHA256Block.c SHA256Fetch.c SHA256Reset.c SHA256Write.c SHA256Block.o: SHA256Block.c SHA256.h SHA256Fetch.o: SHA256Fetch.c SHA256.h @@ -31,7 +30,6 @@ SHA256Match.o: SHA256Match.c SHA256.h number.h SHA256Print.o: SHA256Print.c SHA256.h number.h SHA256Reset.o: SHA256Reset.c SHA256.h SHA256Write.o: SHA256Write.c SHA256.h -strnpwd.o: strnpwd.c flags.h types.h keys.h # ==================================================================== # headers; diff --git a/key/key.sh b/key/key.sh index adf3654..87d26b4 100755 --- a/key/key.sh +++ b/key/key.sh @@ -21,7 +21,6 @@ gcc -Wall -Wextra -Wno-unused-parameter -c HPAVKeySHA.c gcc -Wall -Wextra -Wno-unused-parameter -c HPAVKeyOut.c gcc -Wall -Wextra -Wno-unused-parameter -c HPAVKeySpec.c gcc -Wall -Wextra -Wno-unused-parameter -c MACPasswords.c -gcc -Wall -Wextra -Wno-unused-parameter -c RNDPasswords.c gcc -Wall -Wextra -Wno-unused-parameter -c SHA256Block.c gcc -Wall -Wextra -Wno-unused-parameter -c SHA256Fetch.c gcc -Wall -Wextra -Wno-unused-parameter -c SHA256Reset.c @@ -30,8 +29,6 @@ gcc -Wall -Wextra -Wno-unused-parameter -c SHA256Print.c gcc -Wall -Wextra -Wno-unused-parameter -c SHA256Ident.c gcc -Wall -Wextra -Wno-unused-parameter -c SHA256Match.c gcc -Wall -Wextra -Wno-unused-parameter -c keys.c -gcc -Wall -Wextra -Wno-unused-parameter -c putpwd.c -gcc -Wall -Wextra -Wno-unused-parameter -c strnpwd.c # ==================================================================== # cleanse; diff --git a/key/keys.c b/key/keys.c index 0e79dec..c875c0f 100644 --- a/key/keys.c +++ b/key/keys.c @@ -4,40 +4,41 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ + /*====================================================================* * * keys.c - Encryption Key Data and Functions; @@ -47,6 +48,7 @@ * Tabulate default Atheros pass phrases and their DAK, NMK and * NID for search and conversion purposes; * + * * Contributor(s): * Charles Maier * @@ -57,7 +59,7 @@ #include "../key/keys.h" -struct key const keys [KEYS] = +const struct key keys [KEYS] = { { @@ -179,73 +181,6 @@ struct key const keys [KEYS] = } }; -/*====================================================================* - * device access key synonym table; - *--------------------------------------------------------------------*/ - -struct _term_ const daks [DAKS] = - -{ - { - "key0", - DAK0 - }, - { - "key1", - DAK1 - }, - { - "key2", - DAK2 - }, - { - "none", - DAK0 - }, - { - "secret", - DAK0 - }, - { - "zero", - DAK0 - } -}; - -/*====================================================================* - * network membership key synonym table; - *--------------------------------------------------------------------*/ - -struct _term_ const nmks [NMKS] = - -{ - { - "key0", - NMK0 - }, - { - "key1", - NMK1 - }, - { - "key2", - NMK2 - }, - { - "none", - NMK0 - }, - { - "zero", - NMK0 - }, -}; - -/*====================================================================* - * - *--------------------------------------------------------------------*/ #endif - - diff --git a/key/keys.h b/key/keys.h index 64af84d..0c0581f 100644 --- a/key/keys.h +++ b/key/keys.h @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ @@ -81,8 +81,6 @@ #define NMK2 "B59319D7E8157BA001B018669CCEE30D" #define KEYS 3 -#define DAKS 6 -#define NMKS 5 /*====================================================================* * variables; @@ -98,24 +96,17 @@ typedef struct key key; -extern struct key const keys [KEYS]; - /*====================================================================* * *--------------------------------------------------------------------*/ -extern struct _term_ const daks [DAKS]; -extern struct _term_ const nmks [NMKS]; - +extern const struct key keys []; /*====================================================================* * functions; *--------------------------------------------------------------------*/ -void MACPasswords (unsigned vendor, unsigned device, unsigned count, unsigned alpha, unsigned bunch, char space, flag_t flags); -void RNDPasswords (unsigned vendor, unsigned device, unsigned count, unsigned alpha, unsigned bunch, char space, flag_t flags); -char * strnpwd (char buffer [], unsigned length, unsigned count, unsigned group, char space); -void putpwd (unsigned count, unsigned group, char space); +void MACPasswords (uint32_t vendor, uint32_t device, unsigned count, unsigned alpha, unsigned group, unsigned space, flag_t flags); /*====================================================================* * diff --git a/key/mac2pw.1 b/key/mac2pw.1 old mode 100644 new mode 100755 index 9ae5385..f4bc41f --- a/key/mac2pw.1 +++ b/key/mac2pw.1 @@ -1,4 +1,4 @@ -.TH mac2pw 1 "Feb 2015" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" +.TH mac2pw 1 "November 2013" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" .SH NAME mac2pw - Qualcomm Atheros Ethernet Device Password Generator @@ -11,60 +11,40 @@ mac2pw - Qualcomm Atheros Ethernet Device Password Generator [...] .SH DESCRIPTION -Print a range of consecutive Ethernet addresses and passwords on stdout such that each device has a unique password. -Program output is suitable as input to the Qualcomm Atheros HomePlug AV Production Test System or may be used in custom production systems. -A starting address and an address range are specified. -Computed passwords consist of upper case letters and digits with optional group separators. -Output consists of address/password pairs in text format. +Print a range of consecutive Ethernet addresses and passwords on stdout. +The starting address and address range are specified. +Computed passwords consist of upper case letters (A-Z) with separators. +The algorithm used here is not required for HomePlug AV compliance and so vendors are free to use other methods to generate their own device passwords. .PP -This program is designed to generate passwords for a large number of consecutive device addresses. -It complements program \fBmac2pwd\fR which generates passwords for non-consecutive device addresses occurring in unspecified order. +This program may be used to generate passwords for large numbers of consecutive device addresses over a fixed range. +It complements program \fBmac2pwd\fR which generates passwords for non-consecutive device addresses that may occur in unpredictable order. .PP This program is part of the Qualcomm Atheros Powerline Toolkit. See the \fBAMP\fR man page for an overview and installation instructions. .SH CAVEATS -Atheros provides this program as a simple means of generating unique device passwords for a large volume of Ethernet devices. -Two different password algorithms are implemented but neither one is required for HomePlug AV compliance. -Vendors are free to use other methods to generate their own device passwords and are encouraged to do so. - -.TP -Random Method -Generate passwords based on system entropy. -A different set of passwords is generated for a given address range with each program execution. -There is no correlation at between addresses and passwords. -This method is secure but requires care when programming and labelling devices at the factory. -It may be necessary to maintain a database if regular device maintenance and firmware upgrade are needed. - -.TP -Device Method -Generate passwords based on device address. -The same set of passwords will be generated for a given address range with each program execution. -This method may be appropriate on system where regular maintenance and firmware updates are required. -This method is not secure because device addresses can be determined using a variety of network management programs. -Anyone having access to this program, or the algorithm, could compute the device password and gain access to device features reserved for privileged users. -This program does provide features to mitigate the risks of using this method. +Atheros provides this program as a simple means of generating unique and apparently random device passwords for a large volume of Ethernet devices. +It uses a Linear Congruential Random Number Generator to produce a single-wheel Bazerie Cylinder and to select characters from that cylinder. +The algorithm used is adequate for this purpose and nothing more. +Vendors are encouraged to develop their own means of generating passwords for the reasons mentioned below. + +.PP +Device addresses can be determined using a variety of network management programs. +Anyone having access to this program, or the algorithm used, could compute the device password and gain access to device features reserved for priviledged users. .SH OPTIONS .TP -\fBb\fR \fIbunch\fR The password bunching factor. -Passwords consists of \fIcount\fR uppercase letters and digits optionally displayed in groups separated by hyphens. -The bunching factor specifies the number of letters and digits in each group. -When \fIbunch\fR is \fB0\fR or greater than \fIcount\fR, bunching is suppressed. -Separating hyphens increase overall password length. +Passwords have a fixed number of upper case letters broken into groups separated with dashes. +The number of letters in each group are the \fBbunch\fR value. +When \fIbunch\fR is \fB0\fR, password length is \fIcount\fR. +When \fIbunch\fR is \fB1\fR, password length is twice \fIcount\fR because every other character will be a dash. The minimum is \fB0\fR and the maximum is \fB255\fR. -The default is \fB0\fR which suppresses bunching. - -.TP -.RB - e -Compute passwords based on host system entropy. -Passwords consist of uppercase letters [A-Z] optionally grouped using option \fB-b\fR. -This method produces a non-repeatable set of unique passwords over a given address range. -This method is the default and is secure. +The default is \fB4\fR. .TP -\fBl \fIcount\fR @@ -74,13 +54,6 @@ The minimum is \fB12\fR and the maximum is \fB64\fR. The default is \fB16\fR. .TP -.RB - m -Compute passwords based on target device address. -Passwords consist of uppercase letters [A-Z]. -This method produces a repeatable set of unique passwords over a given address range. -This method is not secure. - -.TP -\fBn \fInumber\fR The number of consecutive addresses and passwords to compute and print. The minimum is \fB0\fR and the maximum is \fB1677215\fR or 0xFFFFFF. @@ -123,130 +96,89 @@ There is no default \fBaddress\fR. If more than one device address is specified then an address/password series will be computed for each. .SH EXAMPLES -The following example prints the given device address and a random password string on stdout. -The default password length is 25 characters long but the length can be changes using option \fB-l\fR. +The following example prints the given device address and associated password string on stdout. .PP # mac2pw 00B052000001 - 00B052000001 5KAXCQFQNN4PPNC76XN2YUWMS + 00B052000001 MLPB-YLQM-YSSL-BMBB .PP -Repeating the command will generate a new password string. -This is the default behaviour and is the same as specifying option \fB-e\fR for "\fBentropy\fR". +This example does the same thing but ommits the device address. .PP - # mac2pw 00B052000001 - 00B052000001 CA35TM5JLG4S6XBKSM3HSU6J4 - -.PP -This example ommits the device address. -Repeating the command produces a new password string. - -.PP - # mac2pw 00B052000001 -q - 2LJ6P5JPEHE6V63GZWC337Q8E # mac2pw 00B052000001 -q - 5Z8J7EGGL2HJDKMZ978W8V94W - -.PP -The next example shows how to generate passwords for three different devices with one command. -The program generates a password for each device address specified on the command line. - -.PP - # mac2pw 00B052000001 00B05200BABE 00B05200DEAD - 00B052000001 NJHWXEFRPVVW87C9J4BQEHYYE - 00B05200BABE 5PT9Z64Z4TVRPEJCK8LR2XFMR - 00B05200DEAD 7R2LJYGJB42329AS4NM29H8V4 + MLPB-YLQM-YSSL-BMBB .PP -The next example prints \fB10\fR consecutive device addresses and random passwords on stdout. +The following example prints 10 consecutive device addresses and passwords on stdout. The starting device address is given and option \fB-n\fR specifies the number of addresses to print. -Output can be piped to a file or another process. +Output can be directed to a file. .PP # mac2pw 00B052000001 -n 10 - 00B052000001 LEKWS42VX92YR3LLL6KBD5RCG - 00B052000002 BHYKXG3VEVXNZ7CF2UERCU4G6 - 00B052000003 UBP87NFZMMW5WY8KK5GJFAWS3 - 00B052000004 CU7Y7JKFNASS6E4GQ3XL3HWGZ - 00B052000005 9RN3WTXAQUXV8THZUB898ZGB3 - 00B052000006 HCXNPW2CM9JVHBJN2TZVRVDU6 - 00B052000007 DFD5QY5HATC5NFC5SF3AWL2PD - 00B052000008 837GAN4HSG9U6TTRCPRXMG84T - 00B052000009 HBLZHG32FSZKQ8TANGK5U8DS9 - 00B05200000A KEY9D3DW66HX68AWZRCD4VPD9 - -.PP -The following example prints \fB10\fR consecutive device addresses and passwords but inserts a \fB0\fR at the start of each line to indicate that the address and password have not been used. -The Qualcomm Atheros Production Test System (PTS) will set the \fB0\fR to \fB1\fR after it programs a device. -This format is simlar to PTS DBBuilder Utility output. - -.PP - # mac2pw 00B052000006 -n 10 -v - 0 00B052000006 VZNKWJUHAV2687NV6EJYUVQ4D - 0 00B052000007 RENKKWRNFLU4ZNZ3P6K4SZ4PG - 0 00B052000008 NEL6LL2V2YZAL2Q27E2DJ25BG - 0 00B052000009 MYX2T5HM68T5JCK7YYJNDWH2P - 0 00B05200000A 6UY4MPYP43GXSD39VLTNZCJEZ - 0 00B05200000B MD47KPFZLSNL9XRLJTN3MKJ5N - 0 00B05200000C BKVTVYE47LE4DKMUNQPPXR7HL - 0 00B05200000D RBJ8DA5DB48TZUTAQXZ9CPFTM - 0 00B05200000E HSK6N9ZGZPGV4T5YXST4DH3W8 - 0 00B05200000F BLW8QQ4JMEVSQJYHRPBDGG5RS - -.PP -The next example prints \fB10\fR consecutive device addresses and passwords, as before, but changes password length and character bunching. -Option \fB-l\fR specifies \fB12\fR characters and option \fB-b\fR specifies a bunching factor of three. + 00B052000001 MLPB-YLQM-YSSL-BMBB + 00B052000002 KSQJ-ZZFT-TNJL-VZIH + 00B052000003 HDFV-SEHB-LFWM-VLBF + 00B052000004 LBPL-NZSM-VPUC-XPLM + 00B052000005 JXDN-UYFQ-NISF-MIGH + 00B052000006 YPOS-UVDA-VMML-JBBP + 00B052000007 PJAO-DWSS-OQYL-XDTU + 00B052000008 SKVQ-CNRF-PUDM-WKZC + 00B052000009 YQTM-LHTJ-FYQC-YVNW + 00B05200000A KADM-CHII-KYVF-FQRZ + +.PP +The following example prints 10 consecutive device addresses and passwords, as before, but starts from a different device address. +The address range here overlaps the range shown above but identical device addresses have identical passwords. .PP - # mac2pw 00B052000001 -n 10 -l 12 -b 3 - 00B052000001 S2J-V4B-NB6-37M - 00B052000002 QEX-292-CYF-AVV - 00B052000003 5VH-2KR-FYP-EVH - 00B052000004 NYU-TPB-ZK3-6H6 - 00B052000005 MGX-GB7-P2P-42B - 00B052000006 DDM-UD8-8NS-BZA - 00B052000007 MLZ-86G-F4G-MS8 - 00B052000008 DTY-U8D-DT8-3G2 - 00B052000009 6BY-WVU-GB9-UEB - 00B05200000A TX3-NUS-TKM-LVL + # mac2pw 00B052000006 -n 10 + 00B052000006 YPOS-UVDA-VMML-JBBP + 00B052000007 PJAO-DWSS-OQYL-XDTU + 00B052000008 SKVQ-CNRF-PUDM-WKZC + 00B052000009 YQTM-LHTJ-FYQC-YVNW + 00B05200000A KADM-CHII-KYVF-FQRZ + 00B05200000B YCZS-MVPX-VNFL-CLVZ + 00B05200000C PIBZ-DKMB-YMJL-QTMQ + 00B05200000D DPTA-HOEK-QERM-HJIY + 00B05200000E TMQQ-YFCW-OIVC-OGWO + 00B05200000F QUHL-PSQM-HHPF-PHLT .PP -The next example prints \fB10\fR consecutive device addresses and passwords, as before, but starts from a different device address. -We specified option \fB-m\fR so that passwords are generated based on the MAC address. -This ensures that the same password is generated each time for a given device address. -We also specified password length or \fB16\fR characters using option \fB-l\fR and bunching factor of \fB4\fR with option \fB-b\fR. +The following example prints 10 consecutive device addresses and passwords, as before, but changes the password length and letter grouping. +Option \fB-l\fR specifies \fB12\fR letters and option \fB-b\fR specifies a bunching factor of three. +Use a bunching factor of \fB0\fR to remove dashes. .PP - # mac2pw 00B052000001 -m -l 16 -b 4 -n 10 - 00B052000001 HBXY-FVHN-COML-MVLY - 00B052000002 KYCC-KFFD-BHCN-CSUL - 00B052000003 LQXF-TULV-IOQB-SKJI - 00B052000004 SOBX-FRNC-EIHL-KBPW - 00B052000005 XPAC-KESG-MDYY-OFPQ - 00B052000006 SFTQ-DWEF-GHYC-VOWW - 00B052000007 NNZQ-FCTW-VQLG-ESBV - 00B052000008 SEPC-KYYS-JZEO-HHVT - 00B052000009 OYPS-DSDV-QILZ-JYOV - 00B05200000A HQYV-FIWJ-CJDZ-XPNZ + # mac2pw 00B052000006 -n 10 -l 12 -b 3 + 00B052000006 YPO-SUV-DAV-MML + 00B052000007 PJA-ODW-SSO-QYL + 00B052000008 SKV-QCN-RFP-UDM + 00B052000009 YQT-MLH-TJF-YQC + 00B05200000A KAD-MCH-IIK-YVF + 00B05200000B YCZ-SMV-PXV-NFL + 00B05200000C PIB-ZDK-MBY-MJL + 00B05200000D DPT-AHO-EKQ-ERM + 00B05200000E TMQ-QYF-CWO-IVC + 00B05200000F QUH-LPS-QMH-HPF .PP -The following example prints \fB10\fR consecutive device addresses and passwords, as before, but starts from a different device address. -The address range here overlaps the range shown above but identical device addresses have identical passwords. -Address based passwords may be of interest on large private networks requireing frequent firmware upgrades or device configuration. +The following example prints 10 consecutive device addresses and passwords but inserts a \fB0\fR at the start of each line to indicate that the address and password have not been used. +The Atheros Production Test System (PTS) will set the \fB0\fR to \fB1\fR after it programs a device. +This format is simlar to PTS DBBuilder Utility output. .PP - # mac2pw 00B052000006 -m -l 16 -b 4 -n 10 - 00B052000006 SFTQ-DWEF-GHYC-VOWW - 00B052000007 NNZQ-FCTW-VQLG-ESBV - 00B052000008 SEPC-KYYS-JZEO-HHVT - 00B052000009 OYPS-DSDV-QILZ-JYOV - 00B05200000A HQYV-FIWJ-CJDZ-XPNZ - 00B05200000B MQIG-KUKM-YQSJ-KPRM - 00B05200000C VTLW-DAVK-JCMU-JQLU - 00B05200000D PIQB-OITS-RFCY-PUVE - 00B05200000E IWAV-KYJM-JBEM-GPMR - 00B05200000F LQJY-DSEX-WDHE-FVMB + # mac2pw 00B052000006 -n 10 -u + 0 00B052000006 MLNX-JIAN-NERM-NIRR + 0 00B052000007 MBOR-ASNO-HLQJ-ZSFL + 0 00B052000008 NACT-DPWJ-MEVU-NMRX + 0 00B052000009 NYVC-DOVN-BLTH-OYZM + 0 00B05200000A NKMN-ZRVP-RERA-BSSA + 0 00B05200000B NMRT-KRNA-NLMJ-ADQT + 0 00B05200000C EVAL-BAWY-UEBN-RINO + 0 00B05200000D EUSE-QXOK-XLVN-TKMM + 0 00B05200000E EINV-GNUP-DEQM-CVSB + 0 00B05200000F EJAL-JSJF-GLNS-LLOD .SH DISCLAIMER Qualcomm Atheros reserves the right to modify program names, functionality, input format or output format in future toolkit releases without any obligation to notify or compensate toolkit users. @@ -260,6 +192,4 @@ Qualcomm Atheros reserves the right to modify program names, functionality, inpu .SH CREDITS Charles Maier - Pouyan Sepehrdad - Ning Shang diff --git a/key/mac2pw.c b/key/mac2pw.c index 4126b6f..74298c8 100644 --- a/key/mac2pw.c +++ b/key/mac2pw.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ @@ -78,8 +78,6 @@ #ifndef MAKEFILE #include "../key/MACPasswords.c" -#include "../key/RNDPasswords.c" -#include "../key/putpwd.c" #endif /*====================================================================* @@ -87,35 +85,29 @@ *--------------------------------------------------------------------*/ #ifndef ETHER_ADDR_LEN -#define ETHER_ADDR_LEN 6 +#define ETHER_ADDR_LEN 6 /* normally defined in ethernet.h or if_ether.h */ #endif /*====================================================================* - * program functions; - *--------------------------------------------------------------------*/ - -void (* generate)(unsigned, unsigned, unsigned, unsigned, unsigned, char, flag_t) = RNDPasswords; - -/*====================================================================* * - * void function (const char * string, unsigned range, unsigned alpha, unsigned bunch, unsigned space, flag_t flags) + * void function (const char * string, uint32_t range, unsigned count, unsigned group, unsigned space, flag_t flags) * * parse an Ethernet hardware address string into vendor and device * ID substrings; print a specified number of consecutive addresses * and password strings having a defined letter count and grouping; * + * * Contributor(s): * Charles Maier * *--------------------------------------------------------------------*/ -static void function (const char * string, unsigned range, unsigned alpha, unsigned bunch, unsigned space, flag_t flags) +static void function (const char * string, uint32_t range, unsigned count, unsigned group, unsigned space, flag_t flags) { - extern void (* generate)(unsigned, unsigned, unsigned, unsigned, unsigned, char, flag_t); const char * offset = string; - unsigned vendor = 0; - unsigned device = 0; + uint32_t vendor = 0; + uint32_t device = 0; unsigned radix = 0x10; unsigned width; unsigned digit; @@ -157,7 +149,7 @@ static void function (const char * string, unsigned range, unsigned alpha, unsig { error (1, ERANGE, "Want %d passwords but only %d left in range", range, (0x00FFFFFF - device)); } - generate (vendor, device, range, alpha, bunch, space, flags); + MACPasswords (vendor, device, range, count, group, space, flags); return; } @@ -167,10 +159,10 @@ static void function (const char * string, unsigned range, unsigned alpha, unsig * int main (int argc, const char * argv []); * * generate unique password strings for a range of device hardware - * addresses; print paired addresses and passwords on stdout; + * addresses; print paired addresses and passwords to stdout; * * Many Atheros programs expect the user to enter a password to - * access a device; the password is encoded to produce the 16-bit + * access a device; the password is encoded to product the 16-bit * Device Access Key (DAK) stored in the PIB; * * Vendors must publish the device password so that end users can @@ -188,30 +180,27 @@ static void function (const char * string, unsigned range, unsigned alpha, unsig *--------------------------------------------------------------------*/ #define DEFAULT_RANGE 1 -#define DEFAULT_ALPHA 25 -#define DEFAULT_BUNCH 0 +#define DEFAULT_COUNT 16 +#define DEFAULT_GROUP 4 int main (int argc, const char * argv []) { - extern void (* generate)(unsigned, unsigned, unsigned, unsigned, unsigned, char, flag_t); static const char * optv [] = { - "b:el:mn:qv", + "b:l:n:quv", "address [address] [...]", "Atheros device password generator", - "b n\tbunching factor [" LITERAL (DEFAULT_BUNCH) "]", - "e\tbase passwords on host system entropy (more secure)", - "l n\tpassword letters [" LITERAL (DEFAULT_ALPHA) "]", - "m\tbase passwords on MAC addresses (non-secure)", + "b n\tbunching factor [" LITERAL (DEFAULT_GROUP) "]", + "l n\tpassword letters [" LITERAL (DEFAULT_COUNT) "]", "n n\tgenerate n consecutive passwords [" LITERAL (DEFAULT_RANGE) "]", "q\tomit device address on output", "v\tprepend PTS flag on output", (const char *)(0) }; - unsigned range = DEFAULT_RANGE; - unsigned alpha = DEFAULT_ALPHA; - unsigned bunch = DEFAULT_BUNCH; + uint32_t range = DEFAULT_RANGE; + unsigned count = DEFAULT_COUNT; + unsigned group = DEFAULT_GROUP; unsigned space = '-'; flag_t flags = (flag_t)(0); signed c; @@ -221,19 +210,13 @@ int main (int argc, const char * argv []) switch ((char)(c)) { case 'b': - bunch = uintspec (optarg, 0, UCHAR_MAX); - break; - case 'e': - generate = RNDPasswords; + group = (unsigned)(uintspec (optarg, 0, UCHAR_MAX)); break; case 'l': - alpha = uintspec (optarg, 12, 64); - break; - case 'm': - generate = MACPasswords; + count = (unsigned)(uintspec (optarg, 12, 64)); break; case 'n': - range = uintspec (optarg, 0, 0x00FFFFFF); + range = (uint32_t)(uintspec (optarg, 0, 0x00FFFFFF)); break; case 'q': _setbits (flags, PASSWORD_SILENCE); @@ -249,7 +232,7 @@ int main (int argc, const char * argv []) argv += optind; while ((argv) && (* argv)) { - function (* argv, range, alpha, bunch, space, flags); + function (* argv, range, count, group, space, flags); argc--; argv++; } diff --git a/key/mac2pwd.1 b/key/mac2pwd.1 old mode 100644 new mode 100755 index 380af90..586d4af --- a/key/mac2pwd.1 +++ b/key/mac2pwd.1 @@ -1,4 +1,4 @@ -.TH mac2pwd 1 "Feb 2015" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" +.TH mac2pwd 1 "November 2013" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" .SH NAME mac2pwd - Qualcomm Atheros Ethernet Device Password Generator @@ -11,16 +11,14 @@ mac2pwd - Qualcomm Atheros Ethernet Device Password Generator [ ... ] .SH DESCRIPTION -Read Ethernet MAC addresses from one or more files and print a unique password for each address. -Program output is suitable as input to the Qualcomm Atheros HomePlug AV Production Test System or may be used in custom production systems. +Read Ethernet addresses from one or more files and print computed passwords with the associated address. Input addresses can appear in any order and need not be consecutive. -Computed passwords consist of upper case letters and digits with optional group separators. -Output consists of address/password pairs in text format. +Computed passwords consist of upper case letters (A-Z) with group separators. +The algorithm used here is not mandatory for HomePlug AV compliance and so vendors are free to use other methods to generate their own device passwords. .PP -This program may be used to generate passwords for large numbers of non-consecutive MAC addresses that occur in unspecified order. +This program may be used to generate passwords for large numbers of non-consecutive MAC addresses that may occur in random order. It complements program \fBmac2pw\fR which generates passwords for consecutive MAC addresses over a given range. -Options exist to modify the password algorithm, password length and character bunching. .PP This program is part of the Qualcomm Atheros Powerline Toolkit. @@ -28,44 +26,24 @@ See the \fBAMP\fR man page for an overview and installation instructions. .SH CAVEATS Atheros provides this program as a simple means of generating unique and apparently random device passwords for a large volume of Ethernet devices. -Two different password algorithms are implemented but neither one is required for HomePlug AV compliance. -Vendors are free to use other methods to generate their own device passwords and are encouraged to do so. - -.TP -Random Method -Generate random passwords based on system entropy. -A different set of passwords is generated for a given address range with each program execution. -There is no correlation at between addresses and passwords. -This method secure but requires care when programming and labelling devices at the factory. -It may be necessary to maintain a database if regular device maintenance and firmware upgrade are needed. - -.TP -Device Method -Generate apparently random passwords based on device address. -The same set of passwords will be generated for a given address range with each program execution. -This method may be appropriate on system where regular maintenance and firmware updates are required. -This method is not secure because device addresses can be determined using a variety of network management programs. -Anyone having access to this program, or the algorithm, could compute the device password and gain access to device features reserved for privileged users. -This program does provide features to mitigate the risks of using this method. +It uses a Linear Cogruential Random Number Generator to produce a single-wheel Bazerie Cylinder and to select characters from that cylinder. +The algorithm used is adequate for purpose and nothing more. +Vendors are encouraged to develop their own means of generating passwords for the reasons mentioned below. + +.PP +MAC addresses can be determined using a variety of network management programs. +Anyone having access to this program, or the algorithm used, could compute the device password and gain access to device features reserved for priviledged users. .SH OPTIONS .TP -\fBb\fR \fIbunch\fR The password bunching factor. -Passwords consists of \fIcount\fR uppercase letters and digits optionally displayed in groups separated by hyphens. -The bunching factor specifies the number of letters and digits in each group. -When \fIbunch\fR is \fB0\fR or greater than \fIcount\fR, bunching is suppressed. -Separating hyphens increase overall password length. -The minimum is \fB0\fR and the maximum is \fB255\fR. -The default is \fB0\fR which suppresses bunching. - -.TP -.RB - e -Compute passwords based on host system entropy. -Passwords consist of uppercase letters [A-Z] optionally grouped using option \fB-b\fR. -This method produces a non-repeatable set of unique passwords over a given address range. -This method is the default and is secure. +Passwords have a fixed number of upper case letters broken into groups separated with dashes. +The number of letters in each group are the \fBbunch\fR value. +When \fBbunch\fR is \fB0\fR, password length is \fBcount\fR. +When \fBbunch\fR is \fB1\fR, password length is twice \fBcount\fR because every other character will be a dash. +The default \fBbunch\fR is \fB4\fR. .TP -\fBl \fIcount\fR @@ -74,13 +52,6 @@ The default \fBcount\fR is \fB16\fR. Overall password length is the sum of \fBcount\fR plus the number of delimiters implied by \fBbunch\fR. .TP -.RB - m -Compute passwords based on target device address. -Passwords consist of uppercase letters [A-Z]. -This method produces a repeatable set of unique passwords over a given address range. -This method is not secure. - -.TP .RB - q Quiet mode. Exclude the MAC address on output. @@ -146,76 +117,55 @@ This file contains 7 addresses but only 5 will be recognized. 002b88660066 .PP -The next example reads the two files shown above and prints \fB10\fR addresses, \fB5\fR from each file, with associated passwords. -Output appears on the console but may be piped to a file or another process. +The following example reads the two files shown above and prints 10 addresses, 5 from each file, with associated passwords. +Output appears on the console but it could be directed to a file. .PP # mac2pwd mac.txt more.mac - 00B052000004 8C69GFCXATB8RA9SF52LK79UD - 00B052BABE33 MMKGF5SP5DP23KHY27BSLRV2A - 00B052BABE34 CVBG6QHJFQVVCYSACPAPBZT79 - 00B052CAFE05 MCXUABFPC33CPMXWFWYX5N2KC - 00B052CAFE01 5GHUWD9YDEL8TCAGEZJ8ESRCC - 002B88FFFF00 CJCW4VB2HZ37DAK2XE9CGCWZZ - 002B887FFF00 W2W9AQU5TE8K4ZLH7R3K5C6X4 - 002B88660067 2LWQ5LGBUCDFDYSZYQ2XZSPJ2 - 002B88660063 62NKW6RM87UBZG34KH87AXXEY - 002B88660066 KNQAGGFH9G9XQGR96GR4HK4SS - -.PP - -The next example does the the two files, as before but shortens password length and groups password character. -Overall password length includes password characters plus delimiters. -Option \fB-l\fR sets password length to \fB16\fR characters. -Option \fB-b\fR sets bunching to \fB4\fR characters. - -.PP - - # mac2pwd mac.txt more.mac -l 16 -b 4 - 00B052000004 R5YH-E6XG-TECA-24R8 - 00B052BABE33 WBQJ-77PC-VQTX-63Q5 - 00B052BABE34 4M2X-GVUY-6PYH-H5V7 - 00B052CAFE05 Z8JA-A2MV-49JF-WJZZ - 00B052CAFE01 5L7Z-ZXZP-NUFS-RBKE - 002B88FFFF00 3RAD-HQPN-92G2-HJKA - 002B887FFF00 7YD7-9NJJ-39S7-8ZGF - 002B88660067 HZ6K-SBG5-ZL8S-K2DK - 002B88660063 MX5K-W7PF-T823-38MJ - 002B88660066 PDXL-84QH-GKUN-KVEE + 00B052000004 LBPL-NZSM-VPUC-XPLM + 00B052BABE33 KKDF-KLMC-JENV-NGFG + 00B052BABE34 FVPK-WQID-VVHY-ZHYQ + 00B052CAFE05 PCHK-EXLA-QEDY-DPJU + 00B052CAFE01 KDGB-ZVBQ-YLTF-ZCET + 002B88FFFF00 OIFX-KUHT-RUIN-MURF + 002B887FFF00 SPUU-KOJU-RXOA-ZORW + 002B88660067 BTQY-NMZL-WUNM-HSHW + 002B88660063 EJRX-AATI-YSMU-JWSG + 002B88660066 FOFC-LVAB-MTHH-TVNO .PP -The next example is the same but prints output suitable for input to the Qualcomm Atheros PTS because option \fB-v\fR is specified. +The following example is the same but prints output suitable for input to the Qualcomm Atheros PTS because option \fB-v\fR is specified. The output format is similar to that produced by the Qualcomm Atheros DB Builder Utility for Windows. .PP # mac2pwd -v mac.txt more.mac - 0 00B052000004 ZZYBQP7EAZKBNWWCKKC4HX3AW - 0 00B052BABE33 LG7XD97UPSBUHA6F7CU28P3WW - 0 00B052BABE34 8BF288CZN4NTBUFSJAQLUYYNF - 0 00B052CAFE05 RTK4XHMWKWWD654QRBQGW5UNH - 0 00B052CAFE01 EE5YLRXD2EGKS6TSGZZK7ES74 - 0 002B88FFFF00 BRYJDWYGP79GFWZN8ZU8ZQ3GN - 0 002B887FFF00 KEULLGC6PYFAM3FE89TYTSMP6 - 0 002B88660067 H4STMXB67QR22J39MAZQRHHA5 - 0 002B88660063 HKF32QX2GCZKGR3XYTMQCWTRB - 0 002B88660066 STKF28Q2JXYEMAQZVQSFVTKFB + 0 00B052000004 LBPL-NZSM-VPUC-XPLM + 0 00B052BABE33 KKDF-KLMC-JENV-NGFG + 0 00B052BABE34 FVPK-WQID-VVHY-ZHYQ + 0 00B052CAFE05 PCHK-EXLA-QEDY-DPJU + 0 00B052CAFE01 KDGB-ZVBQ-YLTF-ZCET + 0 002B88FFFF00 OIFX-KUHT-RUIN-MURF + 0 002B887FFF00 SPUU-KOJU-RXOA-ZORW + 0 002B88660067 BTQY-NMZL-WUNM-HSHW + 0 002B88660063 EJRX-AATI-YSMU-JWSG + 0 002B88660066 FOFC-LVAB-MTHH-TVNO .PP -The next example omits the MAC address. -This may used to generate random passwords for other purposes. +The following example omits the MAC address from the output for clandestine cases where one does not want both the MAC address and the password to appear together. +It can also be used to generate random passwords for other purposes. .PP # mac2pwd -q mac.txt more.mac - W6QXL6KDY4SZLL538CAMWSH8N - PMYLFYMNA5TKYU2S6LBJS6QCR - B2P58XQ2L4JSNR6SXEZ6BSVSN - GYG6MS8NFEVH8EFBPD483WWCJ - 44TQ6FYCVSGP9GLS6YSYRTWFQ - GUGPUJ6284X22ZU4RKXAX5T65 - LGSV6L9Y9398DFY3Z2TUFBCAJ - H95A2FYV3LNT7BBFSLCLHXEH8 - JXSY7TMKK6CP3LDWNE3M74G87 - V4TEAG2ZX3J3NJHPAJMMQTQNT + LBPL-NZSM-VPUC-XPLM + KKDF-KLMC-JENV-NGFG + FVPK-WQID-VVHY-ZHYQ + PCHK-EXLA-QEDY-DPJU + KDGB-ZVBQ-YLTF-ZCET + OIFX-KUHT-RUIN-MURF + SPUU-KOJU-RXOA-ZORW + BTQY-NMZL-WUNM-HSHW + EJRX-AATI-YSMU-JWSG + FOFC-LVAB-MTHH-TVNO .SH DISCLAIMER Qualcomm Atheros reserves the right to modify program names, functionality, input format or output format in future toolkit releases without any obligation to notify or compensate toolkit users. @@ -229,6 +179,4 @@ Qualcomm Atheros reserves the right to modify program names, functionality, inpu .SH CREDITS Charles Maier - Pouyan Sepehrdad - Ning Shang diff --git a/key/mac2pwd.c b/key/mac2pwd.c index 72b77da..c1467c6 100644 --- a/key/mac2pwd.c +++ b/key/mac2pwd.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ @@ -78,8 +78,6 @@ #ifndef MAKEFILE #include "../key/MACPasswords.c" -#include "../key/RNDPasswords.c" -#include "../key/putpwd.c" #endif /*====================================================================* @@ -91,31 +89,16 @@ #endif /*====================================================================* - * program functions; - *--------------------------------------------------------------------*/ - -void (* generate)(unsigned, unsigned, unsigned, unsigned, unsigned, char, flag_t) = RNDPasswords; - -/*====================================================================* - * - * void function (const char * file, unsigned alpha, unsigned bunch, flag_t flags) * - * read Ethernet hardware address strings from a file and print - * address passwords pairs on stdout; + * void function (const char * file, unsigned count, unsigned bunch, flag_t flags) * - * parse an Ethernet hardware address string into vendor and device - * ID substrings; print a specified number of consecutive addresses - * and password strings having a defined letter count and grouping; * - * Contributor(s): - * Charles Maier * *--------------------------------------------------------------------*/ -static void function (const char * file, unsigned alpha, unsigned bunch, unsigned space, flag_t flags) +static void function (const char * file, unsigned count, unsigned group, unsigned space, flag_t flags) { - extern void (* generate)(unsigned, unsigned, unsigned, unsigned, unsigned, char, flag_t); unsigned line = 1; unsigned radix = 0x10; unsigned width; @@ -180,7 +163,7 @@ static void function (const char * file, unsigned alpha, unsigned bunch, unsigne } c = getc (stdin); } - generate (vendor, device, 1, alpha, bunch, space, flags); + MACPasswords (vendor, device, 1, count, group, space, flags); } return; } @@ -194,33 +177,31 @@ static void function (const char * file, unsigned alpha, unsigned bunch, unsigne * and print a stream of address/password pairs; device addresses * must be separated by white space; * + * * Contributor(s): * Charles Maier * *--------------------------------------------------------------------*/ -#define DEFAULT_ALPHA 25 -#define DEFAULT_BUNCH 0 +#define DEFAULT_COUNT 16 +#define DEFAULT_GROUP 4 int main (int argc, const char * argv []) { - extern void (* generate)(unsigned, unsigned, unsigned, unsigned, unsigned, char, flag_t); static const char * optv [] = { - "b:el:mqv", + "b:l:qs:uv", PUTOPTV_S_FUNNEL, "Atheros device password generator", - "b n\tbunching factor [" LITERAL (DEFAULT_BUNCH) "]", - "e\tbase passwords on host system entropy (more secure)", - "l n\tpassword letters [" LITERAL (DEFAULT_ALPHA) "]", - "m\tbase passwords on MAC addresses (non-secure)", + "b n\tbunching factor [" LITERAL (DEFAULT_GROUP) "]", + "l n\tpassword letters [" LITERAL (DEFAULT_COUNT) "]", "q\tomit device address on output", "v\tprepend PTS flag on output", (const char *)(0) }; - unsigned alpha = DEFAULT_ALPHA; - unsigned bunch = DEFAULT_BUNCH; + unsigned count = DEFAULT_COUNT; + unsigned group = DEFAULT_GROUP; unsigned space = '-'; flag_t flags = (flag_t)(0); signed c; @@ -230,20 +211,15 @@ int main (int argc, const char * argv []) switch ((char)(c)) { case 'b': - bunch = uintspec (optarg, 0, UCHAR_MAX); - break; - case 'e': - generate = RNDPasswords; + group = (unsigned)(uintspec (optarg, 0, UCHAR_MAX)); break; case 'l': - alpha = uintspec (optarg, 12, 64); - break; - case 'm': - generate = MACPasswords; + count = (unsigned)(uintspec (optarg, 12, 64)); break; case 'q': _setbits (flags, PASSWORD_SILENCE); break; + case 'u': case 'v': _setbits (flags, PASSWORD_VERBOSE); break; @@ -255,7 +231,7 @@ int main (int argc, const char * argv []) argv += optind; if (!argc) { - function ("stdin", alpha, bunch, space, flags); + function ("stdin", count, group, space, flags); } while ((argv) && (* argv)) { @@ -263,7 +239,7 @@ int main (int argc, const char * argv []) { error (1, EINVAL, "Can't open %s", * argv); } - function (* argv, alpha, bunch, space, flags); + function (* argv, count, group, space, flags); argc--; argv++; } diff --git a/key/putpwd.c b/key/putpwd.c deleted file mode 100644 index cb517dc..0000000 --- a/key/putpwd.c +++ /dev/null @@ -1,140 +0,0 @@ -/*====================================================================* - * - * Copyright (c) 2015 Qualcomm Atheros, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written - * permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *--------------------------------------------------------------------*/ -/*====================================================================* - * - * void putpwd (unsigned count, unsigned group, char space); - * - * keys.h - * - * print a random password on stdout; passwords consist of count - * letters and digits; optionally, group letters and digits and - * separate groups with a space character; - * - * alphabet is an array of 32 printable password characters; - * count is the number of characters to be selected from alphabet; - * group is the grouping factor; - * space is the group separator; - * - * grouping is suppressed when group is zero or greater than or - * equal to count; - * - * Contributors: - * Charles Maier - * - *--------------------------------------------------------------------*/ - -#ifndef PUTPWD_SOURCE -#define PUTPWD_SOURCE - -#include -#include -#include -#include - -#include "../tools/types.h" -#include "../tools/error.h" -#include "../key/keys.h" - -void putpwd (unsigned count, unsigned group, char space) - -{ - signed fd; - if ((fd = open ("/dev/urandom", O_RDONLY)) == -1) - { - error (1, errno, "can't open /dev/urandom"); - } - while (count--) - { - static const char alphabet [] = - { - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'A', - 'B', - 'C', - 'D', - 'E', - 'F', - 'G', - 'H', - 'J', - 'K', - 'L', - 'M', - 'N', - 'P', - 'Q', - 'R', - 'S', - 'T', - 'U', - 'V', - 'W', - 'X', - 'Y', - 'Z' - }; - unsigned member; - if (read (fd, & member, sizeof (member)) != sizeof (member)) - { - error (1, errno, "can't read /dev/urandom"); - } - member &= 0x1F; - putc (alphabet [member % sizeof (alphabet)], stdout); - if ((count) && (group) && ! (count % group)) - { - putc (space, stdout); - } - } - close (fd); - return; -} - -#endif - - - diff --git a/key/rkey.1 b/key/rkey.1 old mode 100644 new mode 100755 index f90263e..97b8b02 --- a/key/rkey.1 +++ b/key/rkey.1 @@ -1,4 +1,4 @@ -.TH rkey 1 "Feb 2015" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" +.TH rkey 1 "November 2013" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit" .SH NAME rkey - HomePlug AV Random Key Generator @@ -30,7 +30,7 @@ This option over-rides any \fB-M\fR and \fB-N\fR options previously specified on -\fBL \fIlevel\fR Set security level. The security level is encoded into the NID. -Level \fB0\fR enables pushbutton pairing. +Level \fB0\fR enables pusbutton pairing. Level \fB1\fR disables it. This option has no effect unless a NID is computed. diff --git a/key/rkey.c b/key/rkey.c index 3a6a101..29739b5 100644 --- a/key/rkey.c +++ b/key/rkey.c @@ -4,38 +4,38 @@ * * All rights reserved. * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions + * Redistribution and use in source and binary forms, with or + * without modification, are permitted (subject to the limitations + * in the disclaimer below) provided that the following conditions * are met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials * provided with the distribution. * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written + * * Neither the name of Qualcomm Atheros nor the names of + * its contributors may be used to endorse or promote products + * derived from this software without specific prior written * permission. * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE + * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *--------------------------------------------------------------------*/ diff --git a/key/strnpwd.c b/key/strnpwd.c deleted file mode 100644 index a7c8e9c..0000000 --- a/key/strnpwd.c +++ /dev/null @@ -1,149 +0,0 @@ -/*====================================================================* - * - * Copyright (c) 2015 Qualcomm Atheros, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted (subject to the limitations - * in the disclaimer below) provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * * Neither the name of Qualcomm Atheros nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written - * permission. - * - * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE - * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE - * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *--------------------------------------------------------------------*/ -/*====================================================================* - * - * char * strnpwd (char buffer [], unsigned length, unsigned count, unsigned group, char space); - * - * keys.h - * - * encode a buffer with a password containing the specified number - * of random letters and digits; optionally, group the letters and - * digits and separate groups with a space character; return the - * address of the byte following the encoded password; - * - * alphabet is an array of 32 printable password characters; - * count is the number of characters to be selected from alphabet; - * group is the grouping factor; - * space is the group separator; - * - * grouping is suppressed when group is zero or greater than or - * equal to count; - * - * Contributors: - * Charles Maier - * - *--------------------------------------------------------------------*/ - -#ifndef STRNPWD_SOURCE -#define STRNPWD_SOURCE - -#include -#include -#include - -#include "../tools/types.h" -#include "../tools/error.h" -#include "../key/keys.h" - -char * strnpwd (char buffer [], unsigned length, unsigned count, unsigned group, char space) - -{ - signed fd; - if ((fd = open ("/dev/urandom", O_RDONLY)) == -1) - { - error (1, errno, "can't open /dev/urandom"); - } - while (count--) - { - static const char alphabet [] = - { - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'A', - 'B', - 'C', - 'D', - 'E', - 'F', - 'G', - 'H', - 'J', - 'K', - 'L', - 'M', - 'N', - 'P', - 'Q', - 'R', - 'S', - 'T', - 'U', - 'V', - 'W', - 'X', - 'Y', - 'Z' - }; - unsigned member; - if (read (fd, & member, sizeof (member)) != sizeof (member)) - { - error (1, errno, "can't read /dev/urandom"); - } - if (length) - { - *buffer = alphabet [member % sizeof (alphabet)]; - buffer++; - length--; - } - if ((count) && (group) && ! (count % group)) - { - if (length) - { - *buffer = space; - buffer++; - length--; - } - } - } - close (fd); - return (buffer); -} - -#endif - - -