2012-10-09 17:47:41 +02:00
|
|
|
$NetBSD: patch-aa,v 1.3 2012/10/09 15:47:41 marino Exp $
|
2009-01-10 09:56:39 +01:00
|
|
|
|
|
|
|
update for modern openssl.
|
|
|
|
use gettimeofday() rather than ftime() to prime srand().
|
2012-10-09 17:47:41 +02:00
|
|
|
Fix "unlink" out of scope error on gcc4.7
|
2009-01-10 09:56:39 +01:00
|
|
|
|
2010-04-10 02:11:49 +02:00
|
|
|
--- msn/util.cpp.orig 2009-07-22 19:57:10.000000000 +0000
|
2009-01-10 09:56:39 +01:00
|
|
|
+++ msn/util.cpp
|
2012-10-09 17:47:41 +02:00
|
|
|
@@ -29,7 +29,8 @@
|
2009-01-10 09:56:39 +01:00
|
|
|
#include <fstream>
|
|
|
|
#include <openssl/rand.h>
|
|
|
|
#include <cstring>
|
|
|
|
-#include <sys/timeb.h>
|
2012-10-09 17:47:41 +02:00
|
|
|
+#include <unistd.h>
|
2009-01-10 09:56:39 +01:00
|
|
|
+#include <sys/time.h>
|
|
|
|
#include "md5.h"
|
2010-04-10 02:11:49 +02:00
|
|
|
#include "libsiren/siren7.h"
|
2009-01-10 09:56:39 +01:00
|
|
|
|
2012-10-09 17:47:41 +02:00
|
|
|
@@ -259,15 +260,15 @@ namespace MSN
|
2009-01-10 09:56:39 +01:00
|
|
|
|
|
|
|
unsigned char workvec[8];
|
|
|
|
RAND_bytes(workvec, 8);
|
|
|
|
- des_key_schedule ks1,ks2,ks3;
|
|
|
|
+ DES_key_schedule ks1,ks2,ks3;
|
|
|
|
|
|
|
|
const char *one=key3.c_str();
|
|
|
|
const char *two=key3.c_str()+8;
|
|
|
|
const char *three=key3.c_str()+16;
|
|
|
|
|
|
|
|
- des_set_key((C_Block *)one,ks1);
|
|
|
|
- des_set_key((C_Block *)two,ks2);
|
|
|
|
- des_set_key((C_Block *)three,ks3);
|
|
|
|
+ DES_set_key((DES_cblock *)one,&ks1);
|
|
|
|
+ DES_set_key((DES_cblock *)two,&ks2);
|
|
|
|
+ DES_set_key((DES_cblock *)three,&ks3);
|
|
|
|
|
|
|
|
unsigned char output[72];
|
|
|
|
memset(&output,0,72);
|
2012-10-09 17:47:41 +02:00
|
|
|
@@ -278,7 +279,7 @@ namespace MSN
|
2009-01-10 09:56:39 +01:00
|
|
|
// ugly, but I think it is working properly
|
|
|
|
std::ostringstream buf_;
|
|
|
|
buf_ << nonce << "\x08\x08\x08\x08\x08\x08\x08\x08";
|
|
|
|
- DES_ede3_cbc_encrypt((const unsigned char*)buf_.str().c_str(),output,buf_.str().size(),&ks1,&ks2,&ks3,(C_Block *)workvec,DES_ENCRYPT);
|
|
|
|
+ DES_ede3_cbc_encrypt((const unsigned char*)buf_.str().c_str(),output,buf_.str().size(),&ks1,&ks2,&ks3,(DES_cblock *)workvec,DES_ENCRYPT);
|
|
|
|
|
|
|
|
MSGUSRKEY.uStructHeaderSize=28;
|
|
|
|
MSGUSRKEY.uCryptMode=1;
|
2012-10-09 17:47:41 +02:00
|
|
|
@@ -367,10 +368,10 @@ namespace MSN
|
2009-01-10 09:56:39 +01:00
|
|
|
|
|
|
|
std::string new_branch()
|
|
|
|
{
|
|
|
|
- struct timeb t;
|
|
|
|
- ftime(&t);
|
|
|
|
+ struct timeval t;
|
|
|
|
+ gettimeofday(&t, NULL);
|
|
|
|
char branch[100];
|
|
|
|
- srand(t.millitm);
|
|
|
|
+ srand(t.tv_usec);
|
|
|
|
unsigned int a=random();
|
|
|
|
srand(a);
|
|
|
|
unsigned short b=random();
|