int slen;
struct dss_key *dss;
- dss = smalloc(sizeof(struct dss_key));
+ dss = snew(struct dss_key);
if (!dss)
return NULL;
getstring(&data, &len, &p, &slen);
len += 4 * (bignum_bitcount(dss->q) + 15) / 16;
len += 4 * (bignum_bitcount(dss->g) + 15) / 16;
len += 4 * (bignum_bitcount(dss->y) + 15) / 16;
- p = smalloc(len);
+ p = snewn(len, char);
if (!p)
return NULL;
for (i = 0; i < 16; i++)
sprintf(buffer + strlen(buffer), "%s%02x", i ? ":" : "",
digest[i]);
- ret = smalloc(strlen(buffer) + 1);
+ ret = snewn(strlen(buffer) + 1, char);
if (ret)
strcpy(ret, buffer);
return ret;
* 27 + sum of lengths. (five length fields, 20+7=27).
*/
bloblen = 27 + plen + qlen + glen + ylen;
- blob = smalloc(bloblen);
+ blob = snewn(bloblen, unsigned char);
p = blob;
PUT_32BIT(p, 7);
p += 4;
* mpint x, string[20] the SHA of p||q||g. Total 4 + xlen.
*/
bloblen = 4 + xlen;
- blob = smalloc(bloblen);
+ blob = snewn(bloblen, unsigned char);
p = blob;
PUT_32BIT(p, xlen);
p += 4;
char **b = (char **) blob;
struct dss_key *dss;
- dss = smalloc(sizeof(struct dss_key));
+ dss = snew(struct dss_key);
if (!dss)
return NULL;
return bloblen;
}
-unsigned char *dss_sign(void *key, char *data, int datalen, int *siglen)
+static unsigned char *dss_sign(void *key, char *data, int datalen, int *siglen)
{
/*
* The basic DSS signing algorithm is:
* i.e. 4+7 + 4+40 bytes.
*/
nbytes = 4 + 7 + 4 + 40;
- bytes = smalloc(nbytes);
+ bytes = snewn(nbytes, unsigned char);
PUT_32BIT(bytes, 7);
memcpy(bytes + 4, "ssh-dss", 7);
PUT_32BIT(bytes + 4 + 7, 40);