1 /* 2 * Copyright 2017 The Netty Project 3 * 4 * The Netty Project licenses this file to you under the Apache License, 5 * version 2.0 (the "License"); you may not use this file except in compliance 6 * with the License. You may obtain a copy of the License at: 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations 14 * under the License. 15 */ 16 package io.netty.internal.tcnative; 17 18 /** 19 * This class is necessary to break the following cyclic dependency: 20 * <ol> 21 * <li>JNI_OnLoad</li> 22 * <li>JNI Calls FindClass because RegisterNatives (used to register JNI methods) requires a class</li> 23 * <li>FindClass loads the class, but static members variables of that class attempt to call a JNI method which has not 24 * yet been registered.</li> 25 * <li>{@link java.lang.UnsatisfiedLinkError} is thrown because native method has not yet been registered.</li> 26 * </ol> 27 * <strong>Static members which call JNI methods must not be declared in this class!</strong> 28 */ 29 final class NativeStaticallyReferencedJniMethods { NativeStaticallyReferencedJniMethods()30 private NativeStaticallyReferencedJniMethods() { 31 } 32 33 /** 34 * Options that may impact security and may be set by default as defined in: 35 * <a href="https://www.openssl.org/docs/man1.0.1/ssl/SSL_CTX_set_options.html">SSL Docs</a>. 36 */ sslOpCipherServerPreference()37 static native int sslOpCipherServerPreference(); sslOpNoSSLv2()38 static native int sslOpNoSSLv2(); sslOpNoSSLv3()39 static native int sslOpNoSSLv3(); sslOpNoTLSv1()40 static native int sslOpNoTLSv1(); sslOpNoTLSv11()41 static native int sslOpNoTLSv11(); sslOpNoTLSv12()42 static native int sslOpNoTLSv12(); sslOpNoTicket()43 static native int sslOpNoTicket(); 44 45 /** 46 * Options not defined in the OpenSSL docs but may impact security. 47 */ sslOpNoCompression()48 static native int sslOpNoCompression(); 49 50 /* Only support OFF and SERVER for now */ sslSessCacheOff()51 static native int sslSessCacheOff(); sslSessCacheServer()52 static native int sslSessCacheServer(); 53 sslStConnect()54 static native int sslStConnect(); sslStAccept()55 static native int sslStAccept(); 56 sslModeEnablePartialWrite()57 static native int sslModeEnablePartialWrite(); sslModeAcceptMovingWriteBuffer()58 static native int sslModeAcceptMovingWriteBuffer(); sslModeReleaseBuffers()59 static native int sslModeReleaseBuffers(); 60 sslSendShutdown()61 static native int sslSendShutdown(); sslReceivedShutdown()62 static native int sslReceivedShutdown(); sslErrorNone()63 static native int sslErrorNone(); sslErrorSSL()64 static native int sslErrorSSL(); sslErrorWantRead()65 static native int sslErrorWantRead(); sslErrorWantWrite()66 static native int sslErrorWantWrite(); sslErrorWantX509Lookup()67 static native int sslErrorWantX509Lookup(); sslErrorSyscall()68 static native int sslErrorSyscall(); sslErrorZeroReturn()69 static native int sslErrorZeroReturn(); sslErrorWantConnect()70 static native int sslErrorWantConnect(); sslErrorWantAccept()71 static native int sslErrorWantAccept(); 72 x509CheckFlagAlwaysCheckSubject()73 static native int x509CheckFlagAlwaysCheckSubject(); x509CheckFlagDisableWildCards()74 static native int x509CheckFlagDisableWildCards(); x509CheckFlagNoPartialWildCards()75 static native int x509CheckFlagNoPartialWildCards(); x509CheckFlagMultiLabelWildCards()76 static native int x509CheckFlagMultiLabelWildCards(); 77 78 /* x509 certificate verification errors */ x509vOK()79 static native int x509vOK(); x509vErrUnspecified()80 static native int x509vErrUnspecified(); x509vErrUnableToGetIssuerCert()81 static native int x509vErrUnableToGetIssuerCert(); x509vErrUnableToGetCrl()82 static native int x509vErrUnableToGetCrl(); x509vErrUnableToDecryptCertSignature()83 static native int x509vErrUnableToDecryptCertSignature(); x509vErrUnableToDecryptCrlSignature()84 static native int x509vErrUnableToDecryptCrlSignature(); x509vErrUnableToDecodeIssuerPublicKey()85 static native int x509vErrUnableToDecodeIssuerPublicKey(); x509vErrCertSignatureFailure()86 static native int x509vErrCertSignatureFailure(); x509vErrCrlSignatureFailure()87 static native int x509vErrCrlSignatureFailure(); x509vErrCertNotYetValid()88 static native int x509vErrCertNotYetValid(); x509vErrCertHasExpired()89 static native int x509vErrCertHasExpired(); x509vErrCrlNotYetValid()90 static native int x509vErrCrlNotYetValid(); x509vErrCrlHasExpired()91 static native int x509vErrCrlHasExpired(); x509vErrErrorInCertNotBeforeField()92 static native int x509vErrErrorInCertNotBeforeField(); x509vErrErrorInCertNotAfterField()93 static native int x509vErrErrorInCertNotAfterField(); x509vErrErrorInCrlLastUpdateField()94 static native int x509vErrErrorInCrlLastUpdateField(); x509vErrErrorInCrlNextUpdateField()95 static native int x509vErrErrorInCrlNextUpdateField(); x509vErrOutOfMem()96 static native int x509vErrOutOfMem(); x509vErrDepthZeroSelfSignedCert()97 static native int x509vErrDepthZeroSelfSignedCert(); x509vErrSelfSignedCertInChain()98 static native int x509vErrSelfSignedCertInChain(); x509vErrUnableToGetIssuerCertLocally()99 static native int x509vErrUnableToGetIssuerCertLocally(); x509vErrUnableToVerifyLeafSignature()100 static native int x509vErrUnableToVerifyLeafSignature(); x509vErrCertChainTooLong()101 static native int x509vErrCertChainTooLong(); x509vErrCertRevoked()102 static native int x509vErrCertRevoked(); x509vErrInvalidCa()103 static native int x509vErrInvalidCa(); x509vErrPathLengthExceeded()104 static native int x509vErrPathLengthExceeded(); x509vErrInvalidPurpose()105 static native int x509vErrInvalidPurpose(); x509vErrCertUntrusted()106 static native int x509vErrCertUntrusted(); x509vErrCertRejected()107 static native int x509vErrCertRejected(); x509vErrSubjectIssuerMismatch()108 static native int x509vErrSubjectIssuerMismatch(); x509vErrAkidSkidMismatch()109 static native int x509vErrAkidSkidMismatch(); x509vErrAkidIssuerSerialMismatch()110 static native int x509vErrAkidIssuerSerialMismatch(); x509vErrKeyUsageNoCertSign()111 static native int x509vErrKeyUsageNoCertSign(); x509vErrUnableToGetCrlIssuer()112 static native int x509vErrUnableToGetCrlIssuer(); x509vErrUnhandledCriticalExtension()113 static native int x509vErrUnhandledCriticalExtension(); x509vErrKeyUsageNoCrlSign()114 static native int x509vErrKeyUsageNoCrlSign(); x509vErrUnhandledCriticalCrlExtension()115 static native int x509vErrUnhandledCriticalCrlExtension(); x509vErrInvalidNonCa()116 static native int x509vErrInvalidNonCa(); x509vErrProxyPathLengthExceeded()117 static native int x509vErrProxyPathLengthExceeded(); x509vErrKeyUsageNoDigitalSignature()118 static native int x509vErrKeyUsageNoDigitalSignature(); x509vErrProxyCertificatesNotAllowed()119 static native int x509vErrProxyCertificatesNotAllowed(); x509vErrInvalidExtension()120 static native int x509vErrInvalidExtension(); x509vErrInvalidPolicyExtension()121 static native int x509vErrInvalidPolicyExtension(); x509vErrNoExplicitPolicy()122 static native int x509vErrNoExplicitPolicy(); x509vErrDifferntCrlScope()123 static native int x509vErrDifferntCrlScope(); x509vErrUnsupportedExtensionFeature()124 static native int x509vErrUnsupportedExtensionFeature(); x509vErrUnnestedResource()125 static native int x509vErrUnnestedResource(); x509vErrPermittedViolation()126 static native int x509vErrPermittedViolation(); x509vErrExcludedViolation()127 static native int x509vErrExcludedViolation(); x509vErrSubtreeMinMax()128 static native int x509vErrSubtreeMinMax(); x509vErrApplicationVerification()129 static native int x509vErrApplicationVerification(); x509vErrUnsupportedConstraintType()130 static native int x509vErrUnsupportedConstraintType(); x509vErrUnsupportedConstraintSyntax()131 static native int x509vErrUnsupportedConstraintSyntax(); x509vErrUnsupportedNameSyntax()132 static native int x509vErrUnsupportedNameSyntax(); x509vErrCrlPathValidationError()133 static native int x509vErrCrlPathValidationError(); x509vErrPathLoop()134 static native int x509vErrPathLoop(); x509vErrSuiteBInvalidVersion()135 static native int x509vErrSuiteBInvalidVersion(); x509vErrSuiteBInvalidAlgorithm()136 static native int x509vErrSuiteBInvalidAlgorithm(); x509vErrSuiteBInvalidCurve()137 static native int x509vErrSuiteBInvalidCurve(); x509vErrSuiteBInvalidSignatureAlgorithm()138 static native int x509vErrSuiteBInvalidSignatureAlgorithm(); x509vErrSuiteBLosNotAllowed()139 static native int x509vErrSuiteBLosNotAllowed(); x509vErrSuiteBCannotSignP384WithP256()140 static native int x509vErrSuiteBCannotSignP384WithP256(); x509vErrHostnameMismatch()141 static native int x509vErrHostnameMismatch(); x509vErrEmailMismatch()142 static native int x509vErrEmailMismatch(); x509vErrIpAddressMismatch()143 static native int x509vErrIpAddressMismatch(); x509vErrDaneNoMatch()144 static native int x509vErrDaneNoMatch(); 145 } 146