#endif
#ifndef OPENSSL_NO_EC
case EVP_PKEY_EC:
- if ((ret->pkey.eckey = ECPublicKey_set_octet_string(
- &(ret->pkey.eckey), (const unsigned char **)pp,
- length)) == NULL)
+ if ((ret->pkey.eckey = o2i_ECPublicKey(&(ret->pkey.eckey),
+ (const unsigned char **)pp, length)) == NULL)
{
ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB);
goto err;
#endif
#ifndef OPENSSL_NO_EC
case EVP_PKEY_EC:
- return(ECPublicKey_get_octet_string(a->pkey.eckey, pp));
+ return(i2o_ECPublicKey(a->pkey.eckey, pp));
#endif
default:
ASN1err(ASN1_F_I2D_PUBLICKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
/* EC_KEY_check_key() */
int EC_KEY_check_key(const EC_KEY *);
-/* de- and encode functions for the SEC1 ECPrivateKey */
+/* de- and encoding functions for SEC1 ECPrivateKey */
EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len);
int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out);
-/* de- and encode functions for the elliptic curve parameters */
+/* de- and encoding functions for EC parameters */
EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len);
int i2d_ECParameters(EC_KEY *a, unsigned char **out);
-
-EC_KEY *ECPublicKey_set_octet_string(EC_KEY **a, const unsigned char **in,
- long len);
-int ECPublicKey_get_octet_string(EC_KEY *a, unsigned char **out);
+/* de- and encoding functions for EC public key
+ * (octet string, not DER -- hence 'o2i' and 'i2o') */
+EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len);
+int i2o_ECPublicKey(EC_KEY *a, unsigned char **out);
#ifndef OPENSSL_NO_BIO
int ECParameters_print(BIO *bp, const EC_KEY *x);
#define EC_F_ECPARAMETERS_PRINT_FP 148
#define EC_F_ECPKPARAMETERS_PRINT 149
#define EC_F_ECPKPARAMETERS_PRINT_FP 150
-#define EC_F_ECPUBLICKEY_GET_OCTET 151
-#define EC_F_ECPUBLICKEY_SET_OCTET 152
#define EC_F_ECP_NIST_MOD_192 203
#define EC_F_ECP_NIST_MOD_224 204
#define EC_F_ECP_NIST_MOD_256 205
#define EC_F_I2D_ECPARAMETERS 190
#define EC_F_I2D_ECPKPARAMETERS 191
#define EC_F_I2D_ECPRIVATEKEY 192
+#define EC_F_I2O_ECPUBLICKEY 151
+#define EC_F_O2I_ECPUBLICKEY 152
/* Reason codes. */
#define EC_R_ASN1_ERROR 115
return ret;
}
-EC_KEY *ECPublicKey_set_octet_string(EC_KEY **a, const unsigned char **in,
- long len)
+EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len)
{
EC_KEY *ret=NULL;
{
/* sorry, but a EC_GROUP-structur is necessary
* to set the public key */
- ECerr(EC_F_ECPUBLICKEY_SET_OCTET, ERR_R_PASSED_NULL_PARAMETER);
+ ECerr(EC_F_O2I_ECPUBLICKEY, ERR_R_PASSED_NULL_PARAMETER);
return 0;
}
ret = *a;
if (ret->pub_key == NULL &&
(ret->pub_key = EC_POINT_new(ret->group)) == NULL)
{
- ECerr(EC_F_ECPUBLICKEY_SET_OCTET, ERR_R_MALLOC_FAILURE);
+ ECerr(EC_F_O2I_ECPUBLICKEY, ERR_R_MALLOC_FAILURE);
return 0;
}
if (!EC_POINT_oct2point(ret->group, ret->pub_key, *in, len, NULL))
{
- ECerr(EC_F_ECPUBLICKEY_SET_OCTET, ERR_R_EC_LIB);
+ ECerr(EC_F_O2I_ECPUBLICKEY, ERR_R_EC_LIB);
return 0;
}
/* save the point conversion form */
ret->conv_form = (point_conversion_form_t)(*in[0] & ~0x01);
+ *in += len;
return ret;
}
-int ECPublicKey_get_octet_string(EC_KEY *a, unsigned char **out)
+int i2o_ECPublicKey(EC_KEY *a, unsigned char **out)
{
size_t buf_len=0;
if (a == NULL)
{
- ECerr(EC_F_ECPUBLICKEY_GET_OCTET, ERR_R_PASSED_NULL_PARAMETER);
+ ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_PASSED_NULL_PARAMETER);
return 0;
}
if (*out == NULL)
if ((*out = OPENSSL_malloc(buf_len)) == NULL)
{
- ECerr(EC_F_ECPUBLICKEY_GET_OCTET,
- ERR_R_MALLOC_FAILURE);
+ ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_MALLOC_FAILURE);
return 0;
}
if (!EC_POINT_point2oct(a->group, a->pub_key, a->conv_form,
*out, buf_len, NULL))
{
- ECerr(EC_F_ECPUBLICKEY_GET_OCTET, ERR_R_EC_LIB);
+ ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_EC_LIB);
OPENSSL_free(*out);
*out = NULL;
return 0;
}
+ *out += buf_len;
return buf_len;
}
{ERR_PACK(0,EC_F_ECPARAMETERS_PRINT_FP,0), "ECParameters_print_fp"},
{ERR_PACK(0,EC_F_ECPKPARAMETERS_PRINT,0), "ECPKParameters_print"},
{ERR_PACK(0,EC_F_ECPKPARAMETERS_PRINT_FP,0), "ECPKParameters_print_fp"},
-{ERR_PACK(0,EC_F_ECPUBLICKEY_GET_OCTET,0), "ECPUBLICKEY_GET_OCTET"},
-{ERR_PACK(0,EC_F_ECPUBLICKEY_SET_OCTET,0), "ECPUBLICKEY_SET_OCTET"},
{ERR_PACK(0,EC_F_ECP_NIST_MOD_192,0), "ECP_NIST_MOD_192"},
{ERR_PACK(0,EC_F_ECP_NIST_MOD_224,0), "ECP_NIST_MOD_224"},
{ERR_PACK(0,EC_F_ECP_NIST_MOD_256,0), "ECP_NIST_MOD_256"},
{ERR_PACK(0,EC_F_I2D_ECPARAMETERS,0), "i2d_ECParameters"},
{ERR_PACK(0,EC_F_I2D_ECPKPARAMETERS,0), "i2d_ECPKParameters"},
{ERR_PACK(0,EC_F_I2D_ECPRIVATEKEY,0), "i2d_ECPrivateKey"},
+{ERR_PACK(0,EC_F_I2O_ECPUBLICKEY,0), "i2o_ECPublicKey"},
+{ERR_PACK(0,EC_F_O2I_ECPUBLICKEY,0), "o2i_ECPublicKey"},
{0,NULL}
};
EC_GROUP_set_seed 3310 EXIST::FUNCTION:EC
EC_GROUP_get_curve_GF2m 3311 EXIST::FUNCTION:EC
PEM_read_X509_CERT_PAIR 3312 EXIST:!WIN16:FUNCTION:
-ECPublicKey_set_octet_string 3313 EXIST::FUNCTION:EC
+o2i_ECPublicKey 3313 EXIST::FUNCTION:EC
ECDSA_get_ex_data 3314 EXIST::FUNCTION:ECDSA
BN_GF2m_mod 3315 EXIST::FUNCTION:
EC_GROUP_get_seed_len 3316 EXIST::FUNCTION:EC
ECDH_set_default_method 3329 EXIST::FUNCTION:ECDH
EC_KEY_generate_key 3330 EXIST::FUNCTION:EC
BN_GF2m_arr2poly 3331 EXIST::FUNCTION:
-ECPublicKey_get_octet_string 3332 EXIST::FUNCTION:EC
+i2o_ECPublicKey 3332 EXIST::FUNCTION:EC
EC_GROUP_check 3333 EXIST::FUNCTION:EC
d2i_ECPrivateKey_bio 3334 EXIST::FUNCTION:BIO,EC
d2i_ECPrivateKey 3335 EXIST::FUNCTION:EC