31 lines
601 B
C
31 lines
601 B
C
#ifndef LIBFT_SSL_H
|
|
#define LIBFT_SSL_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include "md5.h"
|
|
#include "sha256.h"
|
|
|
|
struct digest_algo
|
|
{
|
|
const char *name;
|
|
size_t digest_size;
|
|
size_t block_size;
|
|
void (*init) (void *ctx);
|
|
void (*update)(void *ctx, const uint8_t *data, size_t len);
|
|
void (*final) (void *ctx, uint8_t *out);
|
|
};
|
|
|
|
union digest_ctx
|
|
{
|
|
#define DIGEST_ALGO(lower, ds, bs) struct lower##_ctx lower;
|
|
#include "digest_algos.h"
|
|
#undef DIGEST_ALGO
|
|
};
|
|
|
|
#define DIGEST_ALGO(lower, ds, bs) extern const struct digest_algo g_##lower;
|
|
#include "digest_algos.h"
|
|
#undef DIGEST_ALGO
|
|
|
|
#endif
|