Open SCAP Library
/home/pvrabec/project/openscap/openscap-0.8.1/src/OVAL/probes/crapi/digest.h
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_DIGEST_SHA224 = 0x20,
00036         CRAPI_DIGEST_SHA384 = 0x40
00037 } crapi_alg_t;
00038 
00039 #define CRAPI_DIGEST_CNT 7
00040 
00041 #include "md5.h"
00042 #include "sha1.h"
00043 #include "sha2.h"
00044 #include "rmd160.h"
00045 
00046 int crapi_digest_fd (int fd, crapi_alg_t alg, void *dst, size_t *size);
00047 
00048 struct digest_ctbl_t {
00049         void *ctx;
00050         void *(*init)  (void *, void *);
00051         int   (*update)(void *, void *, size_t);
00052         int   (*fini)  (void *);
00053         void  (*free)  (void *);
00054 };
00055 
00056 int crapi_mdigest_fd (int fd, int num, ... /*crapi_alg_t alg, void *dst, size_t *size, ...*/);
00057 
00058 #endif /* CRAPI_DIGEST_H */