mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-12-31 14:52:08 +00:00
upstream: make get_sigtype public as sshkey_get_sigtype(); ok
markus@ OpenBSD-Commit-ID: 01f8cdbec63350490d2249f41112c5780d1cfbb8
This commit is contained in:
parent
dd8002fbe6
commit
f8df0413f0
14
sshkey.c
14
sshkey.c
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sshkey.c,v 1.81 2019/07/16 13:18:39 djm Exp $ */
|
||||
/* $OpenBSD: sshkey.c,v 1.82 2019/09/03 08:31:20 djm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
||||
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
|
||||
@ -90,7 +90,6 @@ int sshkey_private_serialize_opt(struct sshkey *key,
|
||||
struct sshbuf *buf, enum sshkey_serialize_rep);
|
||||
static int sshkey_from_blob_internal(struct sshbuf *buf,
|
||||
struct sshkey **keyp, int allow_cert);
|
||||
static int get_sigtype(const u_char *sig, size_t siglen, char **sigtypep);
|
||||
|
||||
/* Supported key types */
|
||||
struct keytype {
|
||||
@ -2200,7 +2199,8 @@ cert_parse(struct sshbuf *b, struct sshkey *key, struct sshbuf *certbuf)
|
||||
if ((ret = sshkey_verify(key->cert->signature_key, sig, slen,
|
||||
sshbuf_ptr(key->cert->certblob), signed_len, NULL, 0)) != 0)
|
||||
goto out;
|
||||
if ((ret = get_sigtype(sig, slen, &key->cert->signature_type)) != 0)
|
||||
if ((ret = sshkey_get_sigtype(sig, slen,
|
||||
&key->cert->signature_type)) != 0)
|
||||
goto out;
|
||||
|
||||
/* Success */
|
||||
@ -2502,8 +2502,8 @@ sshkey_froms(struct sshbuf *buf, struct sshkey **keyp)
|
||||
return r;
|
||||
}
|
||||
|
||||
static int
|
||||
get_sigtype(const u_char *sig, size_t siglen, char **sigtypep)
|
||||
int
|
||||
sshkey_get_sigtype(const u_char *sig, size_t siglen, char **sigtypep)
|
||||
{
|
||||
int r;
|
||||
struct sshbuf *b = NULL;
|
||||
@ -2585,7 +2585,7 @@ sshkey_check_sigtype(const u_char *sig, size_t siglen,
|
||||
return 0;
|
||||
if ((expected_alg = sshkey_sigalg_by_name(requested_alg)) == NULL)
|
||||
return SSH_ERR_INVALID_ARGUMENT;
|
||||
if ((r = get_sigtype(sig, siglen, &sigtype)) != 0)
|
||||
if ((r = sshkey_get_sigtype(sig, siglen, &sigtype)) != 0)
|
||||
return r;
|
||||
r = strcmp(expected_alg, sigtype) == 0;
|
||||
free(sigtype);
|
||||
@ -2861,7 +2861,7 @@ sshkey_certify_custom(struct sshkey *k, struct sshkey *ca, const char *alg,
|
||||
sshbuf_len(cert), alg, 0, signer_ctx)) != 0)
|
||||
goto out;
|
||||
/* Check and update signature_type against what was actually used */
|
||||
if ((ret = get_sigtype(sig_blob, sig_len, &sigtype)) != 0)
|
||||
if ((ret = sshkey_get_sigtype(sig_blob, sig_len, &sigtype)) != 0)
|
||||
goto out;
|
||||
if (alg != NULL && strcmp(alg, sigtype) != 0) {
|
||||
ret = SSH_ERR_SIGN_ALG_UNSUPPORTED;
|
||||
|
3
sshkey.h
3
sshkey.h
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sshkey.h,v 1.33 2019/07/15 13:16:29 djm Exp $ */
|
||||
/* $OpenBSD: sshkey.h,v 1.34 2019/09/03 08:31:20 djm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
||||
@ -214,6 +214,7 @@ int sshkey_verify(const struct sshkey *, const u_char *, size_t,
|
||||
const u_char *, size_t, const char *, u_int);
|
||||
int sshkey_check_sigtype(const u_char *, size_t, const char *);
|
||||
const char *sshkey_sigalg_by_name(const char *);
|
||||
int sshkey_get_sigtype(const u_char *, size_t, char **);
|
||||
|
||||
/* for debug */
|
||||
void sshkey_dump_ec_point(const EC_GROUP *, const EC_POINT *);
|
||||
|
Loading…
Reference in New Issue
Block a user