VirtualBox

source: vbox/trunk/src/libs/openssl-3.1.7/include/openssl/srp.h.in@ 108351

最後變更 在這個檔案從108351是 104078,由 vboxsync 提交於 12 月 前

openssl-3.1.5: Applied and adjusted our OpenSSL changes to 3.1.4. bugref:10638

檔案大小: 6.3 KB
 
1/*
2 * {- join("\n * ", @autowarntext) -}
3 *
4 * Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.
5 * Copyright (c) 2004, EdelKey Project. All Rights Reserved.
6 *
7 * Licensed under the Apache License 2.0 (the "License"). You may not use
8 * this file except in compliance with the License. You can obtain a copy
9 * in the file LICENSE in the source distribution or at
10 * https://www.openssl.org/source/license.html
11 *
12 * Originally written by Christophe Renou and Peter Sylvester,
13 * for the EdelKey project.
14 */
15
16{-
17use OpenSSL::stackhash qw(generate_stack_macros);
18-}
19
20#ifndef OPENSSL_SRP_H
21# define OPENSSL_SRP_H
22# pragma once
23
24# include <openssl/macros.h>
25# ifndef OPENSSL_NO_DEPRECATED_3_0
26# define HEADER_SRP_H
27# endif
28
29#include <openssl/opensslconf.h>
30
31#ifndef OPENSSL_NO_SRP
32# include <stdio.h>
33# include <string.h>
34# include <openssl/safestack.h>
35# include <openssl/bn.h>
36# include <openssl/crypto.h>
37
38# ifdef __cplusplus
39extern "C" {
40# endif
41
42# ifndef OPENSSL_NO_DEPRECATED_3_0
43
44typedef struct SRP_gN_cache_st {
45 char *b64_bn;
46 BIGNUM *bn;
47} SRP_gN_cache;
48{-
49 generate_stack_macros("SRP_gN_cache");
50-}
51
52
53typedef struct SRP_user_pwd_st {
54 /* Owned by us. */
55 char *id;
56 BIGNUM *s;
57 BIGNUM *v;
58 /* Not owned by us. */
59 const BIGNUM *g;
60 const BIGNUM *N;
61 /* Owned by us. */
62 char *info;
63} SRP_user_pwd;
64{-
65 generate_stack_macros("SRP_user_pwd");
66-}
67
68OSSL_DEPRECATEDIN_3_0
69SRP_user_pwd *SRP_user_pwd_new(void);
70OSSL_DEPRECATEDIN_3_0
71void SRP_user_pwd_free(SRP_user_pwd *user_pwd);
72
73OSSL_DEPRECATEDIN_3_0
74void SRP_user_pwd_set_gN(SRP_user_pwd *user_pwd, const BIGNUM *g,
75 const BIGNUM *N);
76OSSL_DEPRECATEDIN_3_0
77int SRP_user_pwd_set1_ids(SRP_user_pwd *user_pwd, const char *id,
78 const char *info);
79OSSL_DEPRECATEDIN_3_0
80int SRP_user_pwd_set0_sv(SRP_user_pwd *user_pwd, BIGNUM *s, BIGNUM *v);
81
82typedef struct SRP_VBASE_st {
83 STACK_OF(SRP_user_pwd) *users_pwd;
84 STACK_OF(SRP_gN_cache) *gN_cache;
85/* to simulate a user */
86 char *seed_key;
87 const BIGNUM *default_g;
88 const BIGNUM *default_N;
89} SRP_VBASE;
90
91/*
92 * Internal structure storing N and g pair
93 */
94typedef struct SRP_gN_st {
95 char *id;
96 const BIGNUM *g;
97 const BIGNUM *N;
98} SRP_gN;
99{-
100 generate_stack_macros("SRP_gN");
101-}
102
103
104OSSL_DEPRECATEDIN_3_0
105SRP_VBASE *SRP_VBASE_new(char *seed_key);
106OSSL_DEPRECATEDIN_3_0
107void SRP_VBASE_free(SRP_VBASE *vb);
108OSSL_DEPRECATEDIN_3_0
109int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
110
111OSSL_DEPRECATEDIN_3_0
112int SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd);
113
114/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/
115OSSL_DEPRECATEDIN_3_0
116SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username);
117
118OSSL_DEPRECATEDIN_3_0
119char *SRP_create_verifier_ex(const char *user, const char *pass, char **salt,
120 char **verifier, const char *N, const char *g,
121 OSSL_LIB_CTX *libctx, const char *propq);
122OSSL_DEPRECATEDIN_3_0
123char *SRP_create_verifier(const char *user, const char *pass, char **salt,
124 char **verifier, const char *N, const char *g);
125OSSL_DEPRECATEDIN_3_0
126int SRP_create_verifier_BN_ex(const char *user, const char *pass, BIGNUM **salt,
127 BIGNUM **verifier, const BIGNUM *N,
128 const BIGNUM *g, OSSL_LIB_CTX *libctx,
129 const char *propq);
130OSSL_DEPRECATEDIN_3_0
131int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
132 BIGNUM **verifier, const BIGNUM *N,
133 const BIGNUM *g);
134
135# define SRP_NO_ERROR 0
136# define SRP_ERR_VBASE_INCOMPLETE_FILE 1
137# define SRP_ERR_VBASE_BN_LIB 2
138# define SRP_ERR_OPEN_FILE 3
139# define SRP_ERR_MEMORY 4
140
141# define DB_srptype 0
142# define DB_srpverifier 1
143# define DB_srpsalt 2
144# define DB_srpid 3
145# define DB_srpgN 4
146# define DB_srpinfo 5
147# undef DB_NUMBER
148# define DB_NUMBER 6
149
150# define DB_SRP_INDEX 'I'
151# define DB_SRP_VALID 'V'
152# define DB_SRP_REVOKED 'R'
153# define DB_SRP_MODIF 'v'
154
155/* see srp.c */
156OSSL_DEPRECATEDIN_3_0
157char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);
158OSSL_DEPRECATEDIN_3_0
159SRP_gN *SRP_get_default_gN(const char *id);
160
161/* server side .... */
162OSSL_DEPRECATEDIN_3_0
163BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u,
164 const BIGNUM *b, const BIGNUM *N);
165OSSL_DEPRECATEDIN_3_0
166BIGNUM *SRP_Calc_B_ex(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,
167 const BIGNUM *v, OSSL_LIB_CTX *libctx, const char *propq);
168OSSL_DEPRECATEDIN_3_0
169BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,
170 const BIGNUM *v);
171
172OSSL_DEPRECATEDIN_3_0
173int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N);
174OSSL_DEPRECATEDIN_3_0
175BIGNUM *SRP_Calc_u_ex(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N,
176 OSSL_LIB_CTX *libctx, const char *propq);
177OSSL_DEPRECATEDIN_3_0
178BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N);
179
180/* client side .... */
181
182OSSL_DEPRECATEDIN_3_0
183BIGNUM *SRP_Calc_x_ex(const BIGNUM *s, const char *user, const char *pass,
184 OSSL_LIB_CTX *libctx, const char *propq);
185OSSL_DEPRECATEDIN_3_0
186BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass);
187OSSL_DEPRECATEDIN_3_0
188BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g);
189OSSL_DEPRECATEDIN_3_0
190BIGNUM *SRP_Calc_client_key_ex(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
191 const BIGNUM *x, const BIGNUM *a, const BIGNUM *u,
192 OSSL_LIB_CTX *libctx, const char *propq);
193OSSL_DEPRECATEDIN_3_0
194BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
195 const BIGNUM *x, const BIGNUM *a, const BIGNUM *u);
196OSSL_DEPRECATEDIN_3_0
197int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N);
198
199# define SRP_MINIMAL_N 1024
200
201# endif /* OPENSSL_NO_DEPRECATED_3_0 */
202
203/* This method ignores the configured seed and fails for an unknown user. */
204# ifndef OPENSSL_NO_DEPRECATED_1_1_0
205OSSL_DEPRECATEDIN_1_1_0
206SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
207# endif
208
209# ifdef __cplusplus
210}
211# endif
212# endif
213
214#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette