1BN_BLINDING_new(3) OpenSSL BN_BLINDING_new(3)
2
3
4
6 BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update, BN_BLINDING_con‐
7 vert, BN_BLINDING_invert, BN_BLINDING_convert_ex, BN_BLIND‐
8 ING_invert_ex, BN_BLINDING_get_thread_id, BN_BLINDING_set_thread_id,
9 BN_BLINDING_get_flags, BN_BLINDING_set_flags, BN_BLINDING_create_param
10 - blinding related BIGNUM functions.
11
13 #include <openssl/bn.h>
14
15 BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai,
16 BIGNUM *mod);
17 void BN_BLINDING_free(BN_BLINDING *b);
18 int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx);
19 int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
20 int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
21 int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b,
22 BN_CTX *ctx);
23 int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
24 BN_CTX *ctx);
25 unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);
26 void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
27 unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
28 void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
29 BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
30 const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
31 int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
32 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
33 BN_MONT_CTX *m_ctx);
34
36 BN_BLINDING_new() allocates a new BN_BLINDING structure and copies the
37 A and Ai values into the newly created BN_BLINDING object.
38
39 BN_BLINDING_free() frees the BN_BLINDING structure.
40
41 BN_BLINDING_update() updates the BN_BLINDING parameters by squaring the
42 A and Ai or, after specific number of uses and if the necessary parame‐
43 ters are set, by re-creating the blinding parameters.
44
45 BN_BLINDING_convert_ex() multiplies n with the blinding factor A. If r
46 is not NULL a copy the inverse blinding factor Ai will be returned in r
47 (this is useful if a RSA object is shared amoung several threads).
48 BN_BLINDING_invert_ex() multiplies n with the inverse blinding factor
49 Ai. If r is not NULL it will be used as the inverse blinding.
50
51 BN_BLINDING_convert() and BN_BLINDING_invert() are wrapper functions
52 for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() with r set to
53 NULL.
54
55 BN_BLINDING_set_thread_id() and BN_BLINDING_get_thread_id() set and get
56 the "thread id" value of the BN_BLINDING structure, a field provided to
57 users of BN_BLINDING structure to help them provide proper locking if
58 needed for multi-threaded use. The "thread id" of a newly allocated
59 BN_BLINDING structure is zero.
60
61 BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently there
62 are two supported flags: BN_BLINDING_NO_UPDATE and BN_BLIND‐
63 ING_NO_RECREATE. BN_BLINDING_NO_UPDATE inhibits the automatic update of
64 the BN_BLINDING parameters after each use and BN_BLINDING_NO_RECREATE
65 inhibits the automatic re-creation of the BN_BLINDING parameters after
66 a fixed number of uses (currently 32). In newly allocated BN_BLINDING
67 objects no flags are set. BN_BLINDING_set_flags() sets the BN_BLINDING
68 parameters flags.
69
70 BN_BLINDING_create_param() creates new BN_BLINDING parameters using the
71 exponent e and the modulus m. bn_mod_exp and m_ctx can be used to pass
72 special functions for exponentiation (normally BN_mod_exp_mont() and
73 BN_MONT_CTX).
74
76 BN_BLINDING_new() returns the newly allocated BN_BLINDING structure or
77 NULL in case of an error.
78
79 BN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(),
80 BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on suc‐
81 cess and 0 if an error occured.
82
83 BN_BLINDING_get_thread_id() returns the thread id (a unsigned long
84 value) or 0 if not set.
85
86 BN_BLINDING_get_flags() returns the currently set BN_BLINDING flags (a
87 unsigned long value).
88
89 BN_BLINDING_create_param() returns the newly created BN_BLINDING param‐
90 eters or NULL on error.
91
93 bn(3)
94
96 BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLIND‐
97 ING_get_thread_id, BN_BLINDING_set_thread_id, BN_BLINDING_set_flags,
98 BN_BLINDING_get_flags and BN_BLINDING_create_param were first intro‐
99 duced in OpenSSL 0.9.8
100
102 Nils Larsch for the OpenSSL project (http://www.openssl.org).
103
104
105
1060.9.8b 2005-04-26 BN_BLINDING_new(3)