summaryrefslogtreecommitdiffstats
path: root/crypto/srp
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2012-06-04 00:00:21 +0200
committerBen Laurie <ben@openssl.org>2012-06-04 00:00:21 +0200
commit71fa451343f97b3624374ed1359adc23fba5696e (patch)
tree87ebfb43ece32507c68e360f36a67b4a921e79c0 /crypto/srp
parentRFC 5878 support. (diff)
downloadopenssl-71fa451343f97b3624374ed1359adc23fba5696e.tar.xz
openssl-71fa451343f97b3624374ed1359adc23fba5696e.zip
Version skew reduction: trivia (I hope).
Diffstat (limited to 'crypto/srp')
-rw-r--r--crypto/srp/srp_lib.c12
-rw-r--r--crypto/srp/srp_vfy.c30
2 files changed, 20 insertions, 22 deletions
diff --git a/crypto/srp/srp_lib.c b/crypto/srp/srp_lib.c
index 8eacf04534..db87899f05 100644
--- a/crypto/srp/srp_lib.c
+++ b/crypto/srp/srp_lib.c
@@ -328,7 +328,7 @@ int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N)
/* Check if G and N are kwown parameters.
The values have been generated from the ietf-tls-srp draft version 8
*/
-char * SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N)
+char * SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N)
{
size_t i;
if ((g == NULL) || (N == NULL))
@@ -339,22 +339,22 @@ char * SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N)
for(i = 0; i < KNOWN_GN_NUMBER; i++)
{
- if (BN_cmp(knowngN[i].g,g) == 0 && BN_cmp(knowngN[i].N,N) == 0)
+ if (BN_cmp(knowngN[i].g, g) == 0 && BN_cmp(knowngN[i].N, N) == 0)
return knowngN[i].id;
}
return NULL;
}
-SRP_gN *SRP_get_default_gN(const char * id)
+SRP_gN *SRP_get_default_gN(const char *id)
{
- size_t i;
+ size_t i;
if (id == NULL)
return knowngN;
for(i = 0; i < KNOWN_GN_NUMBER; i++)
{
- if (strcmp(knowngN[i].id,id)==0)
- return knowngN+i;
+ if (strcmp(knowngN[i].id, id)==0)
+ return knowngN + i;
}
return NULL;
}
diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c
index ba3dca074e..6889a6bded 100644
--- a/crypto/srp/srp_vfy.c
+++ b/crypto/srp/srp_vfy.c
@@ -84,7 +84,7 @@ static int t_fromb64(unsigned char *a, const char *src)
while(*src && (*src == ' ' || *src == '\t' || *src == '\n'))
++src;
- size = strlen((const char *)src);
+ size = strlen(src);
i = 0;
while(i < size)
{
@@ -190,9 +190,9 @@ static void SRP_user_pwd_free(SRP_user_pwd *user_pwd)
OPENSSL_free(user_pwd);
}
-static SRP_user_pwd * SRP_user_pwd_new(void)
+static SRP_user_pwd *SRP_user_pwd_new(void)
{
- SRP_user_pwd * ret = OPENSSL_malloc(sizeof(SRP_user_pwd));
+ SRP_user_pwd *ret = OPENSSL_malloc(sizeof(SRP_user_pwd));
if (ret == NULL)
return NULL;
ret->N = NULL;
@@ -222,7 +222,7 @@ static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
const char *v)
{
- unsigned char tmp[MAX_LEN];
+ unsigned char tmp[MAX_LEN];
int len;
if (strlen(s) > MAX_LEN || strlen(v) > MAX_LEN)
@@ -234,7 +234,7 @@ static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
return ((vinfo->s = BN_bin2bn(tmp, len, NULL)) != NULL) ;
}
-static int SRP_user_pwd_set_sv_BN(SRP_user_pwd * vinfo, BIGNUM * s, BIGNUM * v)
+static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v)
{
vinfo->v = v;
vinfo->s = s;
@@ -388,9 +388,9 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
{
last_index = SRP_get_default_gN(NULL)->id;
}
- for (i=0; i < sk_OPENSSL_PSTRING_num(tmpdb->data); i++)
+ for (i = 0; i < sk_OPENSSL_PSTRING_num(tmpdb->data); i++)
{
- pp=sk_OPENSSL_PSTRING_value(tmpdb->data,i);
+ pp = sk_OPENSSL_PSTRING_value(tmpdb->data,i);
if (pp[DB_srptype][0] == DB_SRP_INDEX)
{
/*we add this couple in the internal Stack */
@@ -422,16 +422,14 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
goto err;
SRP_user_pwd_set_gN(user_pwd,lgN->g,lgN->N);
- if (!SRP_user_pwd_set_ids(user_pwd, pp[DB_srpid],
- pp[DB_srpinfo]))
+ if (!SRP_user_pwd_set_ids(user_pwd, pp[DB_srpid],pp[DB_srpinfo]))
goto err;
error_code = SRP_ERR_VBASE_BN_LIB;
- if (!SRP_user_pwd_set_sv(user_pwd, pp[DB_srpsalt],
- pp[DB_srpverifier]))
+ if (!SRP_user_pwd_set_sv(user_pwd, pp[DB_srpsalt],pp[DB_srpverifier]))
goto err;
- if (sk_SRP_user_pwd_insert(vb->users_pwd,user_pwd,0) == 0)
+ if (sk_SRP_user_pwd_insert(vb->users_pwd, user_pwd, 0) == 0)
goto err;
user_pwd = NULL; /* abandon responsability */
}
@@ -543,7 +541,7 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt,
if (N)
{
if (!(len = t_fromb64(tmp, N))) goto err;
- N_bn = BN_bin2bn(tmp,len,NULL);
+ N_bn = BN_bin2bn(tmp, len, NULL);
if (!(len = t_fromb64(tmp, g))) goto err;
g_bn = BN_bin2bn(tmp, len, NULL);
defgNid = "*";
@@ -568,7 +566,7 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt,
{
if (!(len = t_fromb64(tmp2, *salt)))
goto err;
- s = BN_bin2bn(tmp2,len,NULL);
+ s = BN_bin2bn(tmp2, len, NULL);
}
@@ -584,12 +582,12 @@ char *SRP_create_verifier(const char *user, const char *pass, char **salt,
{
char *tmp_salt;
- if ((tmp_salt = OPENSSL_malloc(SRP_RANDOM_SALT_LEN*2)) == NULL)
+ if ((tmp_salt = OPENSSL_malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL)
{
OPENSSL_free(vf);
goto err;
}
- t_tob64(tmp_salt,tmp2,SRP_RANDOM_SALT_LEN);
+ t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN);
*salt = tmp_salt;
}