Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/crypto/external/bsd/openssh/dist/sshkey.c,v rcsdiff: /ftp/cvs/cvsroot/src/crypto/external/bsd/openssh/dist/sshkey.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.1.1.6 retrieving revision 1.1.1.7 diff -u -p -r1.1.1.6 -r1.1.1.7 --- src/crypto/external/bsd/openssh/dist/sshkey.c 2016/03/11 01:50:02 1.1.1.6 +++ src/crypto/external/bsd/openssh/dist/sshkey.c 2016/08/02 13:30:10 1.1.1.7 @@ -1,4 +1,4 @@ -/* $OpenBSD: sshkey.c,v 1.31 2015/12/11 04:21:12 mmcc Exp $ */ +/* $OpenBSD: sshkey.c,v 1.35 2016/06/19 07:48:02 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2008 Alexander von Gernler. All rights reserved. @@ -1930,7 +1930,8 @@ sshkey_from_blob_internal(struct sshbuf #ifdef DEBUG_PK /* XXX */ sshbuf_dump(b, stderr); #endif - *keyp = NULL; + if (keyp != NULL) + *keyp = NULL; if ((copy = sshbuf_fromb(b)) == NULL) { ret = SSH_ERR_ALLOC_FAIL; goto out; @@ -2083,8 +2084,10 @@ sshkey_from_blob_internal(struct sshbuf goto out; } ret = 0; - *keyp = key; - key = NULL; + if (keyp != NULL) { + *keyp = key; + key = NULL; + } out: sshbuf_free(copy); sshkey_free(key); @@ -2323,7 +2326,7 @@ sshkey_drop_cert(struct sshkey *k) /* Sign a certified key, (re-)generating the signed certblob. */ int -sshkey_certify(struct sshkey *k, struct sshkey *ca) +sshkey_certify(struct sshkey *k, struct sshkey *ca, const char *alg) { struct sshbuf *principals = NULL; u_char *ca_blob = NULL, *sig_blob = NULL, nonce[32]; @@ -2411,7 +2414,7 @@ sshkey_certify(struct sshkey *k, struct /* Sign the whole mess */ if ((ret = sshkey_sign(ca, &sig_blob, &sig_len, sshbuf_ptr(cert), - sshbuf_len(cert), NULL, 0)) != 0) + sshbuf_len(cert), alg, 0)) != 0) goto out; /* Append signature and we are done */ @@ -3575,12 +3578,10 @@ sshkey_parse_public_rsa1_fileblob(struct /* The encrypted private part is not parsed by this function. */ r = 0; - if (keyp != NULL) + if (keyp != NULL) { *keyp = pub; - else - sshkey_free(pub); - pub = NULL; - + pub = NULL; + } out: sshbuf_free(copy); sshkey_free(pub); @@ -3601,7 +3602,8 @@ sshkey_parse_private_rsa1(struct sshbuf const struct sshcipher *cipher; struct sshkey *prv = NULL; - *keyp = NULL; + if (keyp != NULL) + *keyp = NULL; if (commentp != NULL) *commentp = NULL; @@ -3687,8 +3689,10 @@ sshkey_parse_private_rsa1(struct sshbuf goto out; } r = 0; - *keyp = prv; - prv = NULL; + if (keyp != NULL) { + *keyp = prv; + prv = NULL; + } if (commentp != NULL) { *commentp = comment; comment = NULL; @@ -3713,7 +3717,8 @@ sshkey_parse_private_pem_fileblob(struct BIO *bio = NULL; int r; - *keyp = NULL; + if (keyp != NULL) + *keyp = NULL; if ((bio = BIO_new(BIO_s_mem())) == NULL || sshbuf_len(blob) > INT_MAX) return SSH_ERR_ALLOC_FAIL; @@ -3780,8 +3785,10 @@ sshkey_parse_private_pem_fileblob(struct goto out; } r = 0; - *keyp = prv; - prv = NULL; + if (keyp != NULL) { + *keyp = prv; + prv = NULL; + } out: BIO_free(bio); if (pk != NULL) @@ -3795,7 +3802,8 @@ int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type, const char *passphrase, struct sshkey **keyp, char **commentp) { - *keyp = NULL; + if (keyp != NULL) + *keyp = NULL; if (commentp != NULL) *commentp = NULL;