source: freewrt/package/mini_httpd/patches/500-matrixssl.patch@ 6fc4520e

freewrt_1_0 freewrt_2_0
Last change on this file since 6fc4520e was 475ad56, checked in by Waldemar Brodkorb <wbx@…>, 20 years ago

add OpenWrt trunk revision 3830.

git-svn-id: svn://www.freewrt.org/trunk/freewrt@1 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 4.3 KB
  • mini_httpd-1.

    diff -ruN mini_httpd-1.19-orig/Makefile mini_httpd-1.19-3/Makefile
    old new  
    1414# http://www.openssl.org/  Make sure the SSL_TREE definition points to the
    1515# tree with your OpenSSL installation - depending on how you installed it,
    1616# it may be in /usr/local instead of /usr/local/ssl.
     17
     18# OpenSSL
    1719#SSL_TREE =     /usr/local/ssl
    1820#SSL_DEFS =     -DUSE_SSL
    1921#SSL_INC =      -I${SSL_TREE}/include
    2022#SSL_LIBS =     -L${SSL_TREE}/lib -lssl -lcrypto
     23#SSL_OBJS =
     24
     25# MatrixSSL
     26#SSL_TREE =
     27#SSL_DEFS =     -DUSE_SSL -DHAVE_MATRIXSSL
     28#SSL_INC =
     29#SSL_LIBS =     -lmatrixssl
     30#SSL_OBJS =     matrixssl_helper.o
    2131
    2232
    23 BINDIR =        /usr/local/sbin
    24 MANDIR =        /usr/local/man
     33DESTDIR =
     34
     35BINDIR =        $(DESTDIR)/usr/sbin
     36MANDIR =        $(DESTDIR)/usr/share/man
    2537CC =            gcc
    2638CDEFS =         ${SSL_DEFS} ${SSL_INC}
    27 CFLAGS =        -O ${CDEFS}
     39OFLAGS =        -O
     40CFLAGS =        ${OFLAGS} ${CDEFS}
    2841#CFLAGS =       -g ${CDEFS}
    29 LDFLAGS =       -s
     42LDFLAGS =
    3043#LDFLAGS =      -g
     
    3245
    3346all:            mini_httpd htpasswd
    3447
    35 mini_httpd:     mini_httpd.o match.o tdate_parse.o
    36         ${CC} ${CFLAGS} ${LDFLAGS} mini_httpd.o match.o tdate_parse.o ${LDLIBS} -o mini_httpd
     48mini_httpd:     mini_httpd.o match.o tdate_parse.o ${SSL_OBJS}
     49        ${CC} ${CFLAGS} ${LDFLAGS} mini_httpd.o match.o tdate_parse.o ${SSL_OBJS} ${LDLIBS} -o mini_httpd
    3750
    3851mini_httpd.o:   mini_httpd.c version.h port.h match.h tdate_parse.h mime_encodings.h mime_types.h
    3952        ${CC} ${CFLAGS} -c mini_httpd.c
    4053
     54matrixssl_helper.o: matrixssl_helper.c
     55        ${CC} ${CFLAGS} -c matrixssl_helper.c
     56       
    4157match.o:        match.c match.h
    4258        ${CC} ${CFLAGS} -c match.c
    4359
     
    7187        chmod 600 mini_httpd.pem
    7288
    7389
    74 install:        all
    75         rm -f ${BINDIR}/mini_httpd ${BINDIR}/htpasswd
     90install:        all uninstall
    7691        -mkdir -p ${BINDIR}
    7792        cp mini_httpd htpasswd ${BINDIR}
    78         rm -f ${MANDIR}/man8/mini_httpd.8 ${MANDIR}/man1/htpasswd.1
    7993        -mkdir -p ${MANDIR}/man8
    8094        cp mini_httpd.8 ${MANDIR}/man8
    8195        -mkdir -p ${MANDIR}/man1
    8296        cp htpasswd.1 ${MANDIR}/man1
    8397
     98uninstall:
     99        rm -f ${BINDIR}/mini_httpd ${BINDIR}/htpasswd
     100        rm -f ${MANDIR}/man8/mini_httpd.8 ${MANDIR}/man1/htpasswd.1
     101
    84102clean:
    85103        rm -f mini_httpd mime_encodings.h mime_types.h htpasswd mini_httpd.rnd *.o core core.* *.core
    86104
  • mini_httpd.c

    diff -ruN mini_httpd-1.19-orig/mini_httpd.c mini_httpd-1.19-3/mini_httpd.c
    old new  
    6666#endif /* HAVE_SENDFILE */
    6767
    6868#ifdef USE_SSL
     69# ifdef HAVE_OPENSSL
    6970#include <openssl/ssl.h>
    7071#include <openssl/err.h>
     72# else /* HAVE_OPENSSL */
     73#  ifdef HAVE_MATRIXSSL
     74#   include "matrixssl_helper.h"
     75#  endif /* HAVE_MATRIXSSL */
     76# endif /* HAVE_OPENSSL */
    7177#endif /* USE_SSL */
    7278
    7379extern char* crypt( const char* key, const char* setting );
     
    193199static int do_ssl;
    194200static char* certfile;
    195201static char* cipher;
     202#ifdef HAVE_OPENSSL
    196203static SSL_CTX* ssl_ctx;
     204#else /* HAVE_OPENSSL */
     205 #ifdef HAVE_MATRIXSSL
     206static sslKeys_t* keys;
     207 #endif /* HAVE_MATRIXSSL */
     208#endif /* HAVE_OPENSSL */
    197209#endif /* USE_SSL */
    198210static char cwd[MAXPATHLEN];
    199211static int got_hup;
     
    540552#ifdef USE_SSL
    541553    if ( do_ssl )
    542554        {
     555# ifdef HAVE_OPENSSL
    543556        SSL_load_error_strings();
    544557        SSLeay_add_ssl_algorithms();
    545558        ssl_ctx = SSL_CTX_new( SSLv23_server_method() );
     
    559572                exit( 1 );
    560573                }
    561574            }
     575# else /* HAVE_OPENSSL */
     576#  ifdef HAVE_MATRIXSSL
     577        matrixSslOpen();
     578        if ( matrixSslReadKeys( &keys, certfile, certfile, NULL, NULL ) < 0 )
     579            {
     580            syslog( LOG_CRIT, "can't load certificate and/or private key\n");
     581            (void) fprintf( stderr, "%s: can't load certificate and/or private key\n", argv0 );
     582            exit( 1 );
     583            }
     584#  endif /* HAVE_MATRIXSSL */
     585# endif /* HAVE_OPENSSL */
    562586        }
    563587#endif /* USE_SSL */
    564588
     
    11741198#ifdef USE_SSL
    11751199    if ( do_ssl )
    11761200        {
     1201# ifdef HAVE_OPENSSL
    11771202        ssl = SSL_new( ssl_ctx );
    11781203        SSL_set_fd( ssl, conn_fd );
    11791204        if ( SSL_accept( ssl ) == 0 )
     
    11811206            ERR_print_errors_fp( stderr );
    11821207            exit( 1 );
    11831208            }
     1209# else /* HAVE_OPENSSL */
     1210#  ifdef HAVE_MATRIXSSL
     1211        ssl = SSL_new(keys);
     1212        SSL_set_fd( ssl, conn_fd );
     1213        if ( SSL_accept( ssl ) <= 0 )
     1214            {
     1215            perror( "SSL_accept" );
     1216            }
     1217#  endif /* HAVE_MATRIXSSL */
     1218# endif /* HAVE_OPENSSL */
    11841219        }
    11851220#endif /* USE_SSL */
    11861221
Note: See TracBrowser for help on using the repository browser.