networking · beginner · ~15 min

Is the TLS version acceptable?

Gate on a minimum protocol version.

Challenge

TLS versions are (major, minor) where TLS 1.2 is (3,3) and TLS 1.3 is (3,4). Implement int tls_version_ok(int major, int minor) returning 1 if the version is TLS 1.2 or newer (major 3 and minor >= 3), else 0.

Starter code

int tls_version_ok(int major, int minor) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.