Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   When use "vendor defined encryption routines", how to set daemon related part? (https://forum.exetools.com/showthread.php?t=16466)

bridgeic 01-20-2015 13:56

When use "vendor defined encryption routines", how to set daemon related part?
 
When use "vendor defined encryption routines" reference article below, how to set daemon related part (I mean make the daemon file has the encryption routines also)? Which file should be modified?

http://www.woodmann.com/crackz/Tutorials/Amante1.htm

I try settings below, can be compiled, but when use the generated daemon 'blendered' to start license below, it reports error below, any friend can give some suggestion?

Invalid license key (inconsistent encryption code for "f1"

i86_n3\makefile
blenderd.exe : lmrand1.exe lsvendor.obj lmappfil.obj
$(LD) $(LFLAGS) /out:$*.exe lsvendor.obj lm_new.obj lmappfil.obj \
$(DAEMON_LIBS) $(CLIBS)

machind\lmappfil.c
#include <stdio.h>
#if (defined( __STDC__) || defined(_WINDOWS)) && !defined(apollo)
#include <stdlib.h>
#endif
#include <time.h>
#include "lmclient.h"
#include "lm_code.h"
#include "lm_attr.h"
/* LM_CODE(site_code, ENCRYPTION_SEED1, ENCRYPTION_SEED2, VENDOR_KEY1, */
/* VENDOR_KEY2, VENDOR_KEY3, VENDOR_KEY4, VENDOR_KEY5); */

/* My vendor defined encryption routine */
char *my_crypt(LM_HANDLE *lm_job, CONFIG *conf, char *sdate, VENDORCODE *key)
{
char *lic_key;
char *modify_key(char *); // prototype

lc_set_attr(lm_job, LM_A_USER_CRYPT, (LM_A_VAL_TYPE)0);
lic_key = lc_crypt(lm_job, conf, sdate, key); // This is the normal way to get the license key
lc_set_attr(lm_job, LM_A_USER_CRYPT,(LM_A_VAL_TYPE)my_crypt);

/* modify the license-key */

return(modify_key(lic_key));
}

char *modify_key(char *key)
{
return ("123456789123"); // just return a constant string
// This function could contain a really complicated algorithm
// to change the normal license key in some way
// but who cares.
}

machind\lsvendor.c

/* Vendor encryption routine */
extern char *my_crypt(LM_HANDLE *, CONFIG *, char *, VENDORCODE *); // prototype for my encryption function
char *(*ls_user_crypt)() = my_crypt;

nikkapedd 01-21-2015 03:41

bridgeic, what are you looking for..?? Are you trying to build a vendor with the crypt filtres...???? The thing is a little hard than is wrote in the Amante1 old article.. And i strongly suggest you to read carefully the flexlm programmes guide.. Here a little thing that comes after you build your magic 3 seed filtrers

Code:

The tool also generates 2 source files, which you must *never edit*:
lmappfil.c: must be linked into vendor daemon, and all applications
            calling lc_checkout().  These applications must call
                lc_set_attr(lm_job, LM_A_USER_CRYPT_FILTER,
                                        (LM_A_VAL_TYPE)user_crypt_filter);
            after lc_new_job().  Also, lsvendor.c must have
                extern void user_crypt_filter();
                void (*ls_a_user_crypt_filter)() = user_crypt_filter;

lmkeyfil.c: this must be linked into all license generators:
            makekey, lmcrypt, programs that call lc_cryptstr().
            In these programs, after lc_init(), call
                lc_set_attr(lm_job, LM_A_USER_CRYPT_FILTER_GEN,
                                (LM_A_VAL_TYPE)user_crypt_filter_gen);

This is only part....

bridgeic 01-21-2015 05:59

Quote:

Originally Posted by nikkapedd (Post 96845)
bridgeic, what are you looking for..?? Are you trying to build a vendor with the crypt filtres...????

Hello nikkapedd,

It's not crypt_filter(xor/premute table method that I have known), but user_crypt(you can see the article I list), it's different with crypt_filter. I have generated the lmcrypt.exe successfully, but failed on right daemon generation.

I have another real case use both crypt_filter(on cvd[common vendor daemon] primary daemon) and user_crypt(on cvd secondary daemon), I want make clear about the latter one through this small demo case that Amante1 gave. I'm just so so on C program, would you please help me check how to link the user defined routine(named my_crypt that the article gave) into the daemon file 'blenderd'? What's wrong with my setting?

nikkapedd 01-21-2015 06:14

bridgeic,i had your same problem when i builded my first crypt_filtrer daemon: lmcrypt ok, but any daemon present in the folder.. You need to look deeply inside the Visual studio log. Check also the configuration on the files in the machind folder and of course read the sdk programmes guide.. I never builded this type of vendor....

bridgeic 01-21-2015 08:37

Quote:

Originally Posted by nikkapedd (Post 96850)
bridgeic,i had your same problem when i builded my first crypt_filtrer daemon: lmcrypt ok, but any daemon present in the folder.. You need to look deeply inside the Visual studio log. Check also the configuration on the files in the machind folder and of course read the sdk programmes guide.. I never builded this type of vendor....

Hello nikkapedd,

Yes, I will. There is few descripion in the doucment, mainly I have few knowledge and experience on c programming, so some difficult. Would you kindly help to check also if have time? thank you.:)

swlepus 01-22-2015 08:44

Yes, agree with nikkapedd. for patch the program, just patch lc_checkout.
:D
Quote:

Originally Posted by nikkapedd (Post 96845)
bridgeic, what are you looking for..?? Are you trying to build a vendor with the crypt filtres...???? The thing is a little hard than is wrote in the Amante1 old article.. And i strongly suggest you to read carefully the flexlm programmes guide.. Here a little thing that comes after you build your magic 3 seed filtrers

Code:

The tool also generates 2 source files, which you must *never edit*:
lmappfil.c: must be linked into vendor daemon, and all applications
            calling lc_checkout().  These applications must call
                lc_set_attr(lm_job, LM_A_USER_CRYPT_FILTER,
                                        (LM_A_VAL_TYPE)user_crypt_filter);
            after lc_new_job().  Also, lsvendor.c must have
                extern void user_crypt_filter();
                void (*ls_a_user_crypt_filter)() = user_crypt_filter;

lmkeyfil.c: this must be linked into all license generators:
            makekey, lmcrypt, programs that call lc_cryptstr().
            In these programs, after lc_init(), call
                lc_set_attr(lm_job, LM_A_USER_CRYPT_FILTER_GEN,
                                (LM_A_VAL_TYPE)user_crypt_filter_gen);

This is only part....


bridgeic 01-22-2015 11:35

Update:

After debug the created daemon 'blenderd.exe' with ollydbg, I found the possible reason as below.

I posted here use return ("123456789123") in lmappfil.c, but at my side the real value I used is return ("123456789abc"). After change it back to return ("123456789123") and recompiled, the daemon works now.

Seems the return value can only use digital number 0~9, when use "a,b,c...", it doesn't work, don't know why.


All times are GMT +8. The time now is 17:32.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX