strsep implementation to allow the file to compile on non-BSD systems
[openssl.git] / crypto / evp / p_seal.c
index 47efc0d3d880d7b810816e003a9591f106e8200b..ff16370994f960eaaabf966eaa2e1e13c8a73e48 100644 (file)
@@ -59,7 +59,7 @@
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/rand.h>
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
 #include <openssl/rsa.h>
 #endif
 #include <openssl/evp.h>
@@ -72,11 +72,11 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek,
        unsigned char key[EVP_MAX_KEY_LENGTH];
        int i;
        
-       if (npubk <= 0) return(0);
        if(type) {
                EVP_CIPHER_CTX_init(ctx);
-               EVP_EncryptInit(ctx,type,NULL,NULL);
+               if(!EVP_EncryptInit(ctx,type,NULL,NULL)) return 0;
        }
+       if (npubk <= 0) return(0);
        if (RAND_bytes(key,EVP_MAX_KEY_LENGTH) <= 0)
                return(0);
        if (EVP_CIPHER_CTX_iv_length(ctx))