projects
/
bcm963xx.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
www.usr.com/support/gpl/USR9107_release.1.4.tar.gz
[bcm963xx.git]
/
userapps
/
opensource
/
sshd
/
genrsa.c
diff --git
a/userapps/opensource/sshd/genrsa.c
b/userapps/opensource/sshd/genrsa.c
index
3c385e5
..
73a7984
100755
(executable)
--- a/
userapps/opensource/sshd/genrsa.c
+++ b/
userapps/opensource/sshd/genrsa.c
@@
-23,7
+23,7
@@
* SOFTWARE. */
#include "includes.h"
* SOFTWARE. */
#include "includes.h"
-#include "util.h"
+#include "
db
util.h"
#include "bignum.h"
#include "random.h"
#include "rsa.h"
#include "bignum.h"
#include "random.h"
#include "rsa.h"
@@
-40,7
+40,9
@@
static void getrsaprime(mp_int* prime, mp_int *primeminus,
rsa_key * gen_rsa_priv_key(unsigned int size) {
rsa_key * key;
rsa_key * gen_rsa_priv_key(unsigned int size) {
rsa_key * key;
- mp_int pminus, qminus, lcm;
+ DEF_MP_INT(pminus);
+ DEF_MP_INT(qminus);
+ DEF_MP_INT(lcm);
key = (rsa_key*)m_malloc(sizeof(rsa_key));
key = (rsa_key*)m_malloc(sizeof(rsa_key));
@@
-95,7
+97,7
@@
static void getrsaprime(mp_int* prime, mp_int *primeminus,
mp_int* rsa_e, unsigned int size) {
unsigned char *buf;
mp_int* rsa_e, unsigned int size) {
unsigned char *buf;
-
mp_int temp_gcd
;
+
DEF_MP_INT(temp_gcd)
;
buf = (unsigned char*)m_malloc(size+1);
buf = (unsigned char*)m_malloc(size+1);
@@
-106,13
+108,10
@@
static void getrsaprime(mp_int* prime, mp_int *primeminus,
genrandom(buf, size+1);
buf[0] |= 0x80; /* MSB set */
genrandom(buf, size+1);
buf[0] |= 0x80; /* MSB set */
- if (mp_read_unsigned_bin(prime, buf, size+1) != MP_OKAY) {
- fprintf(stderr, "rsa generation failed\n");
- exit(1);
- }
+ bytes_to_mp(prime, buf, size+1);
/* find the next integer which is prime, 8 round of miller-rabin */
/* find the next integer which is prime, 8 round of miller-rabin */
- if (mp_prime_next_prime(prime, 8) != MP_OKAY) {
+ if (mp_prime_next_prime(prime, 8
, 0
) != MP_OKAY) {
fprintf(stderr, "rsa generation failed\n");
exit(1);
}
fprintf(stderr, "rsa generation failed\n");
exit(1);
}