Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MACsec XPN changes #34

Merged
merged 1 commit into from
Jul 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/drivers/driver_macsec_sonic.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@ static int macsec_sonic_set_current_cipher_suite(void *priv, u64 cs)
{
cipher_suite = "GCM-AES-256";
}
else if (cs == CS_ID_GCM_AES_XPN_128)
{
cipher_suite = "GCM-AES-XPN-128";
}
else if (cs == CS_ID_GCM_AES_XPN_256)
{
cipher_suite = "GCM-AES-XPN-256";
}
else
{
return SONIC_DB_FAIL;
Expand Down Expand Up @@ -575,23 +583,23 @@ static int macsec_sonic_create_receive_sa(void *priv, struct receive_sa *sa)
char * sak = create_binary_hex(sa->pkey->key, sa->pkey->key_len);
char * pn = create_buffer("%" PRIu64 "", sa->lowest_pn);
char * auth_key = create_auth_key(sa->pkey->key, sa->pkey->key_len);
char * ssci = create_buffer("%u", sa->sc->ssci);
char * salt = create_binary_hex(&sa->pkey->salt, sizeof(sa->pkey->salt));
PRINT_LOG("%s (enable_receive=%d next_pn=%" PRIu64 ") %s %s",
key,
sa->enable_receive,
sa->lowest_pn,
sak_id,
sak);

// TODO
// SALT
const struct sonic_db_name_value_pair pairs[] =
{
{"active", "false"},
{"sak", sak},
{"auth_key", auth_key},
{"lowest_acceptable_pn", pn},
{"salt", ""},
{"ssci", ""}
{"ssci", ssci},
{"salt", salt}
};
int ret = sonic_db_set(
drv->sonic_manager,
Expand All @@ -604,6 +612,8 @@ static int macsec_sonic_create_receive_sa(void *priv, struct receive_sa *sa)
free(sak);
free(pn);
free(auth_key);
free(ssci);
free(salt);
return ret;
}

Expand Down Expand Up @@ -811,22 +821,22 @@ static int macsec_sonic_create_transmit_sa(void *priv, struct transmit_sa *sa)
char * sak = create_binary_hex(sa->pkey->key, sa->pkey->key_len);
char * pn = create_buffer("%" PRIu64 "", sa->next_pn);
char * auth_key = create_auth_key(sa->pkey->key, sa->pkey->key_len);
char * ssci = create_buffer("%u", sa->sc->ssci);
char * salt = create_binary_hex(&sa->pkey->salt, sizeof(sa->pkey->salt));
PRINT_LOG("%s (enable_receive=%d next_pn=%" PRIu64 ") %s %s",
key,
sa->enable_transmit,
sa->next_pn,
sak_id,
sak);

// TODO
// SALT
const struct sonic_db_name_value_pair pairs[] =
{
{"sak", sak},
{"auth_key", auth_key},
{"next_pn", pn},
{"salt", ""},
{"ssci", ""}
{"ssci", ssci},
{"salt", salt}
};
int ret = sonic_db_set(
drv->sonic_manager,
Expand All @@ -839,6 +849,8 @@ static int macsec_sonic_create_transmit_sa(void *priv, struct transmit_sa *sa)
free(sak);
free(pn);
free(auth_key);
free(ssci);
free(salt);

return ret;
}
Expand Down