projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added SILC Server library.
[silc.git]
/
lib
/
silcske
/
groups.c
diff --git
a/lib/silcske/groups.c
b/lib/silcske/groups.c
index 0c83343dc4b945aea813b00f31b9448c6392eadf..992779123a54c0f85663fa53b216738d02fd26cb 100644
(file)
--- a/
lib/silcske/groups.c
+++ b/
lib/silcske/groups.c
@@
-8,8
+8,7
@@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-19,7
+18,7
@@
*/
/* $Id$ */
*/
/* $Id$ */
-#include "silc
includes
.h"
+#include "silc.h"
#include "groups_internal.h"
/* Fixed and public Diffie Hellman Groups defined by the SKE
#include "groups_internal.h"
/* Fixed and public Diffie Hellman Groups defined by the SKE
@@
-72,7
+71,7
@@
const struct SilcSKEDiffieHellmanGroupDefStruct silc_ske_groups[] =
/* Returns Diffie Hellman group by group number */
/* Returns Diffie Hellman group by group number */
-SilcSKEStatus silc_ske_g
et_group
_by_number(int number,
+SilcSKEStatus silc_ske_g
roup_get
_by_number(int number,
SilcSKEDiffieHellmanGroup *ret)
{
int i;
SilcSKEDiffieHellmanGroup *ret)
{
int i;
@@
-83,8
+82,10
@@
SilcSKEStatus silc_ske_get_group_by_number(int number,
break;
}
break;
}
- if (silc_ske_groups[i].name == NULL)
+ if (silc_ske_groups[i].name == NULL) {
+ SILC_LOG_ERROR(("Unsupported Diffie-Hellman group number %d", number));
return SILC_SKE_STATUS_UNKNOWN_GROUP;
return SILC_SKE_STATUS_UNKNOWN_GROUP;
+ }
/* Return the group */
if (ret) {
/* Return the group */
if (ret) {
@@
-106,7
+107,7
@@
SilcSKEStatus silc_ske_get_group_by_number(int number,
/* Returns Diffie Hellman group by name */
/* Returns Diffie Hellman group by name */
-SilcSKEStatus silc_ske_g
et_group
_by_name(const char *name,
+SilcSKEStatus silc_ske_g
roup_get
_by_name(const char *name,
SilcSKEDiffieHellmanGroup *ret)
{
int i;
SilcSKEDiffieHellmanGroup *ret)
{
int i;
@@
-117,8
+118,10
@@
SilcSKEStatus silc_ske_get_group_by_name(const char *name,
break;
}
break;
}
- if (silc_ske_groups[i].name == NULL)
+ if (silc_ske_groups[i].name == NULL) {
+ SILC_LOG_ERROR(("Unsupported Diffie-Hellman group `%s'", name));
return SILC_SKE_STATUS_UNKNOWN_GROUP;
return SILC_SKE_STATUS_UNKNOWN_GROUP;
+ }
/* Return the group */
if (ret) {
/* Return the group */
if (ret) {
@@
-138,6
+141,16
@@
SilcSKEStatus silc_ske_get_group_by_name(const char *name,
return SILC_SKE_STATUS_OK;
}
return SILC_SKE_STATUS_OK;
}
+/* Free group */
+
+void silc_ske_group_free(SilcSKEDiffieHellmanGroup group)
+{
+ silc_mp_uninit(&group->group);
+ silc_mp_uninit(&group->group_order);
+ silc_mp_uninit(&group->generator);
+ silc_free(group);
+}
+
/* Returns comma separated list of supported groups */
char *silc_ske_get_supported_groups()
/* Returns comma separated list of supported groups */
char *silc_ske_get_supported_groups()
@@
-167,3
+180,10
@@
int silc_ske_group_get_number(SilcSKEDiffieHellmanGroup group)
{
return group->number;
}
{
return group->number;
}
+
+/* Returns the name of the `group'. */
+
+const char *silc_ske_group_get_name(SilcSKEDiffieHellmanGroup group)
+{
+ return group->name;
+}