/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <libintl.h>
#include <locale.h>
#include <string.h>
#include <errno.h>
#include <wanbootutil.h>
#include <sys/wanboot_impl.h>
/* Return codes */
#define HMAC_SUCCESS 0
/* Private buffer length */
/*
* This routine is used to compute a hash digest for the file represented
* by the file descirptor, 'fd'. The key, 'hmac_key', and key type, 'ka',
* will be provided by the caller. The resulting hash digest will be
* written to stdout.
*
* Returns:
* HMAC_SUCCESS or HMAC_ERROR.
*/
static int
{
ssize_t i;
/*
* Initialize the computation.
*/
/*
* Read the data to hash.
*/
}
if (i < 0) {
wbku_printerr("Cannot read input_file");
return (HMAC_ERROR);
}
/*
* Finalize the digest.
*/
/*
* Write the digest to stdout.
*/
wbku_printerr("Cannot output digest");
return (HMAC_ERROR);
}
/*
* Success.
*/
return (HMAC_SUCCESS);
}
/*
* Prints usage().
*/
static void
{
}
/*
* This program is used to compute a hash digest for data read in from
* stdin or optionally, a file. The resulting hash digest will be written
* to stdout.
*
* Returns:
* HMAC_SUCCESS, HMAC_ERROR or HMAC_NOKEY.
*/
int
{
int c;
/*
* Do the necessary magic for localization support.
*/
#if !defined(TEXT_DOMAIN)
#endif
(void) textdomain(TEXT_DOMAIN);
/*
* Initialize program name for use by wbku_printerr().
*/
wbku_errinit(argv[0]);
/*
* Should be at least three arguments.
*/
if (argc < 3) {
return (HMAC_ERROR);
}
/*
* Parse the options.
*/
switch (c) {
case 'i':
/*
* Optional input file.
*/
break;
case 'k':
/*
* Path to key file.
*/
break;
default:
return (HMAC_ERROR);
}
}
/*
* A key file must be defined.
*/
if (keyfile_name == NULL) {
wbku_printerr("Must specify the key_file\n");
return (HMAC_ERROR);
}
/*
* If the user did not provide an input file for the data,
* then use stdin as the source.
*/
if (infile_name == NULL) {
} else {
if (in_fd < 0) {
wbku_printerr("Cannot open input_file");
return (HMAC_ERROR);
}
}
/*
* Open the key file for reading.
*/
goto out;
}
/*
* Create a SHA1 key attribute structure. It's the only hash
* type we support.
*/
if (wbkuret != WBKU_SUCCESS) {
goto out;
}
/*
* Find the client key, if it exists.
*/
if (wbkuret != WBKU_SUCCESS) {
} else {
}
out:
/*
* Cleanup.
*/
if (in_fd != -1) {
}
}
return (ret);
}