*/
static unsigned char sftp_pkt_getbyte(struct sftp_packet *pkt) {
*/
static unsigned char sftp_pkt_getbyte(struct sftp_packet *pkt) {
if (pkt->length - pkt->savedpos < 1)
return 0; /* arrgh, no way to decline (FIXME?) */
value = (unsigned char) pkt->data[pkt->savedpos];
if (pkt->length - pkt->savedpos < 1)
return 0; /* arrgh, no way to decline (FIXME?) */
value = (unsigned char) pkt->data[pkt->savedpos];
struct sftp_packet *sftp_recv(void) {
struct sftp_packet *pkt;
char x[4];
struct sftp_packet *sftp_recv(void) {
struct sftp_packet *pkt;
char x[4];
if (!sftp_recvdata(x, 4))
return NULL;
if (!sftp_recvdata(x, 4))
return NULL;
return NULL;
}
if (pktin->type == SSH_FXP_HANDLE) {
return NULL;
}
if (pktin->type == SSH_FXP_HANDLE) {
char *hstring;
struct fxp_handle *handle;
int len;
char *hstring;
struct fxp_handle *handle;
int len;
return NULL;
}
if (pktin->type == SSH_FXP_HANDLE) {
return NULL;
}
if (pktin->type == SSH_FXP_HANDLE) {
char *hstring;
struct fxp_handle *handle;
int len;
char *hstring;
struct fxp_handle *handle;
int len;
id = sftp_pkt_getuint32(pktin);
if (id != 0xDCB) {
fxp_internal_error("request ID mismatch\n");
id = sftp_pkt_getuint32(pktin);
if (id != 0xDCB) {
fxp_internal_error("request ID mismatch\n");
}
fxp_got_status(pktin);
return fxp_errtype == SSH_FX_OK;
}
fxp_got_status(pktin);
return fxp_errtype == SSH_FX_OK;
{
char realhash[41];
unsigned char binary[20];
{
char realhash[41];
unsigned char binary[20];
SHA_Simple(private_blob, private_blob_len, binary);
for (i = 0; i < 20; i++)
SHA_Simple(private_blob, private_blob_len, binary);
for (i = 0; i < 20; i++)
FILE *fp;
char header[40], *b;
const struct ssh_signkey *alg;
FILE *fp;
char header[40], *b;
const struct ssh_signkey *alg;
unsigned char *public_blob;
int public_blob_len;
int i;
unsigned char *public_blob;
int public_blob_len;
int i;
static void *rsa2_openssh_createkey(unsigned char **blob, int *len) {
char **b = (char **)blob;
struct RSAKey *rsa;
static void *rsa2_openssh_createkey(unsigned char **blob, int *len) {
char **b = (char **)blob;
struct RSAKey *rsa;
rsa = smalloc(sizeof(struct RSAKey));
if (!rsa) return NULL;
rsa = smalloc(sizeof(struct RSAKey));
if (!rsa) return NULL;
0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14,
};
0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14,
};
+#define ASN1_LEN ( (int) sizeof(asn1_weird_stuff) )
+
static int rsa2_verifysig(void *key, char *sig, int siglen,
char *data, int datalen) {
struct RSAKey *rsa = (struct RSAKey *)key;
static int rsa2_verifysig(void *key, char *sig, int siglen,
char *data, int datalen) {
struct RSAKey *rsa = (struct RSAKey *)key;
if (bignum_byte(out, bytes-2) != 1)
ret = 0;
/* Most of the rest should be FF. */
if (bignum_byte(out, bytes-2) != 1)
ret = 0;
/* Most of the rest should be FF. */
- for (i = bytes-3; i >= 20 + sizeof(asn1_weird_stuff); i--) {
+ for (i = bytes-3; i >= 20 + ASN1_LEN; i--) {
if (bignum_byte(out, i) != 0xFF)
ret = 0;
}
/* Then we expect to see the asn1_weird_stuff. */
if (bignum_byte(out, i) != 0xFF)
ret = 0;
}
/* Then we expect to see the asn1_weird_stuff. */
- for (i = 20 + sizeof(asn1_weird_stuff) - 1, j=0; i >= 20; i--,j++) {
+ for (i = 20 + ASN1_LEN - 1, j=0; i >= 20; i--,j++) {
if (bignum_byte(out, i) != asn1_weird_stuff[j])
ret = 0;
}
if (bignum_byte(out, i) != asn1_weird_stuff[j])
ret = 0;
}
bytes = smalloc(nbytes);
bytes[0] = 1;
bytes = smalloc(nbytes);
bytes[0] = 1;
- for (i = 1; i < nbytes-20-sizeof(asn1_weird_stuff); i++)
+ for (i = 1; i < nbytes-20-ASN1_LEN; i++)
- for (i = nbytes-20-sizeof(asn1_weird_stuff), j=0; i < nbytes-20; i++,j++)
+ for (i = nbytes-20-ASN1_LEN, j=0; i < nbytes-20; i++,j++)
bytes[i] = asn1_weird_stuff[j];
for (i = nbytes-20, j=0; i < nbytes; i++,j++)
bytes[i] = hash[j];
bytes[i] = asn1_weird_stuff[j];
for (i = nbytes-20, j=0; i < nbytes; i++,j++)
bytes[i] = hash[j];