1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Remove obsolete functions.

There are several old functions that the previous commits have removed
all, or nearly all, of the references to. match_ssh_id is superseded
by ptrlen_eq_string; get_ssh_{string,uint32} is yet another replicated
set of decode functions (this time _partly_ centralised into misc.c);
the old APIs for the SSH-1 RSA decode functions are gone (together
with their last couple of holdout clients), as are
ssh{1,2}_{read,write}_bignum and ssh{1,2}_bignum_length.

Particularly odd was the use of ssh1_{read,write}_bignum in the SSH-2
Diffie-Hellman implementation. I'd completely forgotten I did that!
Now replaced with a raw bignum_from_bytes, which is simpler anyway.
This commit is contained in:
Simon Tatham
2018-05-29 20:36:21 +01:00
parent 4d8c033596
commit 6dc6392596
8 changed files with 12 additions and 180 deletions

33
misc.c
View File

@ -1181,12 +1181,6 @@ int smemeq(const void *av, const void *bv, size_t len)
return (0x100 - val) >> 8;
}
int match_ssh_id(int stringlen, const void *string, const char *id)
{
int idlen = strlen(id);
return (idlen == stringlen && !memcmp(string, id, idlen));
}
ptrlen make_ptrlen(const void *ptr, size_t len)
{
ptrlen pl;
@ -1209,33 +1203,6 @@ char *mkstr(ptrlen pl)
return p;
}
void *get_ssh_string(int *datalen, const void **data, int *stringlen)
{
void *ret;
unsigned int len;
if (*datalen < 4)
return NULL;
len = GET_32BIT_MSB_FIRST((const unsigned char *)*data);
if (*datalen - 4 < len)
return NULL;
ret = (void *)((const char *)*data + 4);
*datalen -= len + 4;
*data = (const char *)*data + len + 4;
*stringlen = len;
return ret;
}
int get_ssh_uint32(int *datalen, const void **data, unsigned *ret)
{
if (*datalen < 4)
return FALSE;
*ret = GET_32BIT_MSB_FIRST((const unsigned char *)*data);
*datalen -= 4;
*data = (const char *)*data + 4;
return TRUE;
}
int strstartswith(const char *s, const char *t)
{
return !memcmp(s, t, strlen(t));