Compare commits
No commits in common. "07c0aec7d8c535ed50c5c2572b3ba52b9b32d85a" and "dcc126300c9e09786357c443e097ee56e579559a" have entirely different histories.
07c0aec7d8
...
dcc126300c
1 changed files with 14 additions and 30 deletions
|
@ -27,7 +27,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/pem.h>
|
||||
|
@ -36,8 +35,6 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
RSA *rsa = NULL;
|
||||
|
||||
void nodumps()
|
||||
{
|
||||
struct rlimit r;
|
||||
|
@ -45,37 +42,31 @@ void nodumps()
|
|||
setrlimit(RLIMIT_CORE, &r);
|
||||
}
|
||||
|
||||
void byebye(int sig)
|
||||
{
|
||||
memset(rsa, 0, sizeof rsa);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static int called_passcb = 0;
|
||||
static int pass_cb(char *buf, int size, int rwflag, void *u)
|
||||
{
|
||||
int len;
|
||||
char *tmp;
|
||||
char *tmp;
|
||||
|
||||
called_passcb++;
|
||||
|
||||
if(!isatty(fileno(stdin)))
|
||||
if(!isatty(fileno(stdin)))
|
||||
{
|
||||
if(fgets(buf, size, stdin) == NULL)
|
||||
return 0;
|
||||
if(fgets(buf, size, stdin) == NULL)
|
||||
return 0;
|
||||
tmp = strpbrk(buf, "\r\n");
|
||||
if(tmp != NULL)
|
||||
*tmp = '\0';
|
||||
return strlen(buf);
|
||||
}
|
||||
}
|
||||
tmp = getpass("Enter passphrase for private key: ");
|
||||
len = strlen(tmp);
|
||||
if (len <= 0)
|
||||
len = strlen(tmp);
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
if (len > size)
|
||||
len = size;
|
||||
memcpy(buf, tmp, len);
|
||||
return len;
|
||||
if (len > size)
|
||||
len = size;
|
||||
memcpy(buf, tmp, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
@ -219,7 +210,7 @@ read_challenge(FILE *f)
|
|||
}
|
||||
}
|
||||
|
||||
fgets((char *)buf, sizeof(buf), stdin);
|
||||
fgets((char *)buf, sizeof(buf), stdin);
|
||||
|
||||
tmp = strpbrk((char *)buf, "\r\n");
|
||||
if(tmp != NULL)
|
||||
|
@ -233,17 +224,10 @@ read_challenge(FILE *f)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct sigaction act;
|
||||
|
||||
act.sa_handler = byebye;
|
||||
|
||||
sigaction(SIGHUP, &act, 0);
|
||||
sigaction(SIGINT, &act, 0);
|
||||
sigaction(SIGTERM, &act, 0);
|
||||
|
||||
nodumps();
|
||||
|
||||
FILE *kfile;
|
||||
RSA *rsa = NULL;
|
||||
SHA_CTX ctx;
|
||||
unsigned char *ptr;
|
||||
unsigned char *ndata, ddata[512];
|
||||
|
@ -299,5 +283,5 @@ main(int argc, char **argv)
|
|||
puts((char *)ndata);
|
||||
fflush(NULL);
|
||||
}
|
||||
byebye(0);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue