mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Remove a few completely unused functions.
MD5_Simple and SHA512_Simple are superseded by the general hash_simple() in sshauxcrypt.c. The SHA-1 and SHA-256 analogues of those functions were already removed as a side effect of reorganising their source files for hardware acceleration, but the hashes I didn't rewrite managed to keep their 'Simple' APIs. mp_neg was never used in the first place. I wrote it as an obvious companion to mp_neg_into, but since I never put either of those in the header file, none of the rest of the code ever called them; and internally to mpint.c, only mp_neg_into is used out of the two. (Which makes sense, because mp_int is fundamentally an unsigned type, so mp_neg has weird semantics - it will give you not -x but 2^k-x for some not-entirely-specified k. mp_neg_into is actually more coherent, because _you_ get to control k by your choice of the target mp_int.)
This commit is contained in:
parent
f40d31b5cc
commit
1278f51f1d
7
mpint.c
7
mpint.c
@ -899,13 +899,6 @@ mp_int *mp_sub(mp_int *x, mp_int *y)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_int *mp_neg(mp_int *a)
|
|
||||||
{
|
|
||||||
mp_int *r = mp_make_sized(a->nw);
|
|
||||||
mp_neg_into(r, a);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal routine: multiply and accumulate in the trivial O(N^2)
|
* Internal routine: multiply and accumulate in the trivial O(N^2)
|
||||||
* way. Sets r <- r + a*b.
|
* way. Sets r <- r + a*b.
|
||||||
|
10
sshmd5.c
10
sshmd5.c
@ -213,16 +213,6 @@ void MD5Final(unsigned char output[16], struct MD5Context *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MD5Simple(void const *p, unsigned len, unsigned char output[16])
|
|
||||||
{
|
|
||||||
struct MD5Context s;
|
|
||||||
|
|
||||||
MD5Init(&s);
|
|
||||||
put_data(&s, (unsigned char const *)p, len);
|
|
||||||
MD5Final(output, &s);
|
|
||||||
smemclr(&s, sizeof(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
* Thin abstraction for things where hashes are pluggable.
|
* Thin abstraction for things where hashes are pluggable.
|
||||||
*/
|
*/
|
||||||
|
18
sshsh512.c
18
sshsh512.c
@ -277,24 +277,6 @@ void SHA384_Final(SHA512_State *s, unsigned char *digest) {
|
|||||||
memcpy(digest, biggerDigest, 384 / 8);
|
memcpy(digest, biggerDigest, 384 / 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHA512_Simple(const void *p, int len, unsigned char *output) {
|
|
||||||
SHA512_State s;
|
|
||||||
|
|
||||||
SHA512_Init(&s);
|
|
||||||
put_data(&s, p, len);
|
|
||||||
SHA512_Final(&s, output);
|
|
||||||
smemclr(&s, sizeof(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHA384_Simple(const void *p, int len, unsigned char *output) {
|
|
||||||
SHA512_State s;
|
|
||||||
|
|
||||||
SHA384_Init(&s);
|
|
||||||
put_data(&s, p, len);
|
|
||||||
SHA384_Final(&s, output);
|
|
||||||
smemclr(&s, sizeof(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Thin abstraction for things where hashes are pluggable.
|
* Thin abstraction for things where hashes are pluggable.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user