source: EcnlProtoTool/trunk/openssl-1.1.0e/include/openssl/srp.h@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

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