From d8a6f7cfbe2b506e5c571022bbe620b7a30f6796 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Fri, 22 Sep 2017 16:05:43 +0100 Subject: [PATCH] Clarify code-paths in x509write_csr and x509write_crt --- library/x509write_crt.c | 2 +- library/x509write_csr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/x509write_crt.c b/library/x509write_crt.c index e8d5cbdbf..0af23d7fa 100644 --- a/library/x509write_crt.c +++ b/library/x509write_crt.c @@ -321,7 +321,7 @@ int mbedtls_x509write_crt_der( mbedtls_x509write_cert *ctx, unsigned char *buf, else if( mbedtls_pk_can_do( ctx->issuer_key, MBEDTLS_PK_ECDSA ) ) pk_alg = MBEDTLS_PK_ECDSA; else - pk_alg = MBEDTLS_PK_NONE; + return( MBEDTLS_ERR_X509_INVALID_ALG ); if( ( ret = mbedtls_oid_get_oid_by_sig_alg( pk_alg, ctx->md_alg, &sig_oid, &sig_oid_len ) ) != 0 ) diff --git a/library/x509write_csr.c b/library/x509write_csr.c index da40eb5c1..e80053828 100644 --- a/library/x509write_csr.c +++ b/library/x509write_csr.c @@ -205,7 +205,7 @@ int mbedtls_x509write_csr_der( mbedtls_x509write_csr *ctx, unsigned char *buf, s else if( mbedtls_pk_can_do( ctx->key, MBEDTLS_PK_ECDSA ) ) pk_alg = MBEDTLS_PK_ECDSA; else - pk_alg = MBEDTLS_PK_NONE; + return( MBEDTLS_ERR_X509_INVALID_ALG ); if( ( ret = mbedtls_oid_get_oid_by_sig_alg( pk_alg, ctx->md_alg, &sig_oid, &sig_oid_len ) ) != 0 )