aboutsummaryrefslogtreecommitdiffstats
path: root/src/scepclient/scep.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2012-07-09 15:33:41 +0200
committerMartin Willi <martin@revosec.ch>2012-07-16 14:55:06 +0200
commit8bd6a30af1b745f65f60130d4735df05096e07ce (patch)
tree8834701cea8764fb47281ea533096ec5dcc20b81 /src/scepclient/scep.c
parentce73fc19dbc36d089e595e452356deccd8afcd6f (diff)
downloadstrongswan-8bd6a30af1b745f65f60130d4735df05096e07ce.tar.bz2
strongswan-8bd6a30af1b745f65f60130d4735df05096e07ce.tar.xz
Add a return value to hasher_t.get_hash()
Diffstat (limited to 'src/scepclient/scep.c')
-rw-r--r--src/scepclient/scep.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/scepclient/scep.c b/src/scepclient/scep.c
index d6cf5f2cc..8b2fd179a 100644
--- a/src/scepclient/scep.c
+++ b/src/scepclient/scep.c
@@ -131,7 +131,11 @@ chunk_t scep_generate_pkcs10_fingerprint(chunk_t pkcs10)
hasher_t *hasher;
hasher = lib->crypto->create_hasher(lib->crypto, HASH_MD5);
- hasher->get_hash(hasher, pkcs10, digest.ptr);
+ if (!hasher || !hasher->get_hash(hasher, pkcs10, digest.ptr))
+ {
+ DESTROY_IF(hasher);
+ return chunk_empty;
+ }
hasher->destroy(hasher);
return chunk_to_hex(digest, NULL, FALSE);
@@ -157,8 +161,11 @@ void scep_generate_transaction_id(public_key_t *key, chunk_t *transID,
asn1_bitstring("m", keyEncoding));
hasher = lib->crypto->create_hasher(lib->crypto, HASH_MD5);
- hasher->get_hash(hasher, keyInfo, digest.ptr);
- hasher->destroy(hasher);
+ if (!hasher || !hasher->get_hash(hasher, keyInfo, digest.ptr))
+ {
+ memset(digest.ptr, 0, digest.len);
+ }
+ DESTROY_IF(hasher);
free(keyInfo.ptr);
/* is the most significant bit of the digest set? */