1BN_BLINDING_NEW(3ossl)              OpenSSL             BN_BLINDING_NEW(3ossl)
2
3
4

NAME

6       BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update,
7       BN_BLINDING_convert, BN_BLINDING_invert, BN_BLINDING_convert_ex,
8       BN_BLINDING_invert_ex, BN_BLINDING_is_current_thread,
9       BN_BLINDING_set_current_thread, BN_BLINDING_lock, BN_BLINDING_unlock,
10       BN_BLINDING_get_flags, BN_BLINDING_set_flags, BN_BLINDING_create_param
11       - blinding related BIGNUM functions
12

SYNOPSIS

14        #include <openssl/bn.h>
15
16        BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai,
17                                     BIGNUM *mod);
18        void BN_BLINDING_free(BN_BLINDING *b);
19        int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);
20        int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
21        int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
22        int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b,
23                                   BN_CTX *ctx);
24        int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
25                                  BN_CTX *ctx);
26        int BN_BLINDING_is_current_thread(BN_BLINDING *b);
27        void BN_BLINDING_set_current_thread(BN_BLINDING *b);
28        int BN_BLINDING_lock(BN_BLINDING *b);
29        int BN_BLINDING_unlock(BN_BLINDING *b);
30        unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b);
31        void BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags);
32        BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
33                                              const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
34                                              int (*bn_mod_exp)(BIGNUM *r,
35                                                                const BIGNUM *a,
36                                                                const BIGNUM *p,
37                                                                const BIGNUM *m,
38                                                                BN_CTX *ctx,
39                                                                BN_MONT_CTX *m_ctx),
40                                              BN_MONT_CTX *m_ctx);
41

DESCRIPTION

43       BN_BLINDING_new() allocates a new BN_BLINDING structure and copies the
44       A and Ai values into the newly created BN_BLINDING object.
45
46       BN_BLINDING_free() frees the BN_BLINDING structure.  If b is NULL,
47       nothing is done.
48
49       BN_BLINDING_update() updates the BN_BLINDING parameters by squaring the
50       A and Ai or, after specific number of uses and if the necessary
51       parameters are set, by re-creating the blinding parameters.
52
53       BN_BLINDING_convert_ex() multiplies n with the blinding factor A.  If r
54       is not NULL a copy the inverse blinding factor Ai will be returned in r
55       (this is useful if a RSA object is shared among several threads).
56       BN_BLINDING_invert_ex() multiplies n with the inverse blinding factor
57       Ai. If r is not NULL it will be used as the inverse blinding.
58
59       BN_BLINDING_convert() and BN_BLINDING_invert() are wrapper functions
60       for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() with r set to
61       NULL.
62
63       BN_BLINDING_is_current_thread() returns whether the BN_BLINDING
64       structure is owned by the current thread. This is to help users provide
65       proper locking if needed for multi-threaded use.
66
67       BN_BLINDING_set_current_thread() sets the current thread as the owner
68       of the BN_BLINDING structure.
69
70       BN_BLINDING_lock() locks the BN_BLINDING structure.
71
72       BN_BLINDING_unlock() unlocks the BN_BLINDING structure.
73
74       BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently there
75       are two supported flags: BN_BLINDING_NO_UPDATE and
76       BN_BLINDING_NO_RECREATE. BN_BLINDING_NO_UPDATE inhibits the automatic
77       update of the BN_BLINDING parameters after each use and
78       BN_BLINDING_NO_RECREATE inhibits the automatic re-creation of the
79       BN_BLINDING parameters after a fixed number of uses (currently 32). In
80       newly allocated BN_BLINDING objects no flags are set.
81       BN_BLINDING_set_flags() sets the BN_BLINDING parameters flags.
82
83       BN_BLINDING_create_param() creates new BN_BLINDING parameters using the
84       exponent e and the modulus m. bn_mod_exp and m_ctx can be used to pass
85       special functions for exponentiation (normally BN_mod_exp_mont() and
86       BN_MONT_CTX).
87

RETURN VALUES

89       BN_BLINDING_new() returns the newly allocated BN_BLINDING structure or
90       NULL in case of an error.
91
92       BN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(),
93       BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on
94       success and 0 if an error occurred.
95
96       BN_BLINDING_is_current_thread() returns 1 if the current thread owns
97       the BN_BLINDING object, 0 otherwise.
98
99       BN_BLINDING_set_current_thread() doesn't return anything.
100
101       BN_BLINDING_lock(), BN_BLINDING_unlock() return 1 if the operation
102       succeeded or 0 on error.
103
104       BN_BLINDING_get_flags() returns the currently set BN_BLINDING flags (a
105       unsigned long value).
106
107       BN_BLINDING_create_param() returns the newly created BN_BLINDING
108       parameters or NULL on error.
109

HISTORY

111       BN_BLINDING_thread_id() was first introduced in OpenSSL 1.0.0, and it
112       deprecates BN_BLINDING_set_thread_id() and BN_BLINDING_get_thread_id().
113
115       Copyright 2005-2021 The OpenSSL Project Authors. All Rights Reserved.
116
117       Licensed under the Apache License 2.0 (the "License").  You may not use
118       this file except in compliance with the License.  You can obtain a copy
119       in the file LICENSE in the source distribution or at
120       <https://www.openssl.org/source/license.html>.
121
122
123
1243.0.5                             2022-07-05            BN_BLINDING_NEW(3ossl)
Impressum