Fix potential NULL pointer dereferences.
This commit is contained in:
parent
d03dc91e27
commit
52f64cdf95
2 changed files with 17 additions and 2 deletions
|
|
@ -81,6 +81,9 @@ void cipher_close(cipher_t *cipher) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t cipher_keylength(const cipher_t *cipher) {
|
size_t cipher_keylength(const cipher_t *cipher) {
|
||||||
|
if(!cipher || !cipher->cipher)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return cipher->cipher->key_len + cipher->cipher->block_size;
|
return cipher->cipher->key_len + cipher->cipher->block_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,7 +224,10 @@ bool cipher_decrypt(cipher_t *cipher, const void *indata, size_t inlen, void *ou
|
||||||
}
|
}
|
||||||
|
|
||||||
int cipher_get_nid(const cipher_t *cipher) {
|
int cipher_get_nid(const cipher_t *cipher) {
|
||||||
return cipher->cipher ? cipher->cipher->nid : 0;
|
if(!cipher || !cipher->cipher)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return cipher->cipher->nid;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cipher_active(const cipher_t *cipher) {
|
bool cipher_active(const cipher_t *cipher) {
|
||||||
|
|
|
||||||
|
|
@ -115,14 +115,23 @@ bool digest_verify(digest_t *digest, const void *indata, size_t inlen, const voi
|
||||||
}
|
}
|
||||||
|
|
||||||
int digest_get_nid(const digest_t *digest) {
|
int digest_get_nid(const digest_t *digest) {
|
||||||
return digest->digest ? digest->digest->type : 0;
|
if(!digest || !digest->digest)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return digest->digest->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t digest_keylength(const digest_t *digest) {
|
size_t digest_keylength(const digest_t *digest) {
|
||||||
|
if(!digest || !digest->digest)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return digest->digest->md_size;
|
return digest->digest->md_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t digest_length(const digest_t *digest) {
|
size_t digest_length(const digest_t *digest) {
|
||||||
|
if(!digest)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return digest->maclength;
|
return digest->maclength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue