EVP_PKEY_decrypt return value

This commit is contained in:
Takashi Kojo
2017-04-17 15:31:01 +09:00
committed by Jacob Barthelmeh
parent 47f234dce2
commit d3f4845c55

View File

@ -702,16 +702,18 @@ WOLFSSL_API int wolfSSL_EVP_PKEY_decrypt(WOLFSSL_EVP_PKEY_CTX *ctx,
(void)outlen; (void)outlen;
(void)in; (void)in;
(void)inlen; (void)inlen;
int len;
switch (ctx->pkey->type) { switch (ctx->pkey->type) {
#if !defined(NO_RSA) && !defined(HAVE_USER_RSA) #if !defined(NO_RSA) && !defined(HAVE_USER_RSA)
case EVP_PKEY_RSA: case EVP_PKEY_RSA:
*outlen = wolfSSL_RSA_private_decrypt((int)inlen, (unsigned char*)in, out, len = wolfSSL_RSA_private_decrypt((int)inlen, (unsigned char*)in, out,
ctx->pkey->rsa, ctx->padding); ctx->pkey->rsa, ctx->padding);
if(*outlen > 0) if(len < 0)return 0;
return WOLFSSL_SUCCESS; else {
else *outlen = len ;
return WOLFSSL_FAILURE; return 1;
}
#endif /* NO_RSA */ #endif /* NO_RSA */
case EVP_PKEY_EC: case EVP_PKEY_EC:
@ -735,8 +737,8 @@ WOLFSSL_API int wolfSSL_EVP_PKEY_decrypt_init(WOLFSSL_EVP_PKEY_CTX *ctx)
WOLFSSL_ENTER("EVP_PKEY_decrypt_init"); WOLFSSL_ENTER("EVP_PKEY_decrypt_init");
switch(ctx->pkey->type){ switch(ctx->pkey->type){
case EVP_PKEY_RSA: case EVP_PKEY_RSA:
ctx->op = EVP_PKEY_OP_ENCRYPT; ctx->op = EVP_PKEY_OP_DECRYPT;
return WOLFSSL_SUCCESS; return 1;
case EVP_PKEY_EC: case EVP_PKEY_EC:
WOLFSSL_MSG("not implemented"); WOLFSSL_MSG("not implemented");