From: Stefan E. <se...@us...> - 2002-04-17 18:35:39
|
Update of /cvsroot/blob/blob/src/commands In directory usw-pr-cvs1:/tmp/cvs-serv15096 Added Files: md5chk.c Log Message: - command wrapper for MD5 checks --- NEW FILE: md5chk.c --- /* * md5chk.c: command wrapper for md5 checks * * Copyright (C) 2001 Stefan Eletzhofer <ste...@ww...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ident "$Id: md5chk.c,v 1.1 2002/04/17 18:35:35 seletz Exp $" /********************************************************************** * Includes */ #ifdef HAVE_CONFIG_H # include <blob/config.h> #endif #include <blob/errno.h> #include <blob/debug.h> #include <blob/types.h> #include <blob/serial.h> #include <blob/util.h> #include <blob/md5.h> #include <blob/md5support.h> /********************************************************************** * defines */ /* this will send a cold shiver through erik's spine ... */ #define ERR( x ) { ret = x; goto DONE; } /********************************************************************* * Poke * * AUTOR: Stefan Eletzhofer * REVISED: * * Poke values to memory * */ int md5chk_cmd( int argc, char *argv[] ) { int ret = 0; u32 address, len; u32 digest; if ( argc < 3 ) ERR( -EINVAL ); ret = strtou32(argv[1], &address); if ( ret < 0 ) ERR( -EINVAL ); ret = strtou32(argv[2], &len); if ( ret < 0 ) ERR( -EINVAL ); dprintf("adr=0x%08x, len=0x%08x\n", address, len ); md5_buffer( (const char *)address, len, &digest ); print_md5_digest(&digest); serial_write( '\n' ); ret = 0; DONE: return ret; } char md5chk_help[] = "md5chk adress len\n\ncalculate md5 hash value\n"; |