summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/key.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-02-26 10:38:49 +0000
committerdes <des@FreeBSD.org>2004-02-26 10:38:49 +0000
commit7d1750f1d6c24163bf22790f8527f1783315c5e7 (patch)
tree44704f8b727acba451fd902fe3c26053cb6ce73e /crypto/openssh/key.c
parent5c8d98dfbd6964b6be84da30b9d16df0cab3c42d (diff)
downloadFreeBSD-src-7d1750f1d6c24163bf22790f8527f1783315c5e7.zip
FreeBSD-src-7d1750f1d6c24163bf22790f8527f1783315c5e7.tar.gz
Vendor import of OpenSSH 3.8p1.
Diffstat (limited to 'crypto/openssh/key.c')
-rw-r--r--crypto/openssh/key.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/crypto/openssh/key.c b/crypto/openssh/key.c
index 54318cb..323e6ff 100644
--- a/crypto/openssh/key.c
+++ b/crypto/openssh/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.54 2003/07/09 13:58:19 avsm Exp $");
+RCSID("$OpenBSD: key.c,v 1.55 2003/11/10 16:23:41 jakob Exp $");
#include <openssl/evp.h>
@@ -143,8 +143,9 @@ key_free(Key *k)
}
xfree(k);
}
+
int
-key_equal(Key *a, Key *b)
+key_equal(const Key *a, const Key *b)
{
if (a == NULL || b == NULL || a->type != b->type)
return 0;
@@ -170,7 +171,8 @@ key_equal(Key *a, Key *b)
}
u_char*
-key_fingerprint_raw(Key *k, enum fp_type dgst_type, u_int *dgst_raw_length)
+key_fingerprint_raw(const Key *k, enum fp_type dgst_type,
+ u_int *dgst_raw_length)
{
const EVP_MD *md = NULL;
EVP_MD_CTX ctx;
@@ -292,7 +294,7 @@ key_fingerprint_bubblebabble(u_char *dgst_raw, u_int dgst_raw_len)
}
char *
-key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep)
+key_fingerprint(const Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep)
{
char *retval = NULL;
u_char *dgst_raw;
@@ -490,7 +492,7 @@ key_read(Key *ret, char **cpp)
}
int
-key_write(Key *key, FILE *f)
+key_write(const Key *key, FILE *f)
{
int n, success = 0;
u_int len, bits = 0;
@@ -522,8 +524,8 @@ key_write(Key *key, FILE *f)
return success;
}
-char *
-key_type(Key *k)
+const char *
+key_type(const Key *k)
{
switch (k->type) {
case KEY_RSA1:
@@ -539,8 +541,8 @@ key_type(Key *k)
return "unknown";
}
-char *
-key_ssh_name(Key *k)
+const char *
+key_ssh_name(const Key *k)
{
switch (k->type) {
case KEY_RSA:
@@ -554,7 +556,7 @@ key_ssh_name(Key *k)
}
u_int
-key_size(Key *k)
+key_size(const Key *k)
{
switch (k->type) {
case KEY_RSA1:
@@ -611,7 +613,7 @@ key_generate(int type, u_int bits)
}
Key *
-key_from_private(Key *k)
+key_from_private(const Key *k)
{
Key *n = NULL;
switch (k->type) {
@@ -676,7 +678,7 @@ key_names_valid2(const char *names)
}
Key *
-key_from_blob(u_char *blob, u_int blen)
+key_from_blob(const u_char *blob, u_int blen)
{
Buffer b;
char *ktype;
@@ -726,7 +728,7 @@ key_from_blob(u_char *blob, u_int blen)
}
int
-key_to_blob(Key *key, u_char **blobp, u_int *lenp)
+key_to_blob(const Key *key, u_char **blobp, u_int *lenp)
{
Buffer b;
int len;
@@ -768,9 +770,9 @@ key_to_blob(Key *key, u_char **blobp, u_int *lenp)
int
key_sign(
- Key *key,
+ const Key *key,
u_char **sigp, u_int *lenp,
- u_char *data, u_int datalen)
+ const u_char *data, u_int datalen)
{
switch (key->type) {
case KEY_DSA:
@@ -792,9 +794,9 @@ key_sign(
*/
int
key_verify(
- Key *key,
- u_char *signature, u_int signaturelen,
- u_char *data, u_int datalen)
+ const Key *key,
+ const u_char *signature, u_int signaturelen,
+ const u_char *data, u_int datalen)
{
if (signaturelen == 0)
return -1;
@@ -815,7 +817,7 @@ key_verify(
/* Converts a private to a public key */
Key *
-key_demote(Key *k)
+key_demote(const Key *k)
{
Key *pk;
OpenPOWER on IntegriCloud