From: "Shalendra Chhabra" <shalu_itbhu@rediffmail.com>
To: gcc-help@gcc.gnu.org
Subject: Help Required
Date: Sat, 11 May 2002 08:13:00 -0000 [thread overview]
Message-ID: <20020511151351.23647.qmail@webmail5.rediffmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2101 bytes --]
I am sorry I am not able to debug these errors as I am facing
these for the first time and also I have a little experience with
Programing, When I compile a code from
demo files of Openssl,
cli.cpp
I get the following errors
/tmp/ccgN1DUz.o: In function `main':
/tmp/ccgN1DUz.o(.text+0xa): undefined reference to
`SSL_library_init'
/tmp/ccgN1DUz.o(.text+0xf): undefined reference to
`SSLv2_client_method'
/tmp/ccgN1DUz.o(.text+0x1c): undefined reference to
`SSL_load_error_strings'
/tmp/ccgN1DUz.o(.text+0x2b): undefined reference to
`SSL_CTX_new'
/tmp/ccgN1DUz.o(.text+0x60): undefined reference to
`ERR_print_errors_fp'
/tmp/ccgN1DUz.o(.text+0x139): undefined reference to `SSL_new'
/tmp/ccgN1DUz.o(.text+0x164): undefined reference to
`SSL_set_fd'
/tmp/ccgN1DUz.o(.text+0x173): undefined reference to
`SSL_connect'
/tmp/ccgN1DUz.o(.text+0x18f): undefined reference to
`ERR_print_errors_fp'
/tmp/ccgN1DUz.o(.text+0x1b1): undefined reference to
`SSL_get_current_cipher'
/tmp/ccgN1DUz.o(.text+0x1bc): undefined reference to
`SSL_CIPHER_get_name'
/tmp/ccgN1DUz.o(.text+0x1f3): undefined reference to `SSL_write'
/tmp/ccgN1DUz.o(.text+0x20f): undefined reference to
`ERR_print_errors_fp'
/tmp/ccgN1DUz.o(.text+0x237): undefined reference to `SSL_read'
/tmp/ccgN1DUz.o(.text+0x253): undefined reference to
`ERR_print_errors_fp'
/tmp/ccgN1DUz.o(.text+0x297): undefined reference to
`SSL_shutdown'
/tmp/ccgN1DUz.o(.text+0x2b5): undefined reference to `SSL_free'
/tmp/ccgN1DUz.o(.text+0x2c4): undefined reference to
`SSL_CTX_free'
collect2: ld returned 1 exit status
The code is here as an attachment. I would be grateful if someone
helps me, I still have problem with serv.cpp and inetdserv.cpp but
I will try to debug them myself.
2. It would be of great help if someone can tell me a link where I
can learn how to write applications using Openssl Library.
Thank You very much,
Yours Sincerely
Shalendra (Student)
_________________________________________________________
Click below to visit monsterindia.com and review jobs in India or
Abroad
http://monsterindia.rediff.com/jobs
[-- Attachment #2: cli.cpp --]
[-- Type: application/octet-stream, Size: 2482 bytes --]
/* cli.cpp - Minimal ssleay client for Unix
30.9.1996, Sampo Kellomaki <sampo@iki.fi> */
/* mangled to work with SSLeay-0.9.0b and OpenSSL 0.9.2b
Simplified to be even more minimal
12/98 - 4/99 Wade Scholine <wades@mail.cybg.com> */
#include <stdio.h>
#include <memory.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
# include <unistd.h>
#define CHK_NULL(x) if ((x)==NULL) exit (1)
#define CHK_ERR(err,s) if ((err)==-1) { perror(s); exit(1); }
#define CHK_SSL(err) if ((err)==-1) { ERR_print_errors_fp(stderr); exit(2); }
void main ()
{
int err;
int sd;
struct sockaddr_in sa;
SSL_CTX* ctx;
SSL* ssl;
X509* server_cert;
char* str;
char buf [4096];
SSL_METHOD *meth;
SSLeay_add_ssl_algorithms();
meth = SSLv2_client_method();
SSL_load_error_strings();
ctx = SSL_CTX_new (meth); CHK_NULL(ctx);
CHK_SSL(err);
/* ----------------------------------------------- */
/* Create a socket and connect to server using normal socket calls. */
sd = socket (AF_INET, SOCK_STREAM, 0); CHK_ERR(sd, "socket");
memset (&sa, '\0', sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = inet_addr ("127.0.0.1"); /* Server IP */
sa.sin_port = htons (1111); /* Server Port number */
err = connect(sd, (struct sockaddr*) &sa,
sizeof(sa)); CHK_ERR(err, "connect");
/* Now we have TCP conncetion. Start SSL negotiation. */
ssl = SSL_new (ctx); CHK_NULL(ssl);
SSL_set_fd (ssl, sd);
err = SSL_connect (ssl); CHK_SSL(err);
/* Following two steps are optional and not required for
data exchange to be successful. */
/* Get the cipher - opt */
printf ("SSL connection using %s\n", SSL_get_cipher (ssl));
/* DATA EXCHANGE - Send a message and receive a reply. */
err = SSL_write (ssl, "Hello World!", strlen("Hello World!")); CHK_SSL(err);
err = SSL_read (ssl, buf, sizeof(buf) - 1); CHK_SSL(err);
buf[err] = '\0';
printf ("Got %d chars:'%s'\n", err, buf);
SSL_shutdown (ssl); /* send SSL/TLS close_notify */
/* Clean up. */
close (sd);
SSL_free (ssl);
SSL_CTX_free (ctx);
}
/* EOF - cli.cpp */
next reply other threads:[~2002-05-11 15:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-11 8:13 Shalendra Chhabra [this message]
2002-05-11 8:24 ` Alexandre Courbot
-- strict thread matches above, loose matches on Subject: below --
2013-04-18 8:14 Help required sonal
2013-04-18 10:09 ` Chung-Ju Wu
2003-09-29 4:52 help required josephine
2003-06-06 4:37 Help Required Phani Pavan
[not found] <616BE6A276E3714788D2AC35C40CD18D621D2A@whale.softwire.co.uk>
2002-05-10 7:05 ` Help required Rupert Wood
2002-05-10 6:33 Shalendra Chhabra
2002-03-07 3:57 Navin K Sinha
2000-04-10 17:23 Help Required Sharma, SumanX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020511151351.23647.qmail@webmail5.rediffmail.com \
--to=shalu_itbhu@rediffmail.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).