trace back crypto algorithms to the plugins that registered them
This commit is contained in:
+148
-119
@@ -26,14 +26,15 @@
|
||||
|
||||
static struct encrypt_desc encrypt_desc_3des =
|
||||
{
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_3DES_CBC,
|
||||
algo_next: NULL,
|
||||
|
||||
enc_blocksize: DES_BLOCK_SIZE,
|
||||
keydeflen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
|
||||
keyminlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
|
||||
keymaxlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_3DES_CBC,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
|
||||
enc_blocksize: DES_BLOCK_SIZE,
|
||||
keydeflen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
|
||||
keyminlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
|
||||
keymaxlen: DES_BLOCK_SIZE * 3 * BITS_PER_BYTE,
|
||||
};
|
||||
|
||||
#define AES_KEY_MIN_LEN 128
|
||||
@@ -42,14 +43,15 @@ static struct encrypt_desc encrypt_desc_3des =
|
||||
|
||||
static struct encrypt_desc encrypt_desc_aes =
|
||||
{
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_AES_CBC,
|
||||
algo_next: NULL,
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_AES_CBC,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
|
||||
enc_blocksize: AES_BLOCK_SIZE,
|
||||
keyminlen: AES_KEY_MIN_LEN,
|
||||
keydeflen: AES_KEY_DEF_LEN,
|
||||
keymaxlen: AES_KEY_MAX_LEN,
|
||||
enc_blocksize: AES_BLOCK_SIZE,
|
||||
keyminlen: AES_KEY_MIN_LEN,
|
||||
keydeflen: AES_KEY_DEF_LEN,
|
||||
keymaxlen: AES_KEY_MAX_LEN,
|
||||
};
|
||||
|
||||
#define CAMELLIA_KEY_MIN_LEN 128
|
||||
@@ -58,14 +60,15 @@ static struct encrypt_desc encrypt_desc_aes =
|
||||
|
||||
static struct encrypt_desc encrypt_desc_camellia =
|
||||
{
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_CAMELLIA_CBC,
|
||||
algo_next: NULL,
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_CAMELLIA_CBC,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
|
||||
enc_blocksize: CAMELLIA_BLOCK_SIZE,
|
||||
keyminlen: CAMELLIA_KEY_MIN_LEN,
|
||||
keydeflen: CAMELLIA_KEY_DEF_LEN,
|
||||
keymaxlen: CAMELLIA_KEY_MAX_LEN,
|
||||
enc_blocksize: CAMELLIA_BLOCK_SIZE,
|
||||
keyminlen: CAMELLIA_KEY_MIN_LEN,
|
||||
keydeflen: CAMELLIA_KEY_DEF_LEN,
|
||||
keymaxlen: CAMELLIA_KEY_MAX_LEN,
|
||||
};
|
||||
|
||||
#define BLOWFISH_KEY_MIN_LEN 128
|
||||
@@ -73,14 +76,15 @@ static struct encrypt_desc encrypt_desc_camellia =
|
||||
|
||||
static struct encrypt_desc encrypt_desc_blowfish =
|
||||
{
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_BLOWFISH_CBC,
|
||||
algo_next: NULL,
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_BLOWFISH_CBC,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
|
||||
enc_blocksize: BLOWFISH_BLOCK_SIZE,
|
||||
keyminlen: BLOWFISH_KEY_MIN_LEN,
|
||||
keydeflen: BLOWFISH_KEY_MIN_LEN,
|
||||
keymaxlen: BLOWFISH_KEY_MAX_LEN,
|
||||
enc_blocksize: BLOWFISH_BLOCK_SIZE,
|
||||
keyminlen: BLOWFISH_KEY_MIN_LEN,
|
||||
keydeflen: BLOWFISH_KEY_MIN_LEN,
|
||||
keymaxlen: BLOWFISH_KEY_MAX_LEN,
|
||||
};
|
||||
|
||||
#define SERPENT_KEY_MIN_LEN 128
|
||||
@@ -89,14 +93,15 @@ static struct encrypt_desc encrypt_desc_blowfish =
|
||||
|
||||
static struct encrypt_desc encrypt_desc_serpent =
|
||||
{
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_SERPENT_CBC,
|
||||
algo_next: NULL,
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_SERPENT_CBC,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
|
||||
enc_blocksize: SERPENT_BLOCK_SIZE,
|
||||
keyminlen: SERPENT_KEY_MIN_LEN,
|
||||
keydeflen: SERPENT_KEY_DEF_LEN,
|
||||
keymaxlen: SERPENT_KEY_MAX_LEN,
|
||||
enc_blocksize: SERPENT_BLOCK_SIZE,
|
||||
keyminlen: SERPENT_KEY_MIN_LEN,
|
||||
keydeflen: SERPENT_KEY_DEF_LEN,
|
||||
keymaxlen: SERPENT_KEY_MAX_LEN,
|
||||
};
|
||||
|
||||
#define TWOFISH_KEY_MIN_LEN 128
|
||||
@@ -105,32 +110,35 @@ static struct encrypt_desc encrypt_desc_serpent =
|
||||
|
||||
static struct encrypt_desc encrypt_desc_twofish =
|
||||
{
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_TWOFISH_CBC,
|
||||
algo_next: NULL,
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_TWOFISH_CBC,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
|
||||
enc_blocksize: TWOFISH_BLOCK_SIZE,
|
||||
keydeflen: TWOFISH_KEY_MIN_LEN,
|
||||
keyminlen: TWOFISH_KEY_DEF_LEN,
|
||||
keymaxlen: TWOFISH_KEY_MAX_LEN,
|
||||
enc_blocksize: TWOFISH_BLOCK_SIZE,
|
||||
keydeflen: TWOFISH_KEY_MIN_LEN,
|
||||
keyminlen: TWOFISH_KEY_DEF_LEN,
|
||||
keymaxlen: TWOFISH_KEY_MAX_LEN,
|
||||
};
|
||||
|
||||
static struct encrypt_desc encrypt_desc_twofish_ssh =
|
||||
{
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_TWOFISH_CBC_SSH,
|
||||
algo_next: NULL,
|
||||
algo_type: IKE_ALG_ENCRYPT,
|
||||
algo_id: OAKLEY_TWOFISH_CBC_SSH,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
|
||||
enc_blocksize: TWOFISH_BLOCK_SIZE,
|
||||
keydeflen: TWOFISH_KEY_MIN_LEN,
|
||||
keyminlen: TWOFISH_KEY_DEF_LEN,
|
||||
keymaxlen: TWOFISH_KEY_MAX_LEN,
|
||||
enc_blocksize: TWOFISH_BLOCK_SIZE,
|
||||
keydeflen: TWOFISH_KEY_MIN_LEN,
|
||||
keyminlen: TWOFISH_KEY_DEF_LEN,
|
||||
keymaxlen: TWOFISH_KEY_MAX_LEN,
|
||||
};
|
||||
|
||||
static struct hash_desc hash_desc_md5 =
|
||||
{
|
||||
algo_type: IKE_ALG_HASH,
|
||||
algo_id: OAKLEY_MD5,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
hash_digest_size: HASH_SIZE_MD5,
|
||||
};
|
||||
@@ -139,6 +147,7 @@ static struct hash_desc hash_desc_sha1 =
|
||||
{
|
||||
algo_type: IKE_ALG_HASH,
|
||||
algo_id: OAKLEY_SHA,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
hash_digest_size: HASH_SIZE_SHA1,
|
||||
};
|
||||
@@ -146,6 +155,7 @@ static struct hash_desc hash_desc_sha1 =
|
||||
static struct hash_desc hash_desc_sha2_256 = {
|
||||
algo_type: IKE_ALG_HASH,
|
||||
algo_id: OAKLEY_SHA2_256,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
hash_digest_size: HASH_SIZE_SHA256,
|
||||
};
|
||||
@@ -153,6 +163,7 @@ static struct hash_desc hash_desc_sha2_256 = {
|
||||
static struct hash_desc hash_desc_sha2_384 = {
|
||||
algo_type: IKE_ALG_HASH,
|
||||
algo_id: OAKLEY_SHA2_384,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
hash_digest_size: HASH_SIZE_SHA384,
|
||||
};
|
||||
@@ -160,120 +171,136 @@ static struct hash_desc hash_desc_sha2_384 = {
|
||||
static struct hash_desc hash_desc_sha2_512 = {
|
||||
algo_type: IKE_ALG_HASH,
|
||||
algo_id: OAKLEY_SHA2_512,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
hash_digest_size: HASH_SIZE_SHA512,
|
||||
};
|
||||
|
||||
const struct dh_desc unset_group = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_NONE,
|
||||
algo_next: NULL,
|
||||
ke_size: 0
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_NONE,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 0
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_1024 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_1024_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 1024 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_1024_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 1024 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_1536 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_1536_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 1536 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_1536_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 1536 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_2048 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_2048_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 2048 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_2048_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 2048 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_3072 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_3072_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 3072 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_3072_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 3072 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_4096 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_4096_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 4096 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_4096_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 4096 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_6144 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_6144_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 6144 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_6144_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 6144 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_8192 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_8192_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 8192 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_8192_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 8192 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_ecp_256 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: ECP_256_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*256 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: ECP_256_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*256 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_ecp_384 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: ECP_384_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*384 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: ECP_384_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*384 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_ecp_521 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: ECP_521_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*528 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: ECP_521_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*528 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_1024_160 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_1024_160,
|
||||
algo_next: NULL,
|
||||
ke_size: 1024 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_1024_160,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 1024 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_2048_224 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_2048_224,
|
||||
algo_next: NULL,
|
||||
ke_size: 2048 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_2048_224,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 2048 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_modp_2048_256 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_2048_256,
|
||||
algo_next: NULL,
|
||||
ke_size: 2048 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: MODP_2048_256,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 2048 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_ecp_192 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: ECP_192_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*192 / BITS_PER_BYTE
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: ECP_192_BIT,
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*192 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
static struct dh_desc dh_desc_ecp_224 = {
|
||||
algo_type: IKE_ALG_DH_GROUP,
|
||||
algo_id: ECP_224_BIT,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*224 / BITS_PER_BYTE
|
||||
plugin_name: NULL,
|
||||
algo_next: NULL,
|
||||
ke_size: 2*224 / BITS_PER_BYTE
|
||||
};
|
||||
|
||||
bool init_crypto(void)
|
||||
@@ -282,11 +309,12 @@ bool init_crypto(void)
|
||||
encryption_algorithm_t encryption_alg;
|
||||
hash_algorithm_t hash_alg;
|
||||
diffie_hellman_group_t dh_group;
|
||||
const char *plugin_name;
|
||||
bool no_md5 = TRUE;
|
||||
bool no_sha1 = TRUE;
|
||||
|
||||
enumerator = lib->crypto->create_hasher_enumerator(lib->crypto);
|
||||
while (enumerator->enumerate(enumerator, &hash_alg))
|
||||
while (enumerator->enumerate(enumerator, &hash_alg, &plugin_name))
|
||||
{
|
||||
const struct hash_desc *desc;
|
||||
|
||||
@@ -312,7 +340,7 @@ bool init_crypto(void)
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
ike_alg_add((struct ike_alg *)desc);
|
||||
ike_alg_add((struct ike_alg *)desc, plugin_name);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
@@ -326,7 +354,7 @@ bool init_crypto(void)
|
||||
}
|
||||
|
||||
enumerator = lib->crypto->create_crypter_enumerator(lib->crypto);
|
||||
while (enumerator->enumerate(enumerator, &encryption_alg))
|
||||
while (enumerator->enumerate(enumerator, &encryption_alg, &plugin_name))
|
||||
{
|
||||
const struct encrypt_desc *desc;
|
||||
|
||||
@@ -346,7 +374,8 @@ bool init_crypto(void)
|
||||
break;
|
||||
case ENCR_TWOFISH_CBC:
|
||||
desc = &encrypt_desc_twofish;
|
||||
ike_alg_add((struct ike_alg *)&encrypt_desc_twofish_ssh);
|
||||
ike_alg_add((struct ike_alg *)&encrypt_desc_twofish_ssh,
|
||||
plugin_name);
|
||||
break;
|
||||
case ENCR_SERPENT_CBC:
|
||||
desc = &encrypt_desc_serpent;
|
||||
@@ -354,12 +383,12 @@ bool init_crypto(void)
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
ike_alg_add((struct ike_alg *)desc);
|
||||
ike_alg_add((struct ike_alg *)desc, plugin_name);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
enumerator = lib->crypto->create_dh_enumerator(lib->crypto);
|
||||
while (enumerator->enumerate(enumerator, &dh_group))
|
||||
while (enumerator->enumerate(enumerator, &dh_group, &plugin_name))
|
||||
{
|
||||
const struct dh_desc *desc;
|
||||
|
||||
@@ -413,7 +442,7 @@ bool init_crypto(void)
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
ike_alg_add((struct ike_alg *)desc);
|
||||
ike_alg_add((struct ike_alg *)desc, plugin_name);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
return TRUE;
|
||||
|
||||
+30
-5
@@ -72,7 +72,7 @@ static struct ike_alg *ike_alg_find(u_int algo_type, u_int algo_id,
|
||||
/**
|
||||
* "raw" ike_alg list adding function
|
||||
*/
|
||||
int ike_alg_add(struct ike_alg* a)
|
||||
int ike_alg_add(struct ike_alg* a, const char *plugin_name)
|
||||
{
|
||||
if (a->algo_type > IKE_ALG_MAX)
|
||||
{
|
||||
@@ -96,6 +96,7 @@ int ike_alg_add(struct ike_alg* a)
|
||||
e = *ep;
|
||||
}
|
||||
*ep = a;
|
||||
a->plugin_name = plugin_name;
|
||||
a->algo_next = e;
|
||||
return 0;
|
||||
}
|
||||
@@ -308,7 +309,10 @@ fail:
|
||||
*/
|
||||
void ike_alg_list(void)
|
||||
{
|
||||
char buf[BUF_LEN];
|
||||
rng_quality_t quality;
|
||||
enumerator_t *enumerator;
|
||||
const char *plugin_name;
|
||||
char buf[1024];
|
||||
char *pos;
|
||||
int n, len;
|
||||
struct ike_alg *a;
|
||||
@@ -322,7 +326,8 @@ void ike_alg_list(void)
|
||||
len = BUF_LEN;
|
||||
for (a = ike_alg_base[IKE_ALG_ENCRYPT]; a != NULL; a = a->algo_next)
|
||||
{
|
||||
n = snprintf(pos, len, " %s", enum_name(&oakley_enc_names, a->algo_id));
|
||||
n = snprintf(pos, len, " %s[%s]", enum_name(&oakley_enc_names,
|
||||
a->algo_id), a->plugin_name);
|
||||
pos += n;
|
||||
len -= n;
|
||||
if (len <= 0)
|
||||
@@ -337,7 +342,8 @@ void ike_alg_list(void)
|
||||
len = BUF_LEN;
|
||||
for (a = ike_alg_base[IKE_ALG_HASH]; a != NULL; a = a->algo_next)
|
||||
{
|
||||
n = snprintf(pos, len, " %s", enum_name(&oakley_hash_names, a->algo_id));
|
||||
n = snprintf(pos, len, " %s[%s]", enum_name(&oakley_hash_names,
|
||||
a->algo_id), a->plugin_name);
|
||||
pos += n;
|
||||
len -= n;
|
||||
if (len <= 0)
|
||||
@@ -352,7 +358,8 @@ void ike_alg_list(void)
|
||||
len = BUF_LEN;
|
||||
for (a = ike_alg_base[IKE_ALG_DH_GROUP]; a != NULL; a = a->algo_next)
|
||||
{
|
||||
n = snprintf(pos, len, " %s", enum_name(&oakley_group_names, a->algo_id));
|
||||
n = snprintf(pos, len, " %s[%s]", enum_name(&oakley_group_names,
|
||||
a->algo_id), a->plugin_name);
|
||||
pos += n;
|
||||
len -= n;
|
||||
if (len <= 0)
|
||||
@@ -361,6 +368,24 @@ void ike_alg_list(void)
|
||||
}
|
||||
}
|
||||
whack_log(RC_COMMENT, " dh-group: %s", buf);
|
||||
|
||||
pos = buf;
|
||||
*pos = '\0';
|
||||
len = BUF_LEN;
|
||||
enumerator = lib->crypto->create_rng_enumerator(lib->crypto);
|
||||
while (enumerator->enumerate(enumerator, &quality, &plugin_name))
|
||||
{
|
||||
n = snprintf(pos, len, " %N[%s]", rng_quality_names, quality,
|
||||
plugin_name);
|
||||
pos += n;
|
||||
len -= n;
|
||||
if (len <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
whack_log(RC_COMMENT, " random-gen:%s", buf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-1
@@ -22,12 +22,14 @@
|
||||
struct ike_alg {
|
||||
u_int16_t algo_type;
|
||||
u_int16_t algo_id;
|
||||
const char *plugin_name;
|
||||
struct ike_alg *algo_next;
|
||||
};
|
||||
|
||||
struct encrypt_desc {
|
||||
u_int16_t algo_type;
|
||||
u_int16_t algo_id;
|
||||
const char *plugin_name;
|
||||
struct ike_alg *algo_next;
|
||||
|
||||
size_t enc_blocksize;
|
||||
@@ -39,6 +41,7 @@ struct encrypt_desc {
|
||||
struct hash_desc {
|
||||
u_int16_t algo_type;
|
||||
u_int16_t algo_id;
|
||||
const char *plugin_name;
|
||||
struct ike_alg *algo_next;
|
||||
|
||||
size_t hash_digest_size;
|
||||
@@ -47,6 +50,7 @@ struct hash_desc {
|
||||
struct dh_desc {
|
||||
u_int16_t algo_type;
|
||||
u_int16_t algo_id;
|
||||
const char *plugin_name;
|
||||
struct ike_alg *algo_next;
|
||||
|
||||
size_t ke_size;
|
||||
@@ -57,7 +61,7 @@ struct dh_desc {
|
||||
#define IKE_ALG_DH_GROUP 2
|
||||
#define IKE_ALG_MAX IKE_ALG_DH_GROUP
|
||||
|
||||
extern int ike_alg_add(struct ike_alg *a);
|
||||
extern int ike_alg_add(struct ike_alg *a, const char *plugin_name);
|
||||
extern struct hash_desc *ike_alg_get_hasher(u_int alg);
|
||||
extern struct encrypt_desc *ike_alg_get_crypter(u_int alg);
|
||||
extern struct dh_desc *ike_alg_get_dh_group(u_int alg);
|
||||
|
||||
Reference in New Issue
Block a user