Typo
[openssl.git] / crypto / evp / p_seal.c
index ba2dd657aba8e639a91cf227f82104690258399f..8cc8fcb0bd058e4c4022fdceefde0e0c2e5e379f 100644 (file)
@@ -76,9 +76,10 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek
                EVP_CIPHER_CTX_init(ctx);
                if(!EVP_EncryptInit_ex(ctx,type,NULL,NULL,NULL)) return 0;
        }
-       if (npubk <= 0) return(0);
-       if (RAND_bytes(key,EVP_MAX_KEY_LENGTH) <= 0)
-               return(0);
+       if ((npubk <= 0) || !pubk)
+               return 1;
+       if (EVP_CIPHER_CTX_rand_key(ctx, key) <= 0)
+               return 0;
        if (EVP_CIPHER_CTX_iv_length(ctx))
                RAND_pseudo_bytes(iv,EVP_CIPHER_CTX_iv_length(ctx));
 
@@ -105,8 +106,10 @@ int inl;
        }
 */
 
-void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
+int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
        {
-       EVP_EncryptFinal_ex(ctx,out,outl);
+       int i;
+       i = EVP_EncryptFinal_ex(ctx,out,outl);
        EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL);
+       return i;
        }