Add EVP_get_cipherbyname, unbreak EVP_BytesToKey

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17136 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-04-21 15:01:20 +00:00
parent f4e2e10360
commit 22857c96da
2 changed files with 35 additions and 5 deletions

View File

@@ -764,6 +764,33 @@ EVP_aes_256_cbc(void)
return &aes_256_cbc;
}
/*
*
*/
static const struct cipher_name {
const char *name;
const EVP_CIPHER *(*func)(void);
} cipher_name[] = {
{ "des-ede3-cbc", EVP_des_ede3_cbc },
{ "aes-128-cbc", EVP_aes_128_cbc },
{ "aes-192-cbc", EVP_aes_192_cbc },
{ "aes-256-cbc", EVP_aes_256_cbc }
};
const EVP_CIPHER *
EVP_get_cipherbyname(const char *name)
{
int i;
for (i = 0; i < sizeof(cipher_name)/sizeof(cipher_name[0]); i++) {
if (strcasecmp(cipher_name[i].name, name) == 0)
return (*cipher_name[i].func)();
}
return NULL;
}
/*
*
*/
@@ -773,10 +800,9 @@ EVP_BytesToKey(const EVP_CIPHER *type,
const EVP_MD *md,
const void *salt,
const void *data, size_t datalen,
int count,
const void *key,
const void *iv)
unsigned int count,
void *keydata,
void *ivdata)
{
return 0;
}

View File

@@ -88,6 +88,7 @@
#define EVP_sha256 hc_EVP_sha256
#define PKCS5_PBKDF2_HMAC_SHA1 hc_PKCS5_PBKDF2_HMAC_SHA1
#define EVP_BytesToKey hc_EVP_BytesToKey
#define EVP_get_cipherbyname hc_EVP_get_cipherbyname
/*
*
@@ -204,6 +205,9 @@ int EVP_Digest(const void *, size_t, void *, unsigned int *,
*
*/
const EVP_CIPHER *
EVP_get_cipherbyname(const char *);
size_t EVP_CIPHER_block_size(const EVP_CIPHER *);
size_t EVP_CIPHER_key_length(const EVP_CIPHER *);
size_t EVP_CIPHER_iv_length(const EVP_CIPHER *);
@@ -234,7 +238,7 @@ int PKCS5_PBKDF2_HMAC_SHA1(const void *, size_t, const void *, size_t,
int EVP_BytesToKey(const EVP_CIPHER *, const EVP_MD *,
const void *, const void *, size_t,
int, const void *, const void *);
unsigned int, void *, void *);
#endif /* HEIM_EVP_H */