ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/branches/FreeBSD/crypto/openssl/apps/s_cb.c
(Generate patch)

Comparing branches/FreeBSD/crypto/openssl/apps/s_cb.c (file contents):
Revision 1962 by laffer1, Sat Feb 25 02:29:52 2006 UTC vs.
Revision 1963 by laffer1, Mon Nov 3 18:21:07 2008 UTC

# Line 229 | Line 229 | int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char
229          return(1);
230          }
231  
232 < long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const char *argp, int argi,
233 <             long argl, long ret)
232 > int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key)
233          {
234 +        if (cert ==  NULL)
235 +                return 1;
236 +        if (SSL_CTX_use_certificate(ctx,cert) <= 0)
237 +                {
238 +                BIO_printf(bio_err,"error setting certificate\n");
239 +                ERR_print_errors(bio_err);
240 +                return 0;
241 +                }
242 +        if (SSL_CTX_use_PrivateKey(ctx,key) <= 0)
243 +                {
244 +                BIO_printf(bio_err,"error setting private key\n");
245 +                ERR_print_errors(bio_err);
246 +                return 0;
247 +                }
248 +
249 +                
250 +                /* Now we know that a key and cert have been set against
251 +                 * the SSL context */
252 +        if (!SSL_CTX_check_private_key(ctx))
253 +                {
254 +                BIO_printf(bio_err,"Private key does not match the certificate public key\n");
255 +                return 0;
256 +                }
257 +        return 1;
258 +        }
259 +
260 + long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
261 +        int argi, long argl, long ret)
262 +        {
263          BIO *out;
264  
265          out=(BIO *)BIO_get_callback_arg(bio);
# Line 239 | Line 267 | long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const
267  
268          if (cmd == (BIO_CB_READ|BIO_CB_RETURN))
269                  {
270 <                BIO_printf(out,"read from %08X [%08lX] (%d bytes => %ld (0x%X))\n",
271 <                        bio,argp,argi,ret,ret);
270 >                BIO_printf(out,"read from %p [%p] (%d bytes => %ld (0x%lX))\n",
271 >                        (void *)bio,argp,argi,ret,ret);
272                  BIO_dump(out,argp,(int)ret);
273                  return(ret);
274                  }
275          else if (cmd == (BIO_CB_WRITE|BIO_CB_RETURN))
276                  {
277 <                BIO_printf(out,"write to %08X [%08lX] (%d bytes => %ld (0x%X))\n",
278 <                        bio,argp,argi,ret,ret);
277 >                BIO_printf(out,"write to %p [%p] (%d bytes => %ld (0x%lX))\n",
278 >                        (void *)bio,argp,argi,ret,ret);
279                  BIO_dump(out,argp,(int)ret);
280                  }
281          return(ret);
# Line 255 | Line 283 | long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const
283  
284   void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret)
285          {
286 <        char *str;
286 >        const char *str;
287          int w;
288  
289          w=where& ~SSL_ST_MASK;
# Line 318 | Line 346 | void MS_CALLBACK msg_cb(int write_p, int version, int
346  
347                  if (len > 0)
348                          {
349 <                        switch (((unsigned char*)buf)[0])
349 >                        switch (((const unsigned char*)buf)[0])
350                                  {
351                                  case 0:
352                                          str_details1 = ", ERROR:";
353                                          str_details2 = " ???";
354                                          if (len >= 3)
355                                                  {
356 <                                                unsigned err = (((unsigned char*)buf)[1]<<8) + ((unsigned char*)buf)[2];
356 >                                                unsigned err = (((const unsigned char*)buf)[1]<<8) + ((const unsigned char*)buf)[2];
357                                                  
358                                                  switch (err)
359                                                          {
# Line 394 | Line 422 | void MS_CALLBACK msg_cb(int write_p, int version, int
422                          
423                          if (len == 2)
424                                  {
425 <                                switch (((unsigned char*)buf)[0])
425 >                                switch (((const unsigned char*)buf)[0])
426                                          {
427                                  case 1:
428                                          str_details1 = ", warning";
# Line 405 | Line 433 | void MS_CALLBACK msg_cb(int write_p, int version, int
433                                          }
434  
435                                  str_details2 = " ???";
436 <                                switch (((unsigned char*)buf)[1])
436 >                                switch (((const unsigned char*)buf)[1])
437                                          {
438                                  case 0:
439                                          str_details2 = " close_notify";
# Line 486 | Line 514 | void MS_CALLBACK msg_cb(int write_p, int version, int
514  
515                          if (len > 0)
516                                  {
517 <                                switch (((unsigned char*)buf)[0])
517 >                                switch (((const unsigned char*)buf)[0])
518                                          {
519                                  case 0:
520                                          str_details1 = ", HelloRequest";
# Line 539 | Line 567 | void MS_CALLBACK msg_cb(int write_p, int version, int
567                          {
568                          if (i % 16 == 0 && i > 0)
569                                  BIO_printf(bio, "\n   ");
570 <                        BIO_printf(bio, " %02x", ((unsigned char*)buf)[i]);
570 >                        BIO_printf(bio, " %02x", ((const unsigned char*)buf)[i]);
571                          }
572                  if (i < len)
573                          BIO_printf(bio, " ...");

Comparing branches/FreeBSD/crypto/openssl/apps/s_cb.c (property cvs2svn:cvs-rev):
Revision 1962 by laffer1, Sat Feb 25 02:29:52 2006 UTC vs.
Revision 1963 by laffer1, Mon Nov 3 18:21:07 2008 UTC

# Line 1 | Line 1
1 < 1.1.1.1
1 > 1.1.1.2

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines