pkcs11-hmacmd5.c revision ba751492fcc4f161a18b983d4f018a1a52938cb9
* copyright notice and this permission notice appear in all copies. * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NETWORK ASSOCIATES DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * Portions copyright (c) 2008 Nominet UK. All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * Prints the MD5 HMAC of the standard input, using the PKCS#11 device. * pkcs11-hmacmd5 [-m module] [-s $slot] [-n] [-p $pin] * -m: PKCS#11 provider module. This must be the full * path to a shared library object implementing the * PKCS#11 API for a device. * -n: don't log in to the PKCS#11 device * -k: key name for the HMAC /* Define static key template values */ "Option -%c requires an operand\n",
"\tpkcs11-hmacmd5 [-m module] [-s slot] " buffer[i >>
1] = (c -
'0') <<
4;
buffer[i >>
1] = (c -
'A' +
10) <<
4;
buffer[i >>
1] |= c -
'A' +
10;
buffer[i >>
1] = (c -
'a' +
10) <<
4;
buffer[i >>
1] |= c -
'a' +
10;
/* Initialize the CRYPTOKI library */ "C_SignUpdate: Error = 0x%.8lX\n",
"C_SignUpdate: Error = 0x%.8lX\n",