1 // Copyright 2020 The BoringSSL Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef OPENSSL_HEADER_CRYPTO_DSA_INTERNAL_H
16 #define OPENSSL_HEADER_CRYPTO_DSA_INTERNAL_H
17 
18 #include <openssl/dsa.h>
19 
20 #include "../internal.h"
21 
22 #if defined(__cplusplus)
23 extern "C" {
24 #endif
25 
26 
27 struct dsa_st {
28   BIGNUM *p;
29   BIGNUM *q;
30   BIGNUM *g;
31 
32   BIGNUM *pub_key;
33   BIGNUM *priv_key;
34 
35   // Normally used to cache montgomery values
36   CRYPTO_MUTEX method_mont_lock;
37   BN_MONT_CTX *method_mont_p;
38   BN_MONT_CTX *method_mont_q;
39   CRYPTO_refcount_t references;
40   CRYPTO_EX_DATA ex_data;
41 };
42 
43 // dsa_check_key performs cheap self-checks on |dsa|, and ensures it is within
44 // DoS bounds. It returns one on success and zero on error.
45 int dsa_check_key(const DSA *dsa);
46 
47 
48 #if defined(__cplusplus)
49 }  // extern C
50 #endif
51 
52 #endif  // OPENSSL_HEADER_CRYPTO_DSA_INTERNAL_H
53