Add a return value to signer_t.set_key()
This commit is contained in:
@@ -138,7 +138,10 @@ METHOD(aead_t, set_key, bool,
|
||||
chunk_split(key, "mm", this->signer->get_key_size(this->signer), &sig,
|
||||
this->crypter->get_key_size(this->crypter), &enc);
|
||||
|
||||
this->signer->set_key(this->signer, sig);
|
||||
if (!this->signer->set_key(this->signer, sig))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
this->crypter->set_key(this->crypter, enc);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -488,7 +488,10 @@ static u_int bench_signer(private_crypto_tester_t *this,
|
||||
u_int runs;
|
||||
|
||||
memset(key, 0x12, sizeof(key));
|
||||
signer->set_key(signer, chunk_from_thing(key));
|
||||
if (!signer->set_key(signer, chunk_from_thing(key)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
buf = chunk_alloc(this->bench_size);
|
||||
memset(buf.ptr, 0x34, buf.len);
|
||||
@@ -547,8 +550,10 @@ METHOD(crypto_tester_t, test_signer, bool,
|
||||
failed = FALSE;
|
||||
|
||||
key = chunk_create(vector->key, signer->get_key_size(signer));
|
||||
signer->set_key(signer, key);
|
||||
|
||||
if (!signer->set_key(signer, key))
|
||||
{
|
||||
failed = TRUE;
|
||||
}
|
||||
/* allocated signature */
|
||||
data = chunk_create(vector->data, vector->len);
|
||||
if (!signer->allocate_signature(signer, data, &mac))
|
||||
|
||||
@@ -101,10 +101,11 @@ METHOD(signer_t, get_block_size, size_t,
|
||||
return this->truncation;
|
||||
}
|
||||
|
||||
METHOD(signer_t, set_key, void,
|
||||
METHOD(signer_t, set_key, bool,
|
||||
private_signer_t *this, chunk_t key)
|
||||
{
|
||||
this->mac->set_key(this->mac, key);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(signer_t, destroy, void,
|
||||
|
||||
@@ -140,8 +140,10 @@ struct signer_t {
|
||||
* Set the key for this object.
|
||||
*
|
||||
* @param key key to set
|
||||
* @return TRUE if key set
|
||||
*/
|
||||
void (*set_key) (signer_t *this, chunk_t key);
|
||||
__attribute__((warn_unused_result))
|
||||
bool (*set_key) (signer_t *this, chunk_t key);
|
||||
|
||||
/**
|
||||
* Destroys a signer_t object.
|
||||
|
||||
@@ -153,10 +153,11 @@ METHOD(signer_t, get_block_size, size_t,
|
||||
return this->block_size;
|
||||
}
|
||||
|
||||
METHOD(signer_t, set_key, void,
|
||||
METHOD(signer_t, set_key, bool,
|
||||
private_af_alg_signer_t *this, chunk_t key)
|
||||
{
|
||||
this->ops->set_key(this->ops, key);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(signer_t, destroy, void,
|
||||
|
||||
Reference in New Issue
Block a user