Merge pull request #541 from pattop/fixes

Minor dependency cleanups
This commit is contained in:
Steffen Jaeckel 2020-08-16 15:13:27 +02:00 committed by GitHub
commit 3f1b6877c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 4 deletions

View File

@ -585,6 +585,22 @@
#define LTC_PBES #define LTC_PBES
#endif #endif
#if defined(LTC_PBES) && !defined(LTC_PKCS_5)
#error LTC_PBES requires LTC_PKCS_5
#endif
#if defined(LTC_PBES) && !defined(LTC_PKCS_12)
#error LTC_PBES requires LTC_PKCS_12
#endif
#if defined(LTC_PKCS_5) && !defined(LTC_HMAC)
#error LTC_PKCS_5 requires LTC_HMAC
#endif
#if defined(LTC_PKCS_5) && !defined(LTC_HASH_HELPERS)
#error LTC_PKCS_5 requires LTC_HASH_HELPERS
#endif
#if defined(LTC_PELICAN) && !defined(LTC_RIJNDAEL) #if defined(LTC_PELICAN) && !defined(LTC_RIJNDAEL)
#error Pelican-MAC requires LTC_RIJNDAEL #error Pelican-MAC requires LTC_RIJNDAEL
#endif #endif

View File

@ -39,8 +39,9 @@ int x509_decode_public_key_from_certificate(const unsigned char *in, unsigned lo
unsigned long tmpbuf_len, tmp_inlen; unsigned long tmpbuf_len, tmp_inlen;
ltc_asn1_list *decoded_list = NULL, *l; ltc_asn1_list *decoded_list = NULL, *l;
LTC_ARGCHK(in != NULL); LTC_ARGCHK(in != NULL);
LTC_ARGCHK(inlen != 0); LTC_ARGCHK(inlen != 0);
LTC_ARGCHK(callback != NULL);
tmpbuf_len = inlen; tmpbuf_len = inlen;
tmpbuf = XCALLOC(1, tmpbuf_len); tmpbuf = XCALLOC(1, tmpbuf_len);
@ -81,7 +82,7 @@ int x509_decode_public_key_from_certificate(const unsigned char *in, unsigned lo
&& (l->data != NULL) && (l->data != NULL)
&& LOOKS_LIKE_SPKI(l->child)) { && LOOKS_LIKE_SPKI(l->child)) {
if (algorithm == PKA_EC) { if (algorithm == PKA_EC) {
err = ecc_import_subject_public_key_info(l->data, l->size, ctx); err = callback(l->data, l->size, ctx);
} else { } else {
err = x509_decode_subject_public_key_info(l->data, l->size, err = x509_decode_subject_public_key_info(l->data, l->size,
algorithm, tmpbuf, &tmpbuf_len, algorithm, tmpbuf, &tmpbuf_len,

View File

@ -106,7 +106,10 @@ success:
*/ */
int ecc_import_x509(const unsigned char *in, unsigned long inlen, ecc_key *key) int ecc_import_x509(const unsigned char *in, unsigned long inlen, ecc_key *key)
{ {
return x509_decode_public_key_from_certificate(in, inlen, PKA_EC, LTC_ASN1_EOL, NULL, NULL, NULL, key); return x509_decode_public_key_from_certificate(in, inlen,
PKA_EC,
LTC_ASN1_EOL, NULL, NULL,
(public_key_decode_cb)ecc_import_subject_public_key_info, key);
} }
#endif /* LTC_MECC */ #endif /* LTC_MECC */

View File

@ -8,6 +8,8 @@
Russ Williams Russ Williams
*/ */
#ifdef LTC_SSH
/** /**
Curve/OID to SSH+ECDSA name string mapping Curve/OID to SSH+ECDSA name string mapping
@param buffer [out] The destination for the name @param buffer [out] The destination for the name
@ -60,3 +62,4 @@ error:
return err; return err;
} }
#endif