EC_POINT_ADD(3)
π EC_POINT_ADD β bestie edition β¨
okay so this is a page from the Library Functions Manual, and it's all about libcrypto β the crypto library that lives on your system. It's giving "math class but make it fashion," and honestly? We're obsessed. π
β¨ NAME β¨
EC_POINT_add, EC_POINT_dbl, EC_POINT_invert, EC_POINT_is_at_infinity, EC_POINT_is_on_curve, EC_POINT_cmp, EC_POINT_make_affine, EC_POINT_mul β literally all of them do mathematical operations and tests on EC_POINT objects. That's the whole vibe. π
π¦ SYNOPSIS π¦
First things first, bestie, you gotta pull in the library and the headers:
library βlibcryptoβ #include <openssl/ec.h>
#include <openssl/bn.h>
and then the actual functions, in all their glory:
int
EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
const EC_POINT *b, BN_CTX *ctx);
int
EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
BN_CTX *ctx);
int
EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);
int
EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);
int
EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
BN_CTX *ctx);
int
EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a,
const EC_POINT *b, BN_CTX *ctx);
int
EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point,
BN_CTX *ctx);
int
EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n,
const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);
πΈ DESCRIPTION πΈ
So these functions all operate on EC_POINT objects, which are created by EC_POINT_new(3). No cap, that's where they come from. π«
EC_POINT_add()β adds the two pointsaandb, and drops the result intor. Math but cute. β¨EC_POINT_dbl()β doubles the pointaand puts the result inr. Same energy, just one point doing overtime. πͺ
and yes, for both of those, it's totally valid forrto be one ofaorbβ the function can write over its own input, it's fine, she's flexible like that. π«Ά
EC_POINT_invert()β calculates the inverse of the supplied pointa, and the result gets placed back ina. In place, periodt. πEC_POINT_is_at_infinity()β tests whether the supplied point is at infinity or not. Is she infinitely far away or nah? That's the question. πEC_POINT_is_on_curve()β tests whether the supplied point is on the curve or not. Vibe check for points, basically. βEC_POINT_cmp()β compares the two supplied points and tests whether or not they're equal. Are they the same girl? π―EC_POINT_mul()β this one's the main character. It calculates:
generator * n + q * m
and stores the result in r. π₯
okay and here's the tea: the value n may be NULL, in which case the result is just:
q * m.
See EC_GROUP_new_curve_GFp(3) for the info about the generator β that's where she lives, iykyk. π
π RETURN VALUES π
The following functions return 1 on success or 0 on error β classic:
EC_POINT_add()EC_POINT_dbl()EC_POINT_invert()EC_POINT_make_affine()EC_POINT_mul()
EC_POINT_is_at_infinity() returns 1 if the point is at infinity, or 0 otherwise. π«
EC_POINT_is_on_curve() returns 1 if the point is on the curve, 0 if it's not, or -1 on error. Three whole moods. π
EC_POINT_cmp() returns 1 if the points are not equal, 0 if they are, or -1 on error. Yes bestie, it's inverted β read it twice, I had to. π
careful with that EC_POINT_cmp() return value, it's giving "yes means no" and that's exactly the kind of thing that'll ruin your whole afternoon if you skim it. π
π§ SEE ALSO π§
Go read these too, they're all linked and they all slay in their own way:
crypto(3), d2i_ECPKParameters(3), EC_GROUP_check(3), EC_GROUP_get_curve_name(3), EC_GROUP_new_by_curve_name(3), EC_GROUP_new_curve_GFp(3), EC_KEY_METHOD_new(3), EC_KEY_new(3), EC_POINT_get_affine_coordinates(3), EC_POINT_new(3), EC_POINT_point2oct(3)
β HISTORY β
EC_POINT_add(), EC_POINT_dbl(), EC_POINT_invert(), EC_POINT_is_at_infinity(), EC_POINT_is_on_curve(), EC_POINT_cmp(), EC_POINT_make_affine(), and EC_POINT_mul() first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2. iconic behavior, honestly. π
and that's the whole page, bestie!! π this beauty is from the Debian edition of the manual, dated June 8, 2025, and it's filed under EC_POINT_ADD(3) β go forth and do math responsibly, mwah π«Άβ¨π
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2013 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms