make update
[openssl.git] / perl / openssl_cipher.xs
index 1044d7a..580620f 100644 (file)
@@ -1,4 +1,5 @@
-#include "p5SSLeay.h"
+
+#include "openssl.h"
 
 int boot_cipher()
        {
@@ -6,30 +7,31 @@ int boot_cipher()
        return(1);
        }
 
-MODULE =  SSLeay::Cipher       PACKAGE = SSLeay::Cipher PREFIX = p5_EVP_C_
+MODULE =  OpenSSL::Cipher      PACKAGE = OpenSSL::Cipher PREFIX = p5_EVP_C_
 
+PROTOTYPES: ENABLE
 VERSIONCHECK: DISABLE
 
 void
 p5_EVP_C_new(...)
        PREINIT:
                EVP_CIPHER_CTX *ctx;
-               EVP_CIPHER *c;
+               const EVP_CIPHER *c;
                char *name;
        PPCODE:
                if ((items == 1) && SvPOK(ST(0)))
-                       name=SvPV(ST(0),na);
+                       name=SvPV_nolen(ST(0));
                else if ((items == 2) && SvPOK(ST(1)))
-                       name=SvPV(ST(1),na);
+                       name=SvPV_nolen(ST(1));
                else
-                       croak("Usage: SSLeay::Cipher::new(type)");
+                       croak("Usage: OpenSSL::Cipher::new(type)");
                PUSHs(sv_newmortal());
                c=EVP_get_cipherbyname(name);
                if (c != NULL)
                        {
                        ctx=malloc(sizeof(EVP_CIPHER_CTX));
                        EVP_EncryptInit(ctx,c,NULL,NULL);
-                       sv_setref_pv(ST(0), "SSLeay::Cipher", (void*)ctx);
+                       sv_setref_pv(ST(0), "OpenSSL::Cipher", (void*)ctx);
                        }
 
 datum
@@ -110,7 +112,7 @@ p5_EVP_C_cipher(ctx,in)
        CODE:
                RETVAL=newSVpv("",0);
                SvGROW(RETVAL,in.dsize+EVP_CIPHER_CTX_block_size(ctx)+1);
-               EVP_Cipher(ctx,SvPV(RETVAL,na),in.dptr,in.dsize);
+               EVP_Cipher(ctx,SvPV_nolen(RETVAL),in.dptr,in.dsize);
                SvCUR_set(RETVAL,in.dsize);
        OUTPUT:
                RETVAL
@@ -124,7 +126,7 @@ p5_EVP_C_update(ctx, in)
        CODE:
                RETVAL=newSVpv("",0);
                SvGROW(RETVAL,in.dsize+EVP_CIPHER_CTX_block_size(ctx)+1);
-               EVP_CipherUpdate(ctx,SvPV(RETVAL,na),&i,in.dptr,in.dsize);
+               EVP_CipherUpdate(ctx,SvPV_nolen(RETVAL),&i,in.dptr,in.dsize);
                SvCUR_set(RETVAL,i);
        OUTPUT:
                RETVAL
@@ -137,7 +139,7 @@ p5_EVP_C_final(ctx)
        CODE:
                RETVAL=newSVpv("",0);
                SvGROW(RETVAL,EVP_CIPHER_CTX_block_size(ctx)+1);
-               if (!EVP_CipherFinal(ctx,SvPV(RETVAL,na),&i))
+               if (!EVP_CipherFinal(ctx,SvPV_nolen(RETVAL),&i))
                        sv_setpv(RETVAL,"BAD DECODE");
                else
                        SvCUR_set(RETVAL,i);