summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-08-26 05:59:42 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-08-26 05:59:42 +0200
commit3bb0b9f4ea46431189b2cae2a6c2887f786d822a (patch)
tree27f64b689238ce40c0428cf6871418de6f7df84a /sys/include
parent844bbecadb3a4263a183ce03021849ac41cbd20f (diff)
libsec: add q parameter to dh_new() for subgroup support, sanitize dh parameters
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/libsec.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/include/libsec.h b/sys/include/libsec.h
index 60f25f944..e4d80bd4b 100644
--- a/sys/include/libsec.h
+++ b/sys/include/libsec.h
@@ -447,15 +447,16 @@ struct DHstate
{
mpint *g; /* base g */
mpint *p; /* large prime */
+ mpint *q; /* subgroup prime */
mpint *x; /* random secret */
- mpint *y; /* public key y = g ^ x % p */
+ mpint *y; /* public key y = g**x % p */
};
-/* generate new public key: y = g ^ x % p */
-mpint* dh_new(DHstate *dh, mpint *p, mpint *g);
+/* generate new public key: y = g**x % p */
+mpint* dh_new(DHstate *dh, mpint *p, mpint *q, mpint *g);
-/* calculate shared key: k = pub ^ x % p */
-mpint* dh_finish(DHstate *dh, mpint *pub);
+/* calculate shared key: k = y**x % p */
+mpint* dh_finish(DHstate *dh, mpint *y);
/* password-based key derivation function 2 (RFC 2898) */
void pbkdf2_hmac_sha1(uchar *p, ulong plen, uchar *s, ulong slen, ulong rounds, uchar *d, ulong dlen);