SRP_CALC_B(3ossl)
π NAME π
okay bestie, gather round, because this page is about a whole squad of SRP authentication primitives β the literal building blocks of SRP auth β and every single one of them is listed right here:
SRP_Calc_server_keySRP_Calc_ASRP_Calc_B_exSRP_Calc_BSRP_Calc_u_exSRP_Calc_uSRP_Calc_x_exSRP_Calc_xSRP_Calc_client_key_exSRP_Calc_client_key
This is SRP_CALC_B(3ossl) β yes the page is named after just one of them, classic main-character behavior from SRP_Calc_B, we love that for her. π
β¨ SYNOPSIS β¨
First things first, you gotta pull in the header:
#include <openssl/srp.h>
BIG important vibe check first, bestie: the following functions have been deprecated since OpenSSL 3.0, and you can hide them entirely by defining OPENSSL_API_COMPAT with a suitable version value β check openssl_user_macros(7) for the deets.
/* server side .... */
BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u,
const BIGNUM *b, const BIGNUM *N);
BIGNUM *SRP_Calc_B_ex(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,
const BIGNUM *v, OSSL_LIB_CTX *libctx, const char *propq);
BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,
const BIGNUM *v);
BIGNUM *SRP_Calc_u_ex(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N,
OSSL_LIB_CTX *libctx, const char *propq);
BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N);
/* client side .... */
BIGNUM *SRP_Calc_client_key_ex(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
const BIGNUM *x, const BIGNUM *a, const BIGNUM *u,
OSSL_LIB_CTX *libctx, const char *propq);
BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
const BIGNUM *x, const BIGNUM *a, const BIGNUM *u);
BIGNUM *SRP_Calc_x_ex(const BIGNUM *s, const char *user, const char *pass,
OSSL_LIB_CTX *libctx, const char *propq);
BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass);
BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g);
πΈ DESCRIPTION πΈ
π¨ No cap, this is the part you need to read twice: all of the functions described on this page are deprecated. There are no available replacement functions at this time. That's not me being dramatic, that's literally what it says. There's no glow-up replacement waiting in the wings, so plan accordingly. π
So. The SRP functions on this page do the math for all the various parameters and keys that SRP uses, as defined in RFC2945. Here's the split, and it's very much a two-sides-of-the-group-chat situation:
π₯οΈ Server side β the server key, plus the B and u parameters, all get calculated by:
SRP_Calc_server_key()SRP_Calc_B_ex()SRP_Calc_B()SRP_Calc_u_ex()SRP_Calc_u()
π± Client side β the client key, plus the x and A parameters, all get calculated by:
SRP_Calc_client_key_ex()SRP_Calc_client_key()SRP_Calc_x_ex()SRP_Calc_x()SRP_Calc_A()
And if you wanna know how they're actually used, or what all these BIGNUM parameters even mean? Go read RFC2945, it's got the detailed description, iykyk. π
π¦ the two-flavors thing
Most of these functions come in two forms, and it's giving "same energy, different plumbing":
- the ones that take a
libctxand apropqparameter - the ones that don't
Any cryptographic functions that get fetched and used during the calculation will use the provided libctx and propq. Wanna know more? Peep "ALGORITHM FETCHING" in crypto(7).
The variants that don't take a libctx and propq parameter just use the default library context and property query string. Slay, defaults, love that for them.
And here's a cute lil exception to the whole two-flavors situation: SRP_Calc_server_key() and SRP_Calc_A() don't have a form that takes libctx or propq parameters β and honestly? Because they don't need to fetch any cryptographic algorithms at all. No fetching, no context, periodt. π
β RETURN VALUES β
All these functions return the calculated key or parameter β the whole point of the exercise π«Ά β or NULL on error. That's it, that's the contract.
π SEE ALSO π
Go read these next, bestie, they're all connected:
π HISTORY π
The lore, chronologically:
SRP_Calc_B_ex,SRP_Calc_u_ex,SRP_Calc_client_key_exandSRP_Calc_x_exwere introduced in OpenSSL 3.0.- All of the other functions were added in OpenSSL 1.0.1.
- And thenβ¦ all of these functions were deprecated in OpenSSL 3.0. π Iconic run though, fr fr.
π COPYRIGHT π
Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie!! mwah π this was SRP_CALC_B(3ossl) from OpenSSL 3.5.9, dated 2026-09-29 β go forth and calc responsibly, mwahaha π§π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms