Add missing algorithms.

This commit is contained in:
Dag-Erling Smørgrav 2017-04-21 18:57:51 +02:00
parent 938dcaa450
commit bd3e353455
4 changed files with 34 additions and 0 deletions

View File

@ -189,3 +189,15 @@ chacha_finish(chacha_ctx *ctx)
(void)memset_s(ctx, 0, sizeof *ctx, sizeof *ctx);
}
cipher_algorithm chacha_cipher = {
.name = "chacha",
.contextlen = sizeof(chacha_ctx),
.blocklen = 64,
.keylen = 32,
.init = (cipher_init_func)chacha_init,
.keystream = (cipher_keystream_func)chacha_keystream,
.encrypt = (cipher_encrypt_func)chacha_encrypt,
.decrypt = (cipher_decrypt_func)chacha_decrypt,
.finish = (cipher_finish_func)chacha_finish,
};

View File

@ -35,7 +35,10 @@
#include <cryb/cipher.h>
#include <cryb/aes.h>
#include <cryb/chacha.h>
#include <cryb/des.h>
#include <cryb/rc4.h>
#include <cryb/salsa.h>
static const char *cryb_cipher_version_string = PACKAGE_VERSION;
@ -55,7 +58,12 @@ init_cipher_algorithms(void)
&aes128_cipher,
&aes192_cipher,
&aes256_cipher,
&chacha_cipher,
&des56_cipher,
&des112_cipher,
&des168_cipher,
&rc4_cipher,
&salsa_cipher,
NULL
};
cryb_cipher_algorithms = algorithms;

View File

@ -189,3 +189,15 @@ salsa_finish(salsa_ctx *ctx)
(void)memset_s(ctx, 0, sizeof *ctx, sizeof *ctx);
}
cipher_algorithm salsa_cipher = {
.name = "salsa",
.contextlen = sizeof(salsa_ctx),
.blocklen = 64,
.keylen = 32,
.init = (cipher_init_func)salsa_init,
.keystream = (cipher_keystream_func)salsa_keystream,
.encrypt = (cipher_encrypt_func)salsa_encrypt,
.decrypt = (cipher_decrypt_func)salsa_decrypt,
.finish = (cipher_finish_func)salsa_finish,
};

View File

@ -38,6 +38,7 @@
#include <cryb/md4.h>
#include <cryb/md5.h>
#include <cryb/sha1.h>
#include <cryb/sha224.h>
#include <cryb/sha256.h>
#include <cryb/sha384.h>
#include <cryb/sha512.h>
@ -61,6 +62,7 @@ init_digest_algorithms(void)
&md4_digest,
&md5_digest,
&sha1_digest,
&sha224_digest,
&sha256_digest,
&sha384_digest,
&sha512_digest,