summaryrefslogtreecommitdiff
path: root/src/openssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/openssl.c')
-rw-r--r--src/openssl.c177
1 files changed, 177 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 4936003..5695b58 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -60,6 +60,8 @@
60#include <mach/mach_time.h> /* mach_absolute_time() */ 60#include <mach/mach_time.h> /* mach_absolute_time() */
61#endif 61#endif
62 62
63#include <openssl/opensslconf.h>
64#include <openssl/opensslv.h>
63#include <openssl/err.h> 65#include <openssl/err.h>
64#include <openssl/bn.h> 66#include <openssl/bn.h>
65#include <openssl/asn1.h> 67#include <openssl/asn1.h>
@@ -518,6 +520,181 @@ static void initall(lua_State *L);
518 520
519 521
520/* 522/*
523 * OPENSSL - openssl
524 *
525 * Miscellaneous global interfaces.
526 *
527 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
528
529/*
530 * NOTE: Compile-time cipher exclusions from openssl-1.0.1i/util/mkdef.pl.
531 */
532static const char opensslconf_no[][20] = {
533#ifdef OPENSSL_NO_RC2
534 { "NO_RC2" },
535#endif
536#ifdef OPENSSL_NO_RC4
537 { "NO_RC4" },
538#endif
539#ifdef OPENSSL_NO_RC5
540 { "NO_RC5" },
541#endif
542#ifdef OPENSSL_NO_IDEA
543 { "NO_IDEA" },
544#endif
545#ifdef OPENSSL_NO_DES
546 { "NO_DES" },
547#endif
548#ifdef OPENSSL_NO_BF
549 { "NO_BF" },
550#endif
551#ifdef OPENSSL_NO_CAST
552 { "NO_CAST" },
553#endif
554#ifdef OPENSSL_NO_WHIRLPOOL
555 { "NO_WHIRLPOOL" },
556#endif
557#ifdef OPENSSL_NO_CAMELLIA
558 { "NO_CAMELLIA" },
559#endif
560#ifdef OPENSSL_NO_SEED
561 { "NO_SEED" },
562#endif
563#ifdef OPENSSL_NO_MD2
564 { "NO_MD2" },
565#endif
566#ifdef OPENSSL_NO_MD4
567 { "NO_MD4" },
568#endif
569#ifdef OPENSSL_NO_MD5
570 { "NO_MD5" },
571#endif
572#ifdef OPENSSL_NO_SHA
573 { "NO_SHA" },
574#endif
575#ifdef OPENSSL_NO_RIPEMD
576 { "NO_RIPEMD" },
577#endif
578#ifdef OPENSSL_NO_MDC2
579 { "NO_MDC2" },
580#endif
581#ifdef OPENSSL_NO_RSA
582 { "NO_RSA" },
583#endif
584#ifdef OPENSSL_NO_DSA
585 { "NO_DSA" },
586#endif
587#ifdef OPENSSL_NO_DH
588 { "NO_DH" },
589#endif
590#ifdef OPENSSL_NO_HMAC
591 { "NO_HMAC" },
592#endif
593#ifdef OPENSSL_NO_AES
594 { "NO_AES" },
595#endif
596#ifdef OPENSSL_NO_KRB5
597 { "NO_KRB5" },
598#endif
599#ifdef OPENSSL_NO_EC
600 { "NO_EC" },
601#endif
602#ifdef OPENSSL_NO_ECDSA
603 { "NO_ECDSA" },
604#endif
605#ifdef OPENSSL_NO_ECDH
606 { "NO_ECDH" },
607#endif
608#ifdef OPENSSL_NO_ENGINE
609 { "NO_ENGINE" },
610#endif
611#ifdef OPENSSL_NO_HW
612 { "NO_HW" },
613#endif
614#ifdef OPENSSL_NO_FP_API
615 { "NO_FP_API" },
616#endif
617#ifdef OPENSSL_NO_STATIC_ENGINE
618 { "NO_STATIC_ENGINE" },
619#endif
620#ifdef OPENSSL_NO_GMP
621 { "NO_GMP" },
622#endif
623#ifdef OPENSSL_NO_DEPRECATED
624 { "NO_DEPRECATED" },
625#endif
626#ifdef OPENSSL_NO_RFC3779
627 { "NO_RFC3779" },
628#endif
629#ifdef OPENSSL_NO_PSK
630 { "NO_PSK" },
631#endif
632#ifdef OPENSSL_NO_TLSEXT
633 { "NO_TLSEXT" },
634#endif
635#ifdef OPENSSL_NO_CMS
636 { "NO_CMS" },
637#endif
638#ifdef OPENSSL_NO_CAPIENG
639 { "NO_CAPIENG" },
640#endif
641#ifdef OPENSSL_NO_JPAKE
642 { "NO_JPAKE" },
643#endif
644#ifdef OPENSSL_NO_SRP
645 { "NO_SRP" },
646#endif
647#ifdef OPENSSL_NO_SSL2
648 { "NO_SSL2" },
649#endif
650#ifdef OPENSSL_NO_EC2M
651 { "NO_EC2M" },
652#endif
653#ifdef OPENSSL_NO_NISTP_GCC
654 { "NO_NISTP_GCC" },
655#endif
656#ifdef OPENSSL_NO_NEXTPROTONEG
657 { "NO_NEXTPROTONEG" },
658#endif
659#ifdef OPENSSL_NO_SCTP
660 { "NO_SCTP" },
661#endif
662#ifdef OPENSSL_NO_UNIT_TEST
663 { "NO_UNIT_TEST" },
664#endif
665 { "" } /* in case nothing is defined above */
666}; /* opensslconf_no[] */
667
668
669int luaopen__openssl(lua_State *L) {
670 size_t i;
671
672 lua_newtable(L);
673
674 for (i = 0; i < countof(opensslconf_no); i++) {
675 if (*opensslconf_no[i]) {
676 lua_pushboolean(L, 1);
677 lua_setfield(L, -2, opensslconf_no[i]);
678 }
679 }
680
681 lib_pushinteger(L, OPENSSL_VERSION_NUMBER);
682 lua_setfield(L, -2, "VERSION_NUMBER");
683
684 lua_pushstring(L, OPENSSL_VERSION_TEXT);
685 lua_setfield(L, -2, "VERSION_TEXT");
686
687 lua_pushstring(L, SHLIB_VERSION_HISTORY);
688 lua_setfield(L, -2, "SSHLIB_VERSION_HISTORY");
689
690 lua_pushstring(L, SHLIB_VERSION_NUMBER);
691 lua_setfield(L, -2, "SSHLIB_VERSION_NUMBER");
692
693 return 1;
694} /* luaopen__openssl() */
695
696
697/*
521 * BIGNUM - openssl.bignum 698 * BIGNUM - openssl.bignum
522 * 699 *
523 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 700 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */