- markus@cvs.openbsd.org 2002/07/04 10:41:47
[key.c monitor_wrap.c ssh-dss.c ssh-rsa.c] don't allocate, copy, and discard if there is not interested in the data; ok deraadt@
This commit is contained in:
parent
8b2eecdf9f
commit
2bf759cba5
|
@ -12,6 +12,10 @@
|
|||
- deraadt@cvs.openbsd.org 2002/07/04 08:12:15
|
||||
[channels.c packet.c]
|
||||
blah blah minor nothing as i read and re-read and re-read...
|
||||
- markus@cvs.openbsd.org 2002/07/04 10:41:47
|
||||
[key.c monitor_wrap.c ssh-dss.c ssh-rsa.c]
|
||||
don't allocate, copy, and discard if there is not interested in the data;
|
||||
ok deraadt@
|
||||
|
||||
20020705
|
||||
- (tim) [configure.ac] AIX 4.2.1 has authenticate() in libs.
|
||||
|
@ -1295,4 +1299,4 @@
|
|||
- (stevesk) entropy.c: typo in debug message
|
||||
- (djm) ssh-keygen -i needs seeded RNG; report from markus@
|
||||
|
||||
$Id: ChangeLog,v 1.2343 2002/07/07 22:11:51 mouring Exp $
|
||||
$Id: ChangeLog,v 1.2344 2002/07/07 22:13:31 mouring Exp $
|
||||
|
|
17
key.c
17
key.c
|
@ -32,7 +32,7 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: key.c,v 1.47 2002/07/04 04:15:33 deraadt Exp $");
|
||||
RCSID("$OpenBSD: key.c,v 1.48 2002/07/04 10:41:47 markus Exp $");
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
|
@ -729,7 +729,6 @@ key_to_blob(Key *key, u_char **blobp, u_int *lenp)
|
|||
{
|
||||
Buffer b;
|
||||
int len;
|
||||
u_char *buf;
|
||||
|
||||
if (key == NULL) {
|
||||
error("key_to_blob: key == NULL");
|
||||
|
@ -755,16 +754,14 @@ key_to_blob(Key *key, u_char **blobp, u_int *lenp)
|
|||
return 0;
|
||||
}
|
||||
len = buffer_len(&b);
|
||||
buf = xmalloc(len);
|
||||
memcpy(buf, buffer_ptr(&b), len);
|
||||
memset(buffer_ptr(&b), 0, len);
|
||||
buffer_free(&b);
|
||||
if (lenp != NULL)
|
||||
*lenp = len;
|
||||
if (blobp != NULL)
|
||||
*blobp = buf;
|
||||
else
|
||||
xfree(buf);
|
||||
if (blobp != NULL) {
|
||||
*blobp = xmalloc(len);
|
||||
memcpy(*blobp, buffer_ptr(&b), len);
|
||||
}
|
||||
memset(buffer_ptr(&b), 0, len);
|
||||
buffer_free(&b);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: monitor_wrap.c,v 1.15 2002/07/04 04:15:33 deraadt Exp $");
|
||||
RCSID("$OpenBSD: monitor_wrap.c,v 1.16 2002/07/04 10:41:47 markus Exp $");
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/dh.h>
|
||||
|
@ -446,7 +446,6 @@ mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp)
|
|||
{
|
||||
Buffer b;
|
||||
int len;
|
||||
u_char *buf;
|
||||
Enc *enc;
|
||||
Mac *mac;
|
||||
Comp *comp;
|
||||
|
@ -484,16 +483,14 @@ mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp)
|
|||
buffer_put_cstring(&b, comp->name);
|
||||
|
||||
len = buffer_len(&b);
|
||||
buf = xmalloc(len);
|
||||
memcpy(buf, buffer_ptr(&b), len);
|
||||
memset(buffer_ptr(&b), 0, len);
|
||||
buffer_free(&b);
|
||||
if (lenp != NULL)
|
||||
*lenp = len;
|
||||
if (blobp != NULL)
|
||||
*blobp = buf;
|
||||
else
|
||||
xfree(blobp);
|
||||
if (blobp != NULL) {
|
||||
*blobp = xmalloc(len);
|
||||
memcpy(*blobp, buffer_ptr(&b), len);
|
||||
}
|
||||
memset(buffer_ptr(&b), 0, len);
|
||||
buffer_free(&b);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
|
26
ssh-dss.c
26
ssh-dss.c
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: ssh-dss.c,v 1.16 2002/07/04 04:15:33 deraadt Exp $");
|
||||
RCSID("$OpenBSD: ssh-dss.c,v 1.17 2002/07/04 10:41:47 markus Exp $");
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/evp.h>
|
||||
|
@ -46,7 +46,7 @@ ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp,
|
|||
DSA_SIG *sig;
|
||||
const EVP_MD *evp_md = EVP_sha1();
|
||||
EVP_MD_CTX md;
|
||||
u_char *ret, digest[EVP_MAX_MD_SIZE], sigblob[SIGBLOB_LEN];
|
||||
u_char digest[EVP_MAX_MD_SIZE], sigblob[SIGBLOB_LEN];
|
||||
u_int rlen, slen, len, dlen;
|
||||
Buffer b;
|
||||
|
||||
|
@ -79,29 +79,25 @@ ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp,
|
|||
DSA_SIG_free(sig);
|
||||
|
||||
if (datafellows & SSH_BUG_SIGBLOB) {
|
||||
ret = xmalloc(SIGBLOB_LEN);
|
||||
memcpy(ret, sigblob, SIGBLOB_LEN);
|
||||
if (lenp != NULL)
|
||||
*lenp = SIGBLOB_LEN;
|
||||
if (sigp != NULL)
|
||||
*sigp = ret;
|
||||
else
|
||||
xfree(ret);
|
||||
if (sigp != NULL) {
|
||||
*sigp = xmalloc(SIGBLOB_LEN);
|
||||
memcpy(*sigp, sigblob, SIGBLOB_LEN);
|
||||
}
|
||||
} else {
|
||||
/* ietf-drafts */
|
||||
buffer_init(&b);
|
||||
buffer_put_cstring(&b, "ssh-dss");
|
||||
buffer_put_string(&b, sigblob, SIGBLOB_LEN);
|
||||
len = buffer_len(&b);
|
||||
ret = xmalloc(len);
|
||||
memcpy(ret, buffer_ptr(&b), len);
|
||||
buffer_free(&b);
|
||||
if (lenp != NULL)
|
||||
*lenp = len;
|
||||
if (sigp != NULL)
|
||||
*sigp = ret;
|
||||
else
|
||||
xfree(ret);
|
||||
if (sigp != NULL) {
|
||||
*sigp = xmalloc(len);
|
||||
memcpy(*sigp, buffer_ptr(&b), len);
|
||||
}
|
||||
buffer_free(&b);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
18
ssh-rsa.c
18
ssh-rsa.c
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: ssh-rsa.c,v 1.22 2002/07/04 04:15:33 deraadt Exp $");
|
||||
RCSID("$OpenBSD: ssh-rsa.c,v 1.23 2002/07/04 10:41:47 markus Exp $");
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/err.h>
|
||||
|
@ -44,7 +44,7 @@ ssh_rsa_sign(Key *key, u_char **sigp, u_int *lenp,
|
|||
{
|
||||
const EVP_MD *evp_md;
|
||||
EVP_MD_CTX md;
|
||||
u_char digest[EVP_MAX_MD_SIZE], *sig, *ret;
|
||||
u_char digest[EVP_MAX_MD_SIZE], *sig;
|
||||
u_int slen, dlen, len;
|
||||
int ok, nid;
|
||||
Buffer b;
|
||||
|
@ -90,18 +90,16 @@ ssh_rsa_sign(Key *key, u_char **sigp, u_int *lenp,
|
|||
buffer_put_cstring(&b, "ssh-rsa");
|
||||
buffer_put_string(&b, sig, slen);
|
||||
len = buffer_len(&b);
|
||||
ret = xmalloc(len);
|
||||
memcpy(ret, buffer_ptr(&b), len);
|
||||
if (lenp != NULL)
|
||||
*lenp = len;
|
||||
if (sigp != NULL) {
|
||||
*sigp = xmalloc(len);
|
||||
memcpy(*sigp, buffer_ptr(&b), len);
|
||||
}
|
||||
buffer_free(&b);
|
||||
memset(sig, 's', slen);
|
||||
xfree(sig);
|
||||
|
||||
if (lenp != NULL)
|
||||
*lenp = len;
|
||||
if (sigp != NULL)
|
||||
*sigp = ret;
|
||||
else
|
||||
xfree(ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue