#include <stdio.h>
#include "cryptlib.h"
-#include "buffer.h"
-#include "objects.h"
-#include "evp.h"
-#include "rand.h"
-#include "x509.h"
-#include "pem.h"
+#include <openssl/buffer.h>
+#include <openssl/objects.h>
+#include <openssl/evp.h>
+#include <openssl/rand.h>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
#ifndef NO_DES
-#include "des.h"
+#include <openssl/des.h>
#endif
const char *PEM_version="PEM" OPENSSL_VERSION_PTEXT;
#define MIN_LENGTH 4
-/* PEMerr(PEM_F_PEM_WRITE_BIO,ERR_R_MALLOC_FAILURE);
- * PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE);
- */
-
-#ifndef NOPROTO
static int def_callback(char *buf, int num, int w);
static int load_iv(unsigned char **fromp,unsigned char *to, int num);
-#else
-static int def_callback();
-static int load_iv();
-#endif
-
static int def_callback(char *buf, int num, int w)
{
#ifdef NO_FP_API
#ifndef NO_FP_API
char *PEM_ASN1_read(char *(*d2i)(), const char *name, FILE *fp, char **x,
- int (*cb)())
+ pem_password_cb *cb)
{
BIO *b;
char *ret;
#endif
char *PEM_ASN1_read_bio(char *(*d2i)(), const char *name, BIO *bp, char **x,
- int (*cb)())
+ pem_password_cb *cb)
{
EVP_CIPHER_INFO cipher;
char *nm=NULL,*header=NULL;
#ifndef NO_FP_API
int PEM_ASN1_write(int (*i2d)(), const char *name, FILE *fp, char *x,
const EVP_CIPHER *enc, unsigned char *kstr, int klen,
- int (*callback)())
+ pem_password_cb *callback)
{
BIO *b;
int ret;
int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x,
const EVP_CIPHER *enc, unsigned char *kstr, int klen,
- int (*callback)())
+ pem_password_cb *callback)
{
EVP_CIPHER_CTX ctx;
int dsize=0,i,j,ret=0;
}
int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen,
- int (*callback)())
+ pem_password_cb *callback)
{
int i,j,o,klen;
long len;
PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE);
goto err;
}
- strncpy(nameB->data,&(buf[11]),(unsigned int)i-6);
+ memcpy(nameB->data,&(buf[11]),i-6);
nameB->data[i-6]='\0';
break;
}
nohead=1;
break;
}
- strncpy(&(headerB->data[hl]),buf,(unsigned int)i);
+ memcpy(&(headerB->data[hl]),buf,i);
headerB->data[hl+i]='\0';
hl+=i;
}
PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE);
goto err;
}
- strncpy(&(dataB->data[bl]),buf,(unsigned int)i);
+ memcpy(&(dataB->data[bl]),buf,i);
dataB->data[bl+i]='\0';
bl+=i;
if (end)
}
i=strlen(nameB->data);
if ( (strncmp(buf,"-----END ",9) != 0) ||
- (strncmp(nameB->data,&(buf[9]),(unsigned int)i) != 0) ||
+ (strncmp(nameB->data,&(buf[9]),i) != 0) ||
(strncmp(&(buf[9+i]),"-----\n",6) != 0))
{
PEMerr(PEM_F_PEM_READ_BIO,PEM_R_BAD_END_LINE);