1160814Ssimon=pod 2160814Ssimon 3160814Ssimon=head1 NAME 4160814Ssimon 5160814SsimonBN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update, BN_BLINDING_convert, 6160814SsimonBN_BLINDING_invert, BN_BLINDING_convert_ex, BN_BLINDING_invert_ex, 7160814SsimonBN_BLINDING_get_thread_id, BN_BLINDING_set_thread_id, BN_BLINDING_get_flags, 8160814SsimonBN_BLINDING_set_flags, BN_BLINDING_create_param - blinding related BIGNUM 9160814Ssimonfunctions. 10160814Ssimon 11160814Ssimon=head1 SYNOPSIS 12160814Ssimon 13160814Ssimon #include <openssl/bn.h> 14160814Ssimon 15160814Ssimon BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, 16160814Ssimon BIGNUM *mod); 17160814Ssimon void BN_BLINDING_free(BN_BLINDING *b); 18160814Ssimon int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); 19160814Ssimon int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); 20160814Ssimon int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); 21160814Ssimon int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, 22160814Ssimon BN_CTX *ctx); 23160814Ssimon int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, 24160814Ssimon BN_CTX *ctx); 25238405Sjkim #ifndef OPENSSL_NO_DEPRECATED 26160814Ssimon unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); 27160814Ssimon void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); 28238405Sjkim #endif 29238405Sjkim CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *); 30160814Ssimon unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); 31160814Ssimon void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); 32160814Ssimon BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, 33160814Ssimon const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, 34160814Ssimon int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 35160814Ssimon const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), 36160814Ssimon BN_MONT_CTX *m_ctx); 37160814Ssimon 38160814Ssimon=head1 DESCRIPTION 39160814Ssimon 40160814SsimonBN_BLINDING_new() allocates a new B<BN_BLINDING> structure and copies 41160814Ssimonthe B<A> and B<Ai> values into the newly created B<BN_BLINDING> object. 42160814Ssimon 43160814SsimonBN_BLINDING_free() frees the B<BN_BLINDING> structure. 44160814Ssimon 45160814SsimonBN_BLINDING_update() updates the B<BN_BLINDING> parameters by squaring 46160814Ssimonthe B<A> and B<Ai> or, after specific number of uses and if the 47160814Ssimonnecessary parameters are set, by re-creating the blinding parameters. 48160814Ssimon 49160814SsimonBN_BLINDING_convert_ex() multiplies B<n> with the blinding factor B<A>. 50160814SsimonIf B<r> is not NULL a copy the inverse blinding factor B<Ai> will be 51264331Sjkimreturned in B<r> (this is useful if a B<RSA> object is shared among 52160814Ssimonseveral threads). BN_BLINDING_invert_ex() multiplies B<n> with the 53160814Ssimoninverse blinding factor B<Ai>. If B<r> is not NULL it will be used as 54160814Ssimonthe inverse blinding. 55160814Ssimon 56160814SsimonBN_BLINDING_convert() and BN_BLINDING_invert() are wrapper 57160814Ssimonfunctions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() 58160814Ssimonwith B<r> set to NULL. 59160814Ssimon 60238405SjkimBN_BLINDING_thread_id() provides access to the B<CRYPTO_THREADID> 61238405Sjkimobject within the B<BN_BLINDING> structure. This is to help users 62238405Sjkimprovide proper locking if needed for multi-threaded use. The "thread 63238405Sjkimid" object of a newly allocated B<BN_BLINDING> structure is 64238405Sjkiminitialised to the thread id in which BN_BLINDING_new() was called. 65160814Ssimon 66160814SsimonBN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently 67160814Ssimonthere are two supported flags: B<BN_BLINDING_NO_UPDATE> and 68160814SsimonB<BN_BLINDING_NO_RECREATE>. B<BN_BLINDING_NO_UPDATE> inhibits the 69160814Ssimonautomatic update of the B<BN_BLINDING> parameters after each use 70160814Ssimonand B<BN_BLINDING_NO_RECREATE> inhibits the automatic re-creation 71160814Ssimonof the B<BN_BLINDING> parameters after a fixed number of uses (currently 72160814Ssimon32). In newly allocated B<BN_BLINDING> objects no flags are set. 73160814SsimonBN_BLINDING_set_flags() sets the B<BN_BLINDING> parameters flags. 74160814Ssimon 75160814SsimonBN_BLINDING_create_param() creates new B<BN_BLINDING> parameters 76160814Ssimonusing the exponent B<e> and the modulus B<m>. B<bn_mod_exp> and 77160814SsimonB<m_ctx> can be used to pass special functions for exponentiation 78160814Ssimon(normally BN_mod_exp_mont() and B<BN_MONT_CTX>). 79160814Ssimon 80160814Ssimon=head1 RETURN VALUES 81160814Ssimon 82160814SsimonBN_BLINDING_new() returns the newly allocated B<BN_BLINDING> structure 83160814Ssimonor NULL in case of an error. 84160814Ssimon 85160814SsimonBN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(), 86160814SsimonBN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on 87160814Ssimonsuccess and 0 if an error occured. 88160814Ssimon 89238405SjkimBN_BLINDING_thread_id() returns a pointer to the thread id object 90238405Sjkimwithin a B<BN_BLINDING> object. 91160814Ssimon 92160814SsimonBN_BLINDING_get_flags() returns the currently set B<BN_BLINDING> flags 93160814Ssimon(a B<unsigned long> value). 94160814Ssimon 95160814SsimonBN_BLINDING_create_param() returns the newly created B<BN_BLINDING> 96160814Ssimonparameters or NULL on error. 97160814Ssimon 98160814Ssimon=head1 SEE ALSO 99160814Ssimon 100160814SsimonL<bn(3)|bn(3)> 101160814Ssimon 102160814Ssimon=head1 HISTORY 103160814Ssimon 104238405SjkimBN_BLINDING_thread_id was first introduced in OpenSSL 1.0.0, and it 105238405Sjkimdeprecates BN_BLINDING_set_thread_id and BN_BLINDING_get_thread_id. 106238405Sjkim 107160814SsimonBN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id, 108160814SsimonBN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags 109160814Ssimonand BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8 110160814Ssimon 111160814Ssimon=head1 AUTHOR 112160814Ssimon 113160814SsimonNils Larsch for the OpenSSL project (http://www.openssl.org). 114160814Ssimon 115160814Ssimon=cut 116