version 1.6, 2019/01/21 09:52:25 |
version 1.7, 2019/01/21 09:54:11 |
|
|
#include "sshbuf.h" |
#include "sshbuf.h" |
|
|
int |
int |
sshbuf_get_bignum2(struct sshbuf *buf, BIGNUM *v) |
sshbuf_get_bignum2(struct sshbuf *buf, BIGNUM **valp) |
{ |
{ |
|
BIGNUM *v; |
const u_char *d; |
const u_char *d; |
size_t len; |
size_t len; |
int r; |
int r; |
|
|
|
if (valp != NULL) |
|
*valp = NULL; |
if ((r = sshbuf_get_bignum2_bytes_direct(buf, &d, &len)) != 0) |
if ((r = sshbuf_get_bignum2_bytes_direct(buf, &d, &len)) != 0) |
return r; |
return r; |
if (v != NULL && BN_bin2bn(d, len, v) == NULL) |
if (valp != NULL) { |
return SSH_ERR_ALLOC_FAIL; |
if ((v = BN_new()) == NULL || |
|
BN_bin2bn(d, len, v) == NULL) { |
|
BN_clear_free(v); |
|
return SSH_ERR_ALLOC_FAIL; |
|
} |
|
*valp = v; |
|
} |
return 0; |
return 0; |
} |
} |
|
|