-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add eckey_t #93
base: master
Are you sure you want to change the base?
Changes from 10 commits
95be68c
ed2be92
1eab41d
893d9cf
abeff7a
e0d24e9
3b579de
48f04db
f412dad
afb973c
a590f55
daba796
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
#pragma once | ||
|
||
#include <stdbool.h> | ||
#include <cn-cbor/cn-cbor.h> | ||
#include "cose/cose_configure.h" | ||
|
||
#if defined(COSE_C_USE_MBEDTLS) | ||
#include "mbedtls/ecp.h" | ||
#endif // COSE_C_USE_MBEDTLS | ||
|
||
#include <stdbool.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
@@ -203,6 +208,16 @@ typedef enum { | |
COSE_Curve_Ed448 = 7, | ||
} COSE_Curves; | ||
|
||
|
||
#if defined(COSE_C_USE_MBEDTLS) | ||
typedef struct mbedtls_ecp_keypair eckey_t; | ||
#else | ||
typedef struct eckey_t { | ||
struct ec_key_st *key; | ||
int group; | ||
} eckey_t; | ||
#endif // COSE_C_USE_MBEDTLS | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As noted in the other pull request, this is not the way that I think this should go in the end. It would be better to declare a COSE_Key structure and have a method to build that. This can this be changed internal to the library without issues as well as adding some other types of keys. If you are doing this, please just make this specific to MBEDTLS as passing in the structure is not how one would do this for OpenSSL, instead you would pass in an EVP_KEY *. I don't know what the current support is in MBEDTLS for TEMs at the moment. I would expect that at some point in the future this is going to be added if not currently present and that would require yet a different possible internal change for that support. |
||
/* | ||
* messages dealing with the Enveloped message type | ||
*/ | ||
|
@@ -344,7 +359,7 @@ bool COSE_Signer_SetExternal(HCOSE_SIGNER hcose, const byte * pbExternalData, si | |
#define COSE_Sign0_map_get_int COSE_Sign1_map_get_int | ||
#define COSE_Sign0_map_put_int COSE_Sign1_map_put_int | ||
|
||
|
||
HCOSE_SIGN1 COSE_Sign1_Init(COSE_INIT_FLAGS flags, CBOR_CONTEXT_COMMA cose_errback * perr); | ||
bool COSE_Sign1_Free(HCOSE_SIGN1 cose); | ||
|
||
|
@@ -353,6 +368,8 @@ bool COSE_Sign1_SetExternal(HCOSE_SIGN1 hcose, const byte * pbExternalData, size | |
|
||
bool COSE_Sign1_Sign(HCOSE_SIGN1 h, const cn_cbor * pkey, cose_errback * perr); | ||
bool COSE_Sign1_validate(HCOSE_SIGN1 hSign, const cn_cbor * pkey, cose_errback * perr); | ||
bool COSE_Sign1_Sign_eckey(HCOSE_SIGN1 h, const eckey_t * pbKey, cose_errback * perr); | ||
bool COSE_Sign1_validate_eckey(HCOSE_SIGN1 hSign, const eckey_t * pbKey, cose_errback * perr); | ||
cn_cbor * COSE_Sign1_map_get_int(HCOSE_SIGN1 h, int key, int flags, cose_errback * perror); | ||
bool COSE_Sign1_map_put_int(HCOSE_SIGN1 cose, int key, cn_cbor * value, int flags, cose_errback * errp); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure where this came from. I would expect it to be an EVP_KEY*