Open SCAP Library
|
00001 /* 00002 * Copyright 2010 Red Hat Inc., Durham, North Carolina. 00003 * All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * Authors: 00020 * "Daniel Kopecek" <dkopecek@redhat.com> 00021 */ 00022 #pragma once 00023 #ifndef CRAPI_DIGEST_H 00024 #define CRAPI_DIGEST_H 00025 00026 #include <stdarg.h> 00027 #include <stddef.h> 00028 00029 typedef enum { 00030 CRAPI_DIGEST_MD5 = 0x01, 00031 CRAPI_DIGEST_SHA1 = 0x02, 00032 CRAPI_DIGEST_SHA256 = 0x04, 00033 CRAPI_DIGEST_SHA512 = 0x08, 00034 CRAPI_DIGEST_RMD160 = 0x10 00035 } crapi_alg_t; 00036 00037 #define CRAPI_DIGEST_CNT 5 00038 00039 #include "md5.h" 00040 #include "sha1.h" 00041 #include "sha2.h" 00042 #include "rmd160.h" 00043 00044 int crapi_digest_fd (int fd, crapi_alg_t alg, void *dst, size_t *size); 00045 00046 struct digest_ctbl_t { 00047 void *ctx; 00048 void *(*init) (void *, void *); 00049 int (*update)(void *, void *, size_t); 00050 int (*fini) (void *); 00051 void (*free) (void *); 00052 }; 00053 00054 int crapi_mdigest_fd (int fd, int num, ... /*crapi_alg_t alg, void *dst, size_t *size, ...*/); 00055 00056 #endif /* CRAPI_DIGEST_H */