aboutsummaryrefslogtreecommitdiffstats
path: root/sm
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-11-05 07:23:15 +0000
committerWerner Koch <[email protected]>2014-11-05 07:23:15 +0000
commit91b826a38880fd8a989318585eb502582636ddd8 (patch)
treecbac936eb1bd009986f4f95d762316a4a36c19b9 /sm
parentRemove all expired common CA certificates. (diff)
downloadgnupg-91b826a38880fd8a989318585eb502582636ddd8.tar.gz
gnupg-91b826a38880fd8a989318585eb502582636ddd8.zip
Avoid sign extension when shifting the MSB.
* sm/fingerprint.c (gpgsm_get_short_fingerprint): Cast MSB before shifting. * g10/build-packet.c (delete_sig_subpkt): Ditto. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'sm')
-rw-r--r--sm/fingerprint.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sm/fingerprint.c b/sm/fingerprint.c
index b0c7608cf..b849afb4e 100644
--- a/sm/fingerprint.c
+++ b/sm/fingerprint.c
@@ -149,8 +149,14 @@ gpgsm_get_short_fingerprint (ksba_cert_t cert, unsigned long *r_high)
gpgsm_get_fingerprint (cert, GCRY_MD_SHA1, digest, NULL);
if (r_high)
- *r_high = ((digest[12]<<24)|(digest[13]<<16)|(digest[14]<< 8)|digest[15]);
- return ((digest[16]<<24)|(digest[17]<<16)|(digest[18]<< 8)|digest[19]);
+ *r_high = (((unsigned long)digest[12]<<24)
+ |(digest[13]<<16)
+ |(digest[14]<< 8)
+ |digest[15]);
+ return (((unsigned long)digest[16]<<24)
+ |(digest[17]<<16)
+ |(digest[18]<<8)
+ |digest[19]);
}