5 #include <netinet/in.h>
12 static void alg_serpent_makekey(void *schedule, const void *key, int keylen) {
13 serpent_makekey(schedule, key, keylen);
16 static void alg_serpent_encrypt(const void *sch, const void *in, void *out) {
17 serpent_encrypt(in, out, sch);
20 static void alg_serpent_decrypt(const void *sch, const void *in, void *out) {
21 serpent_decrypt(in, out, sch);
24 const BlockCipherAlgInfo blockcipheralginfos[]= {
25 { "serpent", 16, sizeof(SerpentKeySchedule), 16,32,
26 serpent_byteswap_block,
27 { alg_serpent_makekey, alg_serpent_encrypt },
28 { alg_serpent_makekey, alg_serpent_decrypt } },
32 static void alg_sha1_init(void *state) { sha1_init(state); }
33 static void alg_sha1_update(void *state, const void *data, int len) {
34 sha1_update(state, data, len);
36 static void alg_sha1_final(void *state, void *digest) {
37 sha1_final(state, digest);
39 static void alg_sha1_oneshot(void *digest, const void *data, int len) {
40 sha1(data,len,digest);
43 static void alg_md5_init(void *state) { MD5Init(state); }
44 static void alg_md5_update(void *state, const void *data, int len) {
45 MD5Update(state, data, len);
47 static void alg_md5_final(void *state, void *digest) {
48 MD5Final(digest, state);
50 static void alg_md5_oneshot(void *digest, const void *data, int len) {
51 struct MD5Context ctx;
53 MD5Update(&ctx,data,len);
54 MD5Final(digest,&ctx);
57 const HashAlgInfo hashalginfos[]= {
58 { "sha1", 20, 64, sizeof(struct sha1_state),
59 alg_sha1_init, alg_sha1_update, alg_sha1_final, alg_sha1_oneshot },
60 { "md5", 16, 64, sizeof(struct MD5Context),
61 alg_md5_init, alg_md5_update, alg_md5_final, alg_md5_oneshot },