summaryrefslogtreecommitdiff
path: root/sshbuf-getput-crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshbuf-getput-crypto.c')
-rw-r--r--sshbuf-getput-crypto.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sshbuf-getput-crypto.c b/sshbuf-getput-crypto.c
index e2e093c00..d0d791b50 100644
--- a/sshbuf-getput-crypto.c
+++ b/sshbuf-getput-crypto.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf-getput-crypto.c,v 1.4 2015/01/14 15:02:39 djm Exp $ */ 1/* $OpenBSD: sshbuf-getput-crypto.c,v 1.5 2016/01/12 23:42:54 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -158,10 +158,10 @@ sshbuf_put_bignum2(struct sshbuf *buf, const BIGNUM *v)
158 if (len > 0 && (d[1] & 0x80) != 0) 158 if (len > 0 && (d[1] & 0x80) != 0)
159 prepend = 1; 159 prepend = 1;
160 if ((r = sshbuf_put_string(buf, d + 1 - prepend, len + prepend)) < 0) { 160 if ((r = sshbuf_put_string(buf, d + 1 - prepend, len + prepend)) < 0) {
161 bzero(d, sizeof(d)); 161 explicit_bzero(d, sizeof(d));
162 return r; 162 return r;
163 } 163 }
164 bzero(d, sizeof(d)); 164 explicit_bzero(d, sizeof(d));
165 return 0; 165 return 0;
166} 166}
167 167
@@ -177,13 +177,13 @@ sshbuf_put_bignum1(struct sshbuf *buf, const BIGNUM *v)
177 if (BN_bn2bin(v, d) != (int)len_bytes) 177 if (BN_bn2bin(v, d) != (int)len_bytes)
178 return SSH_ERR_INTERNAL_ERROR; /* Shouldn't happen */ 178 return SSH_ERR_INTERNAL_ERROR; /* Shouldn't happen */
179 if ((r = sshbuf_reserve(buf, len_bytes + 2, &dp)) < 0) { 179 if ((r = sshbuf_reserve(buf, len_bytes + 2, &dp)) < 0) {
180 bzero(d, sizeof(d)); 180 explicit_bzero(d, sizeof(d));
181 return r; 181 return r;
182 } 182 }
183 POKE_U16(dp, len_bits); 183 POKE_U16(dp, len_bits);
184 if (len_bytes != 0) 184 if (len_bytes != 0)
185 memcpy(dp + 2, d, len_bytes); 185 memcpy(dp + 2, d, len_bytes);
186 bzero(d, sizeof(d)); 186 explicit_bzero(d, sizeof(d));
187 return 0; 187 return 0;
188} 188}
189 189
@@ -210,7 +210,7 @@ sshbuf_put_ec(struct sshbuf *buf, const EC_POINT *v, const EC_GROUP *g)
210 } 210 }
211 BN_CTX_free(bn_ctx); 211 BN_CTX_free(bn_ctx);
212 ret = sshbuf_put_string(buf, d, len); 212 ret = sshbuf_put_string(buf, d, len);
213 bzero(d, len); 213 explicit_bzero(d, len);
214 return ret; 214 return ret;
215} 215}
216 216