I am trying to use Crypto++ on iOS. I downloaded a prebuilt version of the library from Marek Kotewicz's GitHub.
I am struggling hard to run this sample code from the Crypto++ wiki.
ECDSA<ECP, CryptoPP::SHA256>::PrivateKey privateKey;
ECDSA<ECP, CryptoPP::SHA256>::PublicKey publicKey;
AutoSeededRandomPool prng, rrng;
privateKey.Initialize(prng, CryptoPP::ASN1::secp256k1());
privateKey.MakePublicKey(publicKey);
string signature;
string message = "Do or do not. There is no try.";
StringSource s(message, true,
new SignerFilter(rrng,
ECDSA<ECP, CryptoPP::SHA256>::Signer(privateKey),
new StringSink(signature)));
Its crashing with the following. Its showing up in Xcode output window:
BAD_ACCESS (code=EXC_I386_GPFLT)
This is the code snippet from memory.h of c++ file where it is pointing the BAD_ACCESS
_LIBCPP_INLINE_VISIBILITY ~auto_ptr() throw() {delete __ptr_;}
I am getting BAD_ACCESS(code=1 , address=0x0) error pointing to this line of code of library
-> 0x1065dfa8d <+85>: movq -0x58(%rbp), %rdi

__ptr_is notNULLbefore callingdeleteI feel~is freeing the memory allocated to this__ptr_- Vinay Shuklasignaturestring which isn't initialized that you are passing. Is signature an input parameter or output parameter - Vinay Shukla