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)in;
(void)inlen;
int len;
switch (ctx->pkey->type) {
#if !defined(NO_RSA) && !defined(HAVE_USER_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);
if(*outlen > 0)
return WOLFSSL_SUCCESS;
else
return WOLFSSL_FAILURE;
if(len < 0)return 0;
else {
*outlen = len ;
return 1;
}
#endif /* NO_RSA */
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");
switch(ctx->pkey->type){
case EVP_PKEY_RSA:
ctx->op = EVP_PKEY_OP_ENCRYPT;
return WOLFSSL_SUCCESS;
ctx->op = EVP_PKEY_OP_DECRYPT;
return 1;
case EVP_PKEY_EC:
WOLFSSL_MSG("not implemented");