Comp128-1
COMP128: the GSM SIM authentication algorithm, whose version 1 is broken and kept for reference
Practical attacks exist. Present for compatibility and research only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About Comp128-1
Comp128-1 is one of 3 COMP128 variants in the NextSSL registry, a key derivation function. It uses a 16-byte (128-bit) key, a 12-byte (96-bit) output and a 16-byte salt. NextSSL lists it in the broken tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
COMP128 is the authentication algorithm used on GSM SIM cards to produce authentication responses and session keys. NextSSL carries three versions, and COMP128-1 is marked broken.
COMP128 takes a 128-bit challenge and a 128-bit key and produces a short response and session key through a fixed table-driven construction. Version 1 is the one used in early GSM networks, and versions 2 and 3 were later designs. Functions like this one are specified by 3GPP and run inside mobile operator networks, so they are rarely used outside that setting.
NextSSL lists the three variants comp128-1, comp128-2, comp128-3, each with a 16-byte key and 12-byte output. COMP128-1 is marked broken because published attacks recovered the key from the SIM algorithm's output. Interoperability with a network requires following the specification exactly, including byte order and input layout. NextSSL keeps this entry for research and test vectors, and the registry does not record a review of its design.
COMP128 belongs to the telecom authentication family rather than general-purpose cryptography. Use it only for compatibility with legacy SIMs, and use AES-based or 3GPP algorithms for new work. For general key derivation, HKDF or another standard function is the usual choice. Functions like this one are specified by 3GPP and run inside mobile operator networks, so they are rarely used outside that setting.
History
1998–1998COMP128-1 reverse engineered and broken by Briceno, Goldberg and Wagner
How it works
- The 128-bit challenge is expanded through a fixed sequence of table lookups and permutations.
- The output is split into a short response and a session key.
- The response is returned to the network, and the session key is kept on the SIM.
Security notes
COMP128-1 is broken, and the other two versions are unverified. Do not use COMP128 for new authentication systems.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 16 | Secret key |
| out | 12 | Output |
| salt | 16 | Salt |
| info | 0 | Info |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'broken' is reachable from the root API only
okm = root.call("kdf", "comp128-1", None, ikm, salt, b"context", 32)[0]
nextssl_root_kdf("comp128-1", NULL, ikm, salt, info, 32, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_kdf_in(reg::all(), Policy::Any, "comp128-1", &Params::new())?;
let okm = alg.derive(&ikm, &salt, b"context", 32)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other COMP128 variants
2Similar names
Looking for something else?More key derivation
All 10Frequently asked questions
What is Comp128-1?
Comp128-1 is a KDF in the COMP128 family. COMP128 is the authentication algorithm used on GSM SIM cards to produce authentication responses and session keys.
What are the Comp128-1 sizes?
In NextSSL, Comp128-1 uses: key 16 bytes, output 12 bytes.
Is Comp128-1 safe to use?
Comp128-1 is in the broken tier. Practical attacks exist. Present for compatibility and research only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).
What other COMP128 variants are there?
NextSSL also registers comp128-2, comp128-3 in the COMP128 family.
Related families
The Advanced Encryption Standard: the world's default 128-bit block cipher
KASUMIThe 3GPP block cipher behind A5/3, derived from MISTY1
HMAC_DRBGNIST SP 800-90A deterministic random bit generator built on HMAC
MILENAGEMILENAGE: the 3GPP AES-128 authentication and key agreement function set, unverified in NextSSL
TUAKTUAK: the 3GPP Keccak-based alternative to MILENAGE for mobile authentication and key generation
HMACThe standard way to build a MAC from a cryptographic hash (RFC 2104, FIPS 198-1)