/* crypto/ecdsa/ecs_locl.h */
+/*
+ * Written by Nils Larsch for the OpenSSL project
+ */
/* ====================================================================
- * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
*
*/
-#include "ecdsa.h"
-
#ifndef HEADER_ECS_LOCL_H
#define HEADER_ECS_LOCL_H
-#ifdef __cplusplus
+#include <openssl/ecdsa.h>
+
+#ifdef __cplusplus
extern "C" {
#endif
-#define OPENSSL_ECDSA_ABORT(r) { reason = (r); goto err; }
-
-/* some structures needed for the asn1 encoding */
-typedef struct x9_62_fieldid_st {
- ASN1_OBJECT *fieldType;
- ASN1_TYPE *parameters;
- } X9_62_FIELDID;
-
-typedef struct x9_62_curve_st {
- ASN1_OCTET_STRING *a;
- ASN1_OCTET_STRING *b;
- ASN1_BIT_STRING *seed;
- } X9_62_CURVE;
-
-typedef struct x9_62_ec_parameters {
- ASN1_INTEGER *version;
- X9_62_FIELDID *fieldID;
- X9_62_CURVE *curve;
- ASN1_OCTET_STRING *base;
- ASN1_INTEGER *order;
- ASN1_INTEGER *cofactor;
- } X9_62_EC_PARAMETERS;
-
-typedef struct ec_parameters {
- int type;
- union {
- ASN1_OBJECT *named_curve;
- X9_62_EC_PARAMETERS *parameters;
- ASN1_NULL *implicitlyCA;
- } value;
- } EC_PARAMETERS;
-
-typedef struct ecdsa_priv_key_st {
- int version;
- EC_PARAMETERS *parameters;
- ASN1_OBJECT *named_curve;
- ASN1_OCTET_STRING *pub_key;
- BIGNUM *priv_key;
- } ECDSAPrivateKey;
-
+struct ecdsa_method
+ {
+ const char *name;
+ ECDSA_SIG *(*ecdsa_do_sign)(const unsigned char *dgst, int dgst_len,
+ const BIGNUM *inv, const BIGNUM *rp, EC_KEY *eckey);
+ int (*ecdsa_sign_setup)(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv,
+ BIGNUM **r);
+ int (*ecdsa_do_verify)(const unsigned char *dgst, int dgst_len,
+ const ECDSA_SIG *sig, EC_KEY *eckey);
+#if 0
+ int (*init)(EC_KEY *eckey);
+ int (*finish)(EC_KEY *eckey);
+#endif
+ int flags;
+ char *app_data;
+ };
-X9_62_FIELDID *ECDSA_get_X9_62_FIELDID(const ECDSA *ecdsa, X9_62_FIELDID *field);
-X9_62_CURVE *ECDSA_get_X9_62_CURVE(const ECDSA *ecdsa, X9_62_CURVE *curve);
-X9_62_EC_PARAMETERS *ECDSA_get_X9_62_EC_PARAMETERS(const ECDSA *ecdsa, X9_62_EC_PARAMETERS *params);
-EC_PARAMETERS *ECDSA_get_EC_PARAMETERS(const ECDSA *ecdsa, EC_PARAMETERS *params);
+typedef struct ecdsa_data_st {
+ /* EC_KEY_METH_DATA part */
+ int (*init)(EC_KEY *);
+ /* method (ECDSA) specific part */
+ ENGINE *engine;
+ int flags;
+ const ECDSA_METHOD *meth;
+ CRYPTO_EX_DATA ex_data;
+} ECDSA_DATA;
-ECDSA *ECDSA_x9_62parameters2ecdsa(const X9_62_EC_PARAMETERS *params, ECDSA *ecdsa);
-ECDSA *ECDSA_ecparameters2ecdsa(const EC_PARAMETERS *params, ECDSA *ecdsa);
+/** ecdsa_check
+ * checks whether ECKEY->meth_data is a pointer to a ECDSA_DATA structure
+ * and if not it removes the old meth_data and creates a ECDSA_DATA structure.
+ * \param eckey pointer to a EC_KEY object
+ * \return pointer to a ECDSA_DATA structure
+ */
+ECDSA_DATA *ecdsa_check(EC_KEY *eckey);
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* HEADER_ECS_LOCL_H */