Giter Club home page Giter Club logo

Comments (5)

shanet avatar shanet commented on August 22, 2024

Thanks for the report. I don't have that issue with GCC 6.1.1. Could you post the output of openssl version here please?

You can generate a quick diff of what you've changed by running git diff as well. Posting the output of that here will allow me to merge your fixes in without having to go through a whole pull request process (unless you want to do that, of course!).

from crypto-example.

cswea3 avatar cswea3 commented on August 22, 2024

In basecode64.cpp in your base64Decode function parameters I changed it from const char *b64message to just char *b64message.

In my version of openssl bio.h and according to their wiki at https://wiki.openssl.org/index.php/Manual:BIO_s_mem%283%29

BIO_new_mem_buf takes a void* as it's first argument not const void*

openssl version

OpenSSL 1.0.1e-fips 11 Feb 2013

git diff
diff --git a/base64.cpp b/base64.cpp
index 011726e..b884374 100644
--- a/base64.cpp
+++ b/base64.cpp
@@ -27,7 +27,7 @@ char* base64Encode(const unsigned char *message, const size_t length) {
   return b64text;
 }

-int base64Decode(const char *b64message, const size_t length, unsigned char **buffer) {
+int base64Decode(char *b64message, const size_t length, unsigned char **buffer) {
   int decodedLength = calcDecodeLength(b64message, length);
   *buffer = (unsigned char*)malloc(decodedLength + 1);

from crypto-example.

cswea3 avatar cswea3 commented on August 22, 2024

It seems to be a problem with BIO_new_mem_buf as it should take a const void*
Reference https://mta.openssl.org/pipermail/openssl-dev/2015-November/003299.html

from crypto-example.

shanet avatar shanet commented on August 22, 2024

Yup, thanks for digging that up. And the current head uses a const pointer (https://github.com/openssl/openssl/blob/5e93e5fc377ebc8bc30ffac1fa20a04cb25459eb/crypto/bio/bss_mem.c#L73) so I think I'm going to leave this as-is. If possible, you should upgrade your version of OpenSSL. 1.0.1e is quite old at this point and, most notably, is vulnerable to the Heartbleed bug.

from crypto-example.

shanet avatar shanet commented on August 22, 2024

I'll add a note to the README though recommending an up-to-date version of OpenSSL to avoid problems like this that others may have run into.

from crypto-example.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.