Skip to content

With SSL renegotiation, openssl CLI fails with "called a function you should not call" #1155

@TobiasEgg

Description

@TobiasEgg

When using libressl with the command openssl on the command line with -starttls and during the session, a renegotiation occurs, the openssl command line tool aborts with the following error message:

40619255824:error:1404C042:SSL routines:ST_OK:called a function you should not call:/usr/src/lib/libssl/ssl_lib.c:2862:

This should not happen.

Issue reproduced on OpenBSD 7.7 with LibreSSL 4.1.0 (default install) on both ARM64 and x86_64
Issue reproduced on OpenBSD 7.6 with LibreSSL 4.0.0 (default install) on both ARM64 and x86_64
Issue reproduced on OpenBSD 7.6 with LibreSSL 4.0.0 (default install) on x86_64

There are two ways to reproduce.

Variant 1:

$ openssl s_client -starttls ftp -crlf  -connect test.rebex.net:21
CONNECTED(00000003)
(... some stuff removed ...)
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.3
    Cipher    : TLS_AES_256_GCM_SHA384
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: 
    Start Time: 1746077388
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
---
    See https://test.rebex.net/ for more information and terms of use.
USER ftp
331 Anonymous login OK, send your complete email address as your password.
PASS user@example.com
230 User 'ftp' logged in.
REIN
RENEGOTIATING
17370740397880:error:1404C042:SSL routines:ST_OK:called a function you should not call:/usr/src/lib/libssl/ssl_lib.c:2862:

Variant 2:

Configure SMTP-Server, e.g. OpenSMTPd or any other (tested against several systems), with either self-signed or CA-signed key/cert (irrelevant to trigger the issue), e.g.,

pki openbsd77 key "/etc/ssl/private/testmailkey.pem"
pki openbsd77 cert "/etc/ssl/testmailcert.pem"
listen on lo0 inet4 port 25 hostname openbsd77 tls pki openbsd77

and do:

$ openssl s_client -starttls smtp -crlf -connect 127.0.0.1:25
CONNECTED(00000003)
(... some stuff removed ...)
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.3
    Cipher    : TLS_CHACHA20_POLY1305_SHA256
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: 
    Start Time: 1746076742
    Timeout   : 7200 (sec)
    Verify return code: 18 (self signed certificate)
---
250 HELP
EHLO Test
250-openbsd77 Hello Test [127.0.0.1], pleased to meet you
250-8BITMIME
250-ENHANCEDSTATUSCODES
250-SIZE 36700160
250-DSN
250 HELP
MAIL FROM: <test@example.com>
250 2.0.0 Ok
RCPT TO: <openbsd77@localhost>
RENEGOTIATING
95429802000:error:1404C042:SSL routines:ST_OK:called a function you should not call:/usr/src/lib/libssl/ssl_lib.c:2862:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions