num_openssl.h bugfixes

This commit is contained in:
Pieter Wuille 2013-03-13 00:28:37 +01:00
parent e3f741f1d4
commit d1fdf30dcc
2 changed files with 4 additions and 4 deletions

4
num.h
View file

@ -1,7 +1,7 @@
#ifndef _SECP256K1_NUM_
#define _SECP256K1_NUM_
#include "num_gmp.h"
// #include "num_openssl.h"
// #include "num_gmp.h"
#include "num_openssl.h"
#endif

View file

@ -71,7 +71,7 @@ public:
int size = BN_num_bytes(bn);
assert(size <= len);
memset(bin,0,len);
BN_bn2bin(bn, bin + size - len);
BN_bn2bin(bn, bin + len - size);
}
void SetInt(int x) {
if (x >= 0) {
@ -149,7 +149,7 @@ public:
BN_rshift(high.bn, bn, bits);
}
std::string ToString() {
std::string ToString() const {
char *str = BN_bn2hex(bn);
std::string ret(str);
OPENSSL_free(str);