]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - apps/s_cb.c
Check that the subject name in a proxy cert complies to RFC 3820
[thirdparty/openssl.git] / apps / s_cb.c
index c47cf7b09e99ded01f19796c61710073d9bbeb91..fabf9cfb22223a7998dd89b1056ac580e387ea38 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h> /* for memcpy() */
 #define USE_SOCKETS
 #define NON_MAIN
 #include "apps.h"
@@ -191,10 +192,10 @@ int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
 int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
 {
     if (cert_file != NULL) {
-                /*-
-                SSL *ssl;
-                X509 *x509;
-                */
+        /*-
+        SSL *ssl;
+        X509 *x509;
+        */
 
         if (SSL_CTX_use_certificate_file(ctx, cert_file,
                                          SSL_FILETYPE_PEM) <= 0) {
@@ -212,20 +213,20 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
             return (0);
         }
 
-                /*-
-                In theory this is no longer needed
-                ssl=SSL_new(ctx);
-                x509=SSL_get_certificate(ssl);
-
-                if (x509 != NULL) {
-                        EVP_PKEY *pktmp;
-                        pktmp = X509_get_pubkey(x509);
-                        EVP_PKEY_copy_parameters(pktmp,
-                                                SSL_get_privatekey(ssl));
-                        EVP_PKEY_free(pktmp);
-                }
-                SSL_free(ssl);
-                */
+        /*-
+        In theory this is no longer needed
+        ssl=SSL_new(ctx);
+        x509=SSL_get_certificate(ssl);
+
+        if (x509 != NULL) {
+                EVP_PKEY *pktmp;
+                pktmp = X509_get_pubkey(x509);
+                EVP_PKEY_copy_parameters(pktmp,
+                                        SSL_get_privatekey(ssl));
+                EVP_PKEY_free(pktmp);
+        }
+        SSL_free(ssl);
+        */
 
         /*
          * If we are using DSA, we can copy the parameters from the private
@@ -747,7 +748,7 @@ int MS_CALLBACK generate_cookie_callback(SSL *ssl, unsigned char *cookie,
 
     /* Initialize a random secret */
     if (!cookie_initialized) {
-        if (!RAND_bytes(cookie_secret, COOKIE_SECRET_LENGTH)) {
+        if (RAND_bytes(cookie_secret, COOKIE_SECRET_LENGTH) <= 0) {
             BIO_printf(bio_err, "error setting random cookie secret\n");
             return 0;
         }