Fix off-by-one error :-)
[openssl.git] / crypto / pem / pem_seal.c
index 6acb04ad774df40c51b61aa1cc28397c62bf135d..126e29d375d0afe529769ae858c8381a7f37ce76 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/pem/pem_seal.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
  * This package is an SSL implementation written
  * [including the GNU Public Licence.]
  */
 
+#ifndef NO_RSA
 #include <stdio.h>
 #include "cryptlib.h"
-#include "evp.h"
-#include "rand.h"
-#include "objects.h"
-#include "x509.h"
-#include "pem.h"
-
-int PEM_SealInit(ctx,type,md_type,ek,ekl,iv,pubk,npubk)
-PEM_ENCODE_SEAL_CTX *ctx;
-EVP_CIPHER *type;
-EVP_MD *md_type;
-unsigned char **ek;
-int *ekl;
-unsigned char *iv;
-EVP_PKEY **pubk;
-int npubk;
+#include <openssl/evp.h>
+#include <openssl/rand.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
+
+int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type,
+            unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk,
+            int npubk)
        {
        unsigned char key[EVP_MAX_KEY_LENGTH];
        int ret= -1;
@@ -118,12 +113,8 @@ err:
        return(ret);
        }
 
-void PEM_SealUpdate(ctx,out,outl,in,inl)
-PEM_ENCODE_SEAL_CTX *ctx;
-unsigned char *out;
-int *outl;
-unsigned char *in;
-int inl;
+void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl,
+            unsigned char *in, int inl)
        {
        unsigned char buffer[1600];
        int i,j;
@@ -146,13 +137,8 @@ int inl;
                }
        }
 
-int PEM_SealFinal(ctx,sig,sigl,out,outl,priv)
-PEM_ENCODE_SEAL_CTX *ctx;
-unsigned char *sig;
-int *sigl;
-unsigned char *out;
-int *outl;
-EVP_PKEY *priv;
+int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl,
+            unsigned char *out, int *outl, EVP_PKEY *priv)
        {
        unsigned char *s=NULL;
        int ret=0,j;
@@ -189,3 +175,10 @@ err:
        if (s != NULL) Free(s);
        return(ret);
        }
+#else /* !NO_RSA */
+
+# if PEDANTIC
+static void *dummy=&dummy;
+# endif
+
+#endif