22 #define SSH_DIGEST_MAX_LENGTH 64
25 #define SSH_DIGEST_MD5 0
26 #define SSH_DIGEST_SHA1 1
27 #define SSH_DIGEST_SHA256 2
28 #define SSH_DIGEST_SHA384 3
29 #define SSH_DIGEST_SHA512 4
30 #define SSH_DIGEST_NULL 5
31 #define SSH_DIGEST_MAX 6
34 struct ssh_digest_ctx;
37 #include <openssl/evp.h>
39 const EVP_MD *ssh_digest_to_md(
int digest_type);
43 int ssh_digest_alg_by_name(
const char *name);
46 const char *ssh_digest_alg_name(
int alg);
49 size_t ssh_digest_bytes(
int alg);
52 size_t ssh_digest_blocksize(
struct ssh_digest_ctx *ctx);
55 int ssh_digest_copy_state(
struct ssh_digest_ctx *from,
56 struct ssh_digest_ctx *to);
59 int ssh_digest_memory(
int alg,
const void *m,
size_t mlen,
60 u_char *d,
size_t dlen)
61 __attribute__((__bounded__(__buffer__, 2, 3)))
62 __attribute__((__bounded__(__buffer__, 4, 5)));
63 int ssh_digest_buffer(
int alg, const struct sshbuf *b, u_char *d,
size_t dlen)
64 __attribute__((__bounded__(__buffer__, 3, 4)));
67 struct ssh_digest_ctx *ssh_digest_start(
int alg);
68 int ssh_digest_update(struct ssh_digest_ctx *ctx, const
void *m,
size_t mlen)
69 __attribute__((__bounded__(__buffer__, 2, 3)));
70 int ssh_digest_update_buffer(struct ssh_digest_ctx *ctx,
71 const struct sshbuf *b);
72 int ssh_digest_final(struct ssh_digest_ctx *ctx, u_char *d,
size_t dlen)
73 __attribute__((__bounded__(__buffer__, 2, 3)));
74 void ssh_digest_free(struct ssh_digest_ctx *ctx);