pike.git
/
src
/
post_modules
/
Nettle
/
hogweed.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/post_modules/Nettle/hogweed.cmod:444:
c = (struct Nettle_ECC_Curve_struct *) (PIKE_OBJ_STORAGE(x->u.object) + INHERIT_FROM_INT(x->u.object->prog, SUBTYPEOF(*x))->storage_offset + Nettle_ECC_Curve_storage_offset); RETURN c->curve == THIS->curve; } /*! @decl string(7bit) name() *! *! Returns the name of the curve.
+
*!
+
*! @seealso
+
*! @[jose_name()]
*/ PIKEFUN string(7bit) name() { #ifdef HAVE_CURVE_NETTLE_SECP_192R1 if (THIS->curve == &nettle_secp_192r1) { ref_push_string(MK_STRING("SECP_192R1")); return; } #endif /* HAVE_CURVE_NETTLE_SECP_192R1 */ #ifdef HAVE_CURVE_NETTLE_SECP_224R1
pike.git/src/post_modules/Nettle/hogweed.cmod:480:
#endif /* HAVE_CURVE_NETTLE_SECP_384R1 */ #ifdef HAVE_CURVE_NETTLE_SECP_521R1 if (THIS->curve == &nettle_secp_521r1) { ref_push_string(MK_STRING("SECP_521R1")); return; } #endif /* HAVE_CURVE_NETTLE_SECP_521R1 */ ref_push_string(MK_STRING("UNKNOWN")); }
+
/*! @decl string(7bit) jose_name()
+
*!
+
*! Returns the name of the curve according to JOSE
+
*! (@rfc{7518:6.2.1.1@}).
+
*!
+
*! @returns
+
*! Returns the JOSE name for supported curves,
+
*! and @[UNDEFINED] otherwise.
+
*!
+
*! @seealso
+
*! @[name()]
+
*/
+
PIKEFUN string(7bit) jose_name()
+
{
+
#ifdef HAVE_CURVE_NETTLE_SECP_256R1
+
if (THIS->curve == &nettle_secp_256r1) {
+
ref_push_string(MK_STRING("P-256R"));
+
return;
+
}
+
#endif /* HAVE_CURVE_NETTLE_SECP_256R1 */
+
#ifdef HAVE_CURVE_NETTLE_SECP_384R1
+
if (THIS->curve == &nettle_secp_384r1) {
+
ref_push_string(MK_STRING("P-384"));
+
return;
+
}
+
#endif /* HAVE_CURVE_NETTLE_SECP_384R1 */
+
#ifdef HAVE_CURVE_NETTLE_SECP_521R1
+
if (THIS->curve == &nettle_secp_521r1) {
+
ref_push_string(MK_STRING("P-521"));
+
return;
+
}
+
#endif /* HAVE_CURVE_NETTLE_SECP_521R1 */
+
push_undefined();
+
}
+
/*! @decl int size() *! *! @returns *! Returns the size in bits for a single coordinate on the curve. */ PIKEFUN int size() { #ifdef HAVE_NETTLE_ECC_BIT_SIZE push_int(ecc_bit_size(THIS->curve)); #else