EAP-pwd: Mark helper function arguments const when appropriate
These variables are not modified during PWE or key computation. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
9ccc10f56e
commit
2bd2ed2006
2 changed files with 18 additions and 12 deletions
|
@ -86,9 +86,10 @@ static int eap_pwd_kdf(const u8 *key, size_t keylen, const u8 *label,
|
||||||
* on the password and identities.
|
* on the password and identities.
|
||||||
*/
|
*/
|
||||||
int compute_password_element(EAP_PWD_group *grp, u16 num,
|
int compute_password_element(EAP_PWD_group *grp, u16 num,
|
||||||
u8 *password, int password_len,
|
const u8 *password, size_t password_len,
|
||||||
u8 *id_server, int id_server_len,
|
const u8 *id_server, size_t id_server_len,
|
||||||
u8 *id_peer, int id_peer_len, u8 *token)
|
const u8 *id_peer, size_t id_peer_len,
|
||||||
|
const u8 *token)
|
||||||
{
|
{
|
||||||
BIGNUM *x_candidate = NULL, *rnd = NULL, *cofactor = NULL;
|
BIGNUM *x_candidate = NULL, *rnd = NULL, *cofactor = NULL;
|
||||||
struct crypto_hash *hash;
|
struct crypto_hash *hash;
|
||||||
|
@ -283,10 +284,10 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int compute_keys(EAP_PWD_group *grp, BN_CTX *bnctx, BIGNUM *k,
|
int compute_keys(EAP_PWD_group *grp, BN_CTX *bnctx, const BIGNUM *k,
|
||||||
BIGNUM *peer_scalar, BIGNUM *server_scalar,
|
const BIGNUM *peer_scalar, const BIGNUM *server_scalar,
|
||||||
u8 *confirm_peer, u8 *confirm_server,
|
const u8 *confirm_peer, const u8 *confirm_server,
|
||||||
u32 *ciphersuite, u8 *msk, u8 *emsk, u8 *session_id)
|
const u32 *ciphersuite, u8 *msk, u8 *emsk, u8 *session_id)
|
||||||
{
|
{
|
||||||
struct crypto_hash *hash;
|
struct crypto_hash *hash;
|
||||||
u8 mk[SHA256_MAC_LEN], *cruft;
|
u8 mk[SHA256_MAC_LEN], *cruft;
|
||||||
|
@ -306,7 +307,7 @@ int compute_keys(EAP_PWD_group *grp, BN_CTX *bnctx, BIGNUM *k,
|
||||||
os_free(cruft);
|
os_free(cruft);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
eap_pwd_h_update(hash, (u8 *) ciphersuite, sizeof(u32));
|
eap_pwd_h_update(hash, (const u8 *) ciphersuite, sizeof(u32));
|
||||||
offset = BN_num_bytes(grp->order) - BN_num_bytes(peer_scalar);
|
offset = BN_num_bytes(grp->order) - BN_num_bytes(peer_scalar);
|
||||||
os_memset(cruft, 0, BN_num_bytes(grp->prime));
|
os_memset(cruft, 0, BN_num_bytes(grp->prime));
|
||||||
BN_bn2bin(peer_scalar, cruft + offset);
|
BN_bn2bin(peer_scalar, cruft + offset);
|
||||||
|
|
|
@ -56,10 +56,15 @@ struct eap_pwd_id {
|
||||||
} STRUCT_PACKED;
|
} STRUCT_PACKED;
|
||||||
|
|
||||||
/* common routines */
|
/* common routines */
|
||||||
int compute_password_element(EAP_PWD_group *, u16, u8 *, int, u8 *, int, u8 *,
|
int compute_password_element(EAP_PWD_group *grp, u16 num,
|
||||||
int, u8 *);
|
const u8 *password, size_t password_len,
|
||||||
int compute_keys(EAP_PWD_group *, BN_CTX *, BIGNUM *, BIGNUM *, BIGNUM *,
|
const u8 *id_server, size_t id_server_len,
|
||||||
u8 *, u8 *, u32 *, u8 *, u8 *, u8 *);
|
const u8 *id_peer, size_t id_peer_len,
|
||||||
|
const u8 *token);
|
||||||
|
int compute_keys(EAP_PWD_group *grp, BN_CTX *bnctx, const BIGNUM *k,
|
||||||
|
const BIGNUM *peer_scalar, const BIGNUM *server_scalar,
|
||||||
|
const u8 *confirm_peer, const u8 *confirm_server,
|
||||||
|
const u32 *ciphersuite, u8 *msk, u8 *emsk, u8 *session_id);
|
||||||
struct crypto_hash * eap_pwd_h_init(void);
|
struct crypto_hash * eap_pwd_h_init(void);
|
||||||
void eap_pwd_h_update(struct crypto_hash *hash, const u8 *data, size_t len);
|
void eap_pwd_h_update(struct crypto_hash *hash, const u8 *data, size_t len);
|
||||||
void eap_pwd_h_final(struct crypto_hash *hash, u8 *digest);
|
void eap_pwd_h_final(struct crypto_hash *hash, u8 *digest);
|
||||||
|
|
Loading…
Reference in a new issue