VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1k/include/openssl/srp.h@ 90880

最後變更 在這個檔案從90880是 90293,由 vboxsync 提交於 4 年 前

openssl-1.1.1k: Applied and adjusted our OpenSSL changes to 1.1.1k. bugref:10072

檔案大小: 3.7 KB
 
1/*
2 * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright (c) 2004, EdelKey Project. All Rights Reserved.
4 *
5 * Licensed under the OpenSSL license (the "License"). You may not use
6 * this file except in compliance with the License. You can obtain a copy
7 * in the file LICENSE in the source distribution or at
8 * https://www.openssl.org/source/license.html
9 *
10 * Originally written by Christophe Renou and Peter Sylvester,
11 * for the EdelKey project.
12 */
13
14#ifndef HEADER_SRP_H
15# define HEADER_SRP_H
16
17#include <openssl/opensslconf.h>
18
19#ifndef OPENSSL_NO_SRP
20# include <stdio.h>
21# include <string.h>
22# include <openssl/safestack.h>
23# include <openssl/bn.h>
24# include <openssl/crypto.h>
25
26# ifdef __cplusplus
27extern "C" {
28# endif
29
30typedef struct SRP_gN_cache_st {
31 char *b64_bn;
32 BIGNUM *bn;
33} SRP_gN_cache;
34
35
36DEFINE_STACK_OF(SRP_gN_cache)
37
38typedef struct SRP_user_pwd_st {
39 /* Owned by us. */
40 char *id;
41 BIGNUM *s;
42 BIGNUM *v;
43 /* Not owned by us. */
44 const BIGNUM *g;
45 const BIGNUM *N;
46 /* Owned by us. */
47 char *info;
48} SRP_user_pwd;
49
50void SRP_user_pwd_free(SRP_user_pwd *user_pwd);
51
52DEFINE_STACK_OF(SRP_user_pwd)
53
54typedef struct SRP_VBASE_st {
55 STACK_OF(SRP_user_pwd) *users_pwd;
56 STACK_OF(SRP_gN_cache) *gN_cache;
57/* to simulate a user */
58 char *seed_key;
59 const BIGNUM *default_g;
60 const BIGNUM *default_N;
61} SRP_VBASE;
62
63/*
64 * Internal structure storing N and g pair
65 */
66typedef struct SRP_gN_st {
67 char *id;
68 const BIGNUM *g;
69 const BIGNUM *N;
70} SRP_gN;
71
72DEFINE_STACK_OF(SRP_gN)
73
74SRP_VBASE *SRP_VBASE_new(char *seed_key);
75void SRP_VBASE_free(SRP_VBASE *vb);
76int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
77
78/* This method ignores the configured seed and fails for an unknown user. */
79DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username))
80/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/
81SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username);
82
83char *SRP_create_verifier(const char *user, const char *pass, char **salt,
84 char **verifier, const char *N, const char *g);
85int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
86 BIGNUM **verifier, const BIGNUM *N,
87 const BIGNUM *g);
88
89# define SRP_NO_ERROR 0
90# define SRP_ERR_VBASE_INCOMPLETE_FILE 1
91# define SRP_ERR_VBASE_BN_LIB 2
92# define SRP_ERR_OPEN_FILE 3
93# define SRP_ERR_MEMORY 4
94
95# define DB_srptype 0
96# define DB_srpverifier 1
97# define DB_srpsalt 2
98# define DB_srpid 3
99# define DB_srpgN 4
100# define DB_srpinfo 5
101# undef DB_NUMBER
102# define DB_NUMBER 6
103
104# define DB_SRP_INDEX 'I'
105# define DB_SRP_VALID 'V'
106# define DB_SRP_REVOKED 'R'
107# define DB_SRP_MODIF 'v'
108
109/* see srp.c */
110char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);
111SRP_gN *SRP_get_default_gN(const char *id);
112
113/* server side .... */
114BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u,
115 const BIGNUM *b, const BIGNUM *N);
116BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,
117 const BIGNUM *v);
118int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N);
119BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N);
120
121/* client side .... */
122BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass);
123BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g);
124BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
125 const BIGNUM *x, const BIGNUM *a, const BIGNUM *u);
126int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N);
127
128# define SRP_MINIMAL_N 1024
129
130# ifdef __cplusplus
131}
132# endif
133# endif
134
135#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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