@Override
    @SuppressWarnings("Finally")
    protected byte[] engineSign() throws SignatureException {
        final NativeRef.EVP_MD_CTX ctxLocal = ctx;
        try {
            return NativeCrypto.EVP_DigestSignFinal(ctxLocal);
        } catch (Exception ex) {
            throw new SignatureException(ex);
        } finally {
            /*
             * Java expects the digest context to be reset completely after sign
             * calls.
             */
            try {
                resetContext();
            } catch (InvalidAlgorithmParameterException e) {
                throw new AssertionError("Reset of context failed after it was successful once");
            }
        }
    }
Configures the public key algorithm context ({@code EVP_PKEY_CTX}) associated with this
operation.

<p>The default implementation does nothing.

@param ctx reference to the context ({@code EVP_PKEY_CTX}).
common/src/main/java/org/conscrypt/OpenSSLSignature.java