BN_new() -- SSLeay 0.9.0b -- January 1999

NAME

BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_convert, BN_BLINDING_invert,
BN_BLINDING_update -- BN blinding routines

SYNOPSIS

#include "bn.h"

BN_BLINDING *BN_BLINDING_new(A, Ai, mod)
BIGNUM *A, *Ai, *mod;

void BN_BLINDING_free(b)
BN_BLINDING *b;

int BN_BLINDING_convert(n, r, ctx)
BIGNUM *n;
BN_BLINDING *r;
BN_CTX *ctx;

int BN_BLINDING_invert(n, b, ctx)
BIGNUM *n;
BN_BLINDING *b;
BN_CTX *ctx;

int BN_BLINDING_update(b, ctx)
BN_BLINDING *b;
BN_CTX *ctx;

DESCRIPTION

These functions are called by the RSA library when the RSA_FLAG_BLINDING is set.

BN_BLINDING_new creates two new BIGNUMs , copies A and Ai into them, and stuffs them along with mod into a new BN_BLINDING structure and returns it. Ai is expected to be the inverse of A in the field F^*_mod as computed by BN_mod_inverse(). See BN arithmetic routines for details on that function.

See the Overview of BN library for a definition of the BIGNUM and BN_BLINDING structures.

NULL is returned on error. Usually. (It appears to be a bug that in one case, the structure to be returned on error is freed (BUT not set to NULL) and then returned.

BN_BLINDING_free frees b.

BN_BLINDING_convert 'blinds' n by calling BN_mod_mul(n,n,b->A,b->mod,ctx). The ctx, which holds the temporary BIGNUMs required by this function, must have been previously allocated. 0 is returned on success or 1 on error. This function handles negative BIGNUMs properly.

See BN arithmetic routines for details on BN_mod_mul.

BN_BLINDING_invert 'unblinds' n by calling BN_mod_mul(n,n,b->Ai,b->mod,ctx). The ctx, which holds the temporary BIGNUMs required by this function, must have been previously allocated. 0 is returned on success or 1 on error. This function handles negative BIGNUMs properly.

See BN arithmetic routines for details on BN_mod_mul.

BN_BLINDING_update updates b to use new numbers by calling BN_mod_mul(b->A,b->A,b->A,b->mod,ctx) and BN_mod_mul(b->Ai,b->Ai,b->Ai,b->mod,ctx). The ctx, which holds the temporary BIGNUMs required by this function, must have been previously allocated. 0 is returned on success or 1 on error. This function handles negative BIGNUMs properly.

See BN arithmetic routines for details on BN_mod_mul.

This function is called only by BN_BLINDING_inverse; you probably will have no need to call it directly.