using applink.c

2008-10-14 Thread Michael Luich
So I've spent all week trying to find the answer to no success.
I've downloaded and installed the precompiled openssl binaries for windows.
My app includes the line:

#include openssl/applink.c

and compiles correctly. The app runs until openssl code is accessed. Then I
get:

OPENSSL_Uplink(058A1010,05): no OPENSSL_Applink

I've seen comments in the faq about adding: CRYPTO_malloc_init(); but it
generates compilation errors.

1c:\users\mluich\documents\visual studio
2008\projects\sr_trillian_plugin\sr_trillian_plugin\sr_trillian_plugin.cpp(21)
: error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1c:\users\mluich\documents\visual studio
2008\projects\sr_trillian_plugin\sr_trillian_plugin\sr_trillian_plugin.cpp(21)
: error C2365: 'CRYPTO_set_mem_functions' : redefinition; previous
definition was 'function'
1c:\program files\microsoft visual studio
9.0\vc\include\openssl\crypto.h(442) : see declaration of
'CRYPTO_set_mem_functions'
1c:\users\mluich\documents\visual studio
2008\projects\sr_trillian_plugin\sr_trillian_plugin\sr_trillian_plugin.cpp(21)
: error C2078: too many initializers
1c:\users\mluich\documents\visual studio
2008\projects\sr_trillian_plugin\sr_trillian_plugin\sr_trillian_plugin.cpp(21)
: error C2440: 'initializing' : cannot convert from 'void (__cdecl *)(void
*)' to 'int'

I'm certain I'm just missing something simple, being a linux guy this is
just not making sense.

Mike Luich


Re: Microsoft Visual C++

2008-10-14 Thread Michael Luich
A

phew at least it's not me. bloomin M$..

Thanks

Mike Luich

On Tue, Oct 14, 2008 at 10:33 AM, So Gerald [EMAIL PROTECTED] wrote:

 As I know,Microsoft Visual C++ Express do not support multithread programs
 correctly and OpenSSL needs to work at multithread mode. So you should use
 the other version of compiler instead.

 2008/10/11 Michael Luich [EMAIL PROTECTED]

  On Fri, Oct 10, 2008 at 9:25 PM, Thomas J. Hruska
 [EMAIL PROTECTED] wrote:
   Michael Luich wrote:
 
  Hello,
 I'm trying to compile in Microsoft Visual C++ Express and I'm
 getting
  linker errors like:
 
  error LNK2019: unresolved external symbol _BIO_gets referenced in
 function
  char * __cdecl sr_encrypt(char *,struct _iobuf *) (?sr_encrypt@
  @YAPADPADPAU_iobuf@@@Z)
 
  I got the header files all setup, but I can't get the libs working. I
  followed the help and copied the lib files to C:\Program
 Files\Microsoft
  Visual Studio 9.0\VC\lib .
 
  Anybody know what i'm missing?
 
  Mike Luich
 
  You have to add the .lib files to your project's Linker properties.
 
  --
  Thomas Hruska
  Shining Light Productions
 
  Home of BMP2AVI, Nuclear Vision, ProtoNova, and Win32 OpenSSL.
  http://www.slproweb.com/
 
 
  __
  OpenSSL Project http://www.openssl.org
  User Support Mailing Listopenssl-users@openssl.org
  Automated List Manager   [EMAIL PROTECTED]
 


 I've tried to do that but It doesn't seem to be working. Any idea on
 how I do that?

 Mike Luich
 --
 you can't put your finger there - OOH! PUT YOUR FINGER THERE!  -
 Princeton, Avenue Q
 (http://www.avenueq.com/)
  __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   [EMAIL PROTECTED]





Re: Microsoft Visual C++

2008-10-13 Thread Michael Luich
On Fri, Oct 10, 2008 at 9:25 PM, Thomas J. Hruska
[EMAIL PROTECTED] wrote:
 Michael Luich wrote:

 Hello,
I'm trying to compile in Microsoft Visual C++ Express and I'm getting
 linker errors like:

 error LNK2019: unresolved external symbol _BIO_gets referenced in function
 char * __cdecl sr_encrypt(char *,struct _iobuf *) (?sr_encrypt@
 @YAPADPADPAU_iobuf@@@Z)

 I got the header files all setup, but I can't get the libs working. I
 followed the help and copied the lib files to C:\Program Files\Microsoft
 Visual Studio 9.0\VC\lib .

 Anybody know what i'm missing?

 Mike Luich

 You have to add the .lib files to your project's Linker properties.

 --
 Thomas Hruska
 Shining Light Productions

 Home of BMP2AVI, Nuclear Vision, ProtoNova, and Win32 OpenSSL.
 http://www.slproweb.com/


 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   [EMAIL PROTECTED]



I've tried to do that but It doesn't seem to be working. Any idea on
how I do that?

Mike Luich
-- 
you can't put your finger there - OOH! PUT YOUR FINGER THERE!  -
Princeton, Avenue Q
(http://www.avenueq.com/)
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Microsoft Visual C++

2008-10-11 Thread Michael Luich
OK So I figured it out. After following the help files instructions on where
to copy the files, under the project properties - configuration properties
- linker - input - additional dependencies  add libeay32MD.lib
ssleay32MD.lib Note the MD matches the build type under properties -
configuration properties - C/C++ - code generation

Mike Luich

On Fri, Oct 10, 2008 at 9:25 PM, Thomas J. Hruska 
[EMAIL PROTECTED] wrote:

 Michael Luich wrote:

 Hello,
I'm trying to compile in Microsoft Visual C++ Express and I'm getting
 linker errors like:

 error LNK2019: unresolved external symbol _BIO_gets referenced in function
 char * __cdecl sr_encrypt(char *,struct _iobuf *) (?sr_encrypt@
 @YAPADPADPAU_iobuf@@@Z)

 I got the header files all setup, but I can't get the libs working. I
 followed the help and copied the lib files to C:\Program Files\Microsoft
 Visual Studio 9.0\VC\lib .

 Anybody know what i'm missing?

 Mike Luich


 You have to add the .lib files to your project's Linker properties.

 --
 Thomas Hruska
 Shining Light Productions

 Home of BMP2AVI, Nuclear Vision, ProtoNova, and Win32 OpenSSL.
 http://www.slproweb.com/


 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   [EMAIL PROTECTED]



Microsoft Visual C++

2008-10-10 Thread Michael Luich
Hello,
I'm trying to compile in Microsoft Visual C++ Express and I'm getting
linker errors like:

error LNK2019: unresolved external symbol _BIO_gets referenced in function
char * __cdecl sr_encrypt(char *,struct _iobuf *) (?sr_encrypt@
@YAPADPADPAU_iobuf@@@Z)

I got the header files all setup, but I can't get the libs working. I
followed the help and copied the lib files to C:\Program Files\Microsoft
Visual Studio 9.0\VC\lib .

Anybody know what i'm missing?

Mike Luich

1-- Build started: Project: sr_trillian_plugin, Configuration: Debug
Win32 --
1Compiling...
1stdafx.cpp
1Compiling...
1sr_trillian_plugin.cpp
1c:\users\mluich\documents\visual studio
2008\projects\sr_trillian_plugin\sr_trillian_plugin\sr_trillian_plugin.cpp(194)
: warning C4129: '%' : unrecognized character escape sequence
1c:\users\mluich\documents\visual studio
2008\projects\sr_trillian_plugin\sr_trillian_plugin\sr_trillian_plugin.cpp(247)
: warning C4129: '%' : unrecognized character escape sequence
1Compiling...
1dllmain.cpp
1Linking...
1   Creating library C:\Users\mluich\Documents\Visual Studio
2008\Projects\sr_trillian_plugin\Debug\sr_trillian_plugin.lib and object
C:\Users\mluich\Documents\Visual Studio
2008\Projects\sr_trillian_plugin\Debug\sr_trillian_plugin.exp
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_BIO_gets referenced in function char * __cdecl sr_encrypt(char *,struct
_iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_BIO_ctrl referenced in function char * __cdecl sr_encrypt(char *,struct
_iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_BIO_ctrl_pending referenced in function char * __cdecl sr_encrypt(char
*,struct _iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_SMIME_write_PKCS7 referenced in function char * __cdecl sr_encrypt(char
*,struct _iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_PKCS7_encrypt referenced in function char * __cdecl sr_encrypt(char
*,struct _iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_sk_push referenced in function char * __cdecl sr_encrypt(char *,struct
_iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_PEM_read_X509 referenced in function char * __cdecl sr_encrypt(char
*,struct _iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_BIO_new referenced in function char * __cdecl sr_encrypt(char *,struct
_iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_BIO_s_mem referenced in function char * __cdecl sr_encrypt(char *,struct
_iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_BIO_new_mem_buf referenced in function char * __cdecl sr_encrypt(char
*,struct _iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_RAND_load_file referenced in function char * __cdecl sr_encrypt(char
*,struct _iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_ERR_load_crypto_strings referenced in function char * __cdecl
sr_encrypt(char *,struct _iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_OPENSSL_add_all_algorithms_noconf referenced in function char * __cdecl
sr_encrypt(char *,struct _iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_sk_new_null referenced in function char * __cdecl sr_encrypt(char *,struct
_iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_EVP_des_ede3_cbc referenced in function char * __cdecl sr_encrypt(char
*,struct _iobuf *) (?sr_encrypt@@YAPADPADPAU_iobuf@@@Z)
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_ERR_error_string referenced in function char * __cdecl sr_decrypt(char
*,char *) (?sr_decrypt@@[EMAIL PROTECTED])
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_ERR_get_error referenced in function char * __cdecl sr_decrypt(char *,char
*) (?sr_decrypt@@[EMAIL PROTECTED])
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_PKCS7_decrypt referenced in function char * __cdecl sr_decrypt(char *,char
*) (?sr_decrypt@@[EMAIL PROTECTED])
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_ERR_print_errors_fp referenced in function char * __cdecl sr_decrypt(char
*,char *) (?sr_decrypt@@[EMAIL PROTECTED])
1sr_trillian_plugin.obj : error LNK2019: unresolved external symbol
_SMIME_read_PKCS7 

Null termination after encryption.

2008-08-29 Thread Michael Luich
Hello everyone, here's what's driving me nuts. I'm sure i'm missing
something simple, but why isn't the encrypted message coming out of  
BIO_get_mem_data(out, enc_msg);  Null terminated ?

Full code below.

Mike Luich


fprintf (stderr, ENTER: %s in %s, line %d.\n,
 __FUNCTION__, __FILE__, __LINE__);


  constEVP_CIPHER *cipher= EVP_des_ede3_cbc();
  STACK_OF(X509) *certs= sk_X509_new_null();
  X509 *tmp;
  BIO *in, *out, *b64_bio;
  PKCS7 *pkcs7;
  char *enc_msg, *ptr;

  OpenSSL_add_all_algorithms();
  ERR_load_crypto_strings();
  RAND_load_file(/dev/urandom, 1024);

  fprintf (stderr, START: %s in %s, line %d.\n,
   __FUNCTION__, __FILE__, __LINE__);

  in = BIO_new_mem_buf(clear_msg, -1);
  out = BIO_new(BIO_s_mem());

  if (!(tmp = PEM_read_X509(pub_cert, NULL, NULL, NULL))) {
  fprintf (stderr, Error Opening Public Key);
  }
  sk_X509_push(certs,tmp);
  fclose (pub_cert);

  if (!(pkcs7 = PKCS7_encrypt(certs, in, cipher, PKCS7_BINARY))) {
  fprintf (stderr,Error making PKC#7object : %s in %s, line %d.\n,
__FUNCTION__, __FILE__, __LINE__);
  }

  if (SMIME_write_PKCS7(out, pkcs7, in, 0) !=1)
  {
  fprintf (stderr,Error writing SMIME : %s in %s, line %d.\n,
__FUNCTION__, __FILE__, __LINE__);
  }

  fprintf (stderr,Encryption success : %s in %s, line %d.\n,
__FUNCTION__, __FILE__, __LINE__);

  BIO_get_mem_data(out, enc_msg);

  fprintf (stderr,Data out of bio: %s in %s, line %d.\n %s\n,
   __FUNCTION__, __FILE__, __LINE__, enc_msg);


Re: Null termination after encryption.

2008-08-29 Thread Michael Luich
Hmm then perhaps I'm expecting the wong thing to be coming out. I'm using
PKCS7_encrypt followed by SMIME_write_PKCS7. So the data is base64 encoded
and in S/MIME Format.

I just want to get this in a format that I can return as a string that's
null terminated. So the app can use it as a string.

Mike Luich

On Fri, Aug 29, 2008 at 12:54 PM, David Schwartz [EMAIL PROTECTED]wrote:


  Hello everyone, here's what's driving me nuts.
  I'm sure i'm missing something simple, but why isn't the
  encrypted message coming out of
   BIO_get_mem_data(out, enc_msg);  Null terminated ?

  Mike Luich

 Why should it be? It's not a string, it's a block of arbitrary data.

 Besides, what would be the point in nul-terminating a block of data that
 may
 already contains any number of zero bytes in it?

 DS


 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   [EMAIL PROTECTED]



Re: Null termination after encryption.

2008-08-29 Thread Michael Luich
Ok that makes sense. kinda goes with what I had been thinking, So i just add
the null character at the end of the bio before I use BIO_get_mem_data(out,
enc_msg);

now just how to do that .
ssl bio write
mike Luich
On Fri, Aug 29, 2008 at 1:35 PM, David Schwartz [EMAIL PROTECTED]wrote:



  Hmm then perhaps I'm expecting the wong thing to be coming
  out. I'm using PKCS7_encrypt followed by SMIME_write_PKCS7.
  So the data is base64 encoded and in S/MIME Format.

  I just want to get this in a format that I can return as a
  string that's null terminated. So the app can use it as a string.

  Mike Luich

 You're right, wrong explanation. The function wrote the string to the BIO,
 but not the terminator (just as you wouldn't write the terminator to a
 file). You then got a pointer to the data in the BIO.

 The same thing would occur if you memory-mapped a file containing the
 string. It wouldn't be terminated.

 If you need to the data in the form of a C-style string, you need to make
 it
 one. You could simply write a zero to the BIO, I suppose.

 DS


 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   [EMAIL PROTECTED]