master
hiGepi 2 years ago
commit 72edb09925

Binary file not shown.

@ -0,0 +1,104 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cours/TP 12/10/22 A1\n",
"\n",
"Injection de fautes, exploiter les failles.\n",
"Mecanismes cryptographiques, algo mathematiquement robustes. Quand on veut les implémenter, ils peuvent êtres soumis à différentes attaques.\n",
"\n",
"Attaque par injection de code. (Injecter des données, qui peuvent correspondre à du code donné, exploitation de bug dans le code logiciel)\n",
"Attaque par canaux auxiliaires. (temps d'execution, consommation elec, connexion)\n",
"\n",
"Raison d'optimisation (multiplication), multiplier par 0 -> pas de calcul, temps de calcul très long donc si secret = 0, temps de calcul court.\n",
"Attaque physique. (Ouvrir le circuit, sonder (microprobing) entre la mémoire et le processeur, FIB ?)\n",
"\n",
"Certaines attaques nécessitent le composant physique, d'autres à distances (marron et bleu p4)\n",
"Tirs lasers pour modifier la mémoire, injecter des fautes.\n",
"\n",
"\n",
"p9. nécessite une précision en cycle processeur très grande. Il faut cibler une ou quelques cycles.\n",
"p10. Algo plus connus/utilisé.\n",
"\n",
"Evaluation : QCM sur toutes les parties. (qu'est-ce qu'une attaque etc... Contres mesures et classification) Dans quel cas on utilise certaines contre mesure et dans cette attaque là quelle contre mesure utiliser ?\n",
"\n",
"p12. CRC pour protéger les CSP (critical security parameters) pour éviter de changer les p,q qui sont premiers.\n",
"\n",
"p14. On faute l'exposant d_i de proche en proche pour obtenir les m_i\n",
"p15. Contre mesure = rajouter un produit avec un nombre aléatoire (Stratégie Résilience)\n",
"\n",
"Vérification de valeur -> Stratégie détection\n",
"\n",
"p19. On déplace l'instant d'exécution de l'instruction sensible -> Observation de la consommation électrique\n",
"On peut rajouter des capteurs (lumière pour l'ouverture de la puce, f_clk pour le downclocking pour observer les signaux)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## TD\n",
"Q1 Donner l'équation de R_16 en fonction de R_15 et L_15\n",
"R_16 = L_15 ^ f(R_15,K_16) #f(.,.) p40\n",
"f(R_15,K_16) = P(S_1-8(E(R_15) ^ K_16))\n",
"\n",
"Q2 Entrée R_15 fautée : R_15'\n",
"R_16' = L_15' ^ P(S_1-8(E(R_15') ^ K_16))\n",
"\n",
"Q3 Delta(R_16) = R_16 ^ R_16'\n",
"= Delta(L_15) ^ P(a) ^ P(b)\n",
"= Delta(L_15) ^ P(S_1-8(E(R_15) ^ K_16) ^ S_1-8(E(R_15') ^ K_16))\n",
"\n",
"Q4\n",
"Connues : R_16, R_15 = L_16 et R_15' = L_16'\n",
"Inconnues : Delta(L_15) et K_16\n",
"\n",
"On veut Delta(L_15) = 0 donc ne pas toucher L_15 lors de la faute.\n",
"\n",
"Q5\n",
"P⁻¹(Delta(R_16)) = S_1-8(E(R_15) ^ K_16) ^ S_1-8(E(R_15') ^ K_16)\n",
"\n",
"On teste les clés K_16 pour avoir égalité des deux côtés, si elle c'est vérifié, la clé est une candidate."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Défi 4 :\n",
"\n",
"Q1 \n",
"P⁻¹_1(Delta(R_16)) = S_1(E(R_15) ^ K_16,1) ^ S_1(E(R_15') ^ K_16,1)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2.7.18 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "2.7.18"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "f92b2924b84ff19c1c3dc485f7644d4486f64738191026bf8e6de303969141b5"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}

Binary file not shown.

@ -0,0 +1,12 @@
# @file DFA_DES_elev.py
# @brief Sandbox for DFA-on-DES's challenges.
# @author Laurent Sauvage <laurent.sauvage@telecom-paristech.fr>
from DFA_DES_challenges import *
from des_block import *
if __name__ == "__main__":
# === Challenge #1 : Simple Fault Analysis ===
for c1, c2 in CHALLENGE[4]:
print (c1, c2)

Binary file not shown.

@ -0,0 +1,38 @@
# @file des_block_demo.py
# @brief How to use des_block class.
# @author Laurent Sauvage <laurent.sauvage@telecom-paristech.fr>
from des_block import *
KSHIFTS= ( 0, 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 )
if __name__ == "__main__":
#========================================
P= des_block("0x0123456789abcdef", 64) # Create a 64-bit wide DES block
print ("P={} (hex) {} (dec)".format(P, P.value()))
#========================================
L0, R0= P.ip() # Initial permutation
print ("L0= {} Ro={}".format(L0, R0))
invip_ip_P= L0.concat(R0).ip(-1) # Inverse of Initial permutation
print ("invip_ip_P=", invip_ip_P)
print ("diff=", P.xor(invip_ip_P))
#========================================
KEY= des_block("0xfedcba9876543210", 64) # Create a 64-bit wide DES block
print ("Master KEY=", KEY)
pc1_KEY= KEY.pc1() # @note Inverse of pc1() = pc1(-1)
C0= pc1_KEY.subblock( 0, 28)
D0= pc1_KEY.subblock(28, 56)
C1= C0.ls(KSHIFTS[1]) # @note Left shift of n : ls(n)
# Inverse of left shift : rs(n)
# KSHIFTS[r] = number of shifts for round r
D1= D0.ls(KSHIFTS[1])
K1= C1.concat(D1).pc2() # @note Inverse of pc2() = pc2(-1)
print ("Round Key K1=", K1)
#========================================
inS= R0.e().xor(K1)
outS= des_block()
for i in range(0, 8): # for Sbox from 0 to 7
outS= outS.concat( inS.subblock(6*i, 6*i+6).s(i) )
R1= outS.p().xor(L0) # @note Inverse of p() : p(-1)
print ("R1=", R1)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,4 @@
# Cours 12/10
Niveau de criticalité : tolérance de fautes, fautes critiques

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

@ -0,0 +1,18 @@
# Cours T1 architecture des processeurs
## 13/10
### T1-C1
p64 :
Attention aux capacités des FPGA qui sont dans des conditions très favorables et difficilement atteignables.
### T1-C2
Avantage harvard : accès plus rapide à instruction et données
p6. temps exécution = nombre instruction * temps moyen par instruction * temps cycle
p8. instructions simples, donc décomposition des instructions complexes en instructions simples.
### T1-C3 Pipeline

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,119 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cours\n",
"\n",
"## V. David 18/10\n",
"\n",
"Correction robot atelier d'assemblage\n",
"\n",
"Proposition de la classe :"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"deposer():\n",
" P(RB)\n",
" Examiner()\n",
"\n",
" if(il_faut_tourner):\n",
" P(RA)\n",
" tourner()\n",
" V(RA)\n",
"\n",
" poser_la_piece()\n",
" V(RB)\n",
"\n",
"prendre():\n",
" P(RA)\n",
" Examiner()\n",
"\n",
" if(il_faut_tourner)\n",
" P(RB)\n",
" tourner()\n",
" V(RB)\n",
"\n",
" enlever_la_piece()\n",
" V(RA)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Correction de la proposition :\n",
"Vérifier que les actions fonctionnent, puis vérifier les deadlocks\n",
"Remède deadlock p23 : désymétriser les codes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"P(S_libre)\n",
"deposer():\n",
" P(RB)\n",
" Examiner()\n",
"\n",
" if(il_faut_tourner):\n",
" V(RB)\n",
" P(RA)\n",
" P(RB)\n",
"\n",
" examiner()\n",
" if(il_faut_tourner):\n",
" tourner()\n",
"\n",
" V(RA)\n",
"\n",
" poser_la_piece()\n",
" V(RB)\n",
"V(S_occupe)\n",
"\n",
"\n",
"P(S_occupe)\n",
"prendre():\n",
" P(RA)\n",
" Examiner()\n",
"\n",
" if(il_faut_tourner)\n",
" P(RB)\n",
" tourner()\n",
" V(RB)\n",
"\n",
" enlever_la_piece()\n",
" V(RA)\n",
"V(S_libre)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.10 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.8.10"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}

@ -0,0 +1,20 @@
// Faire fin diapo 1 p26 exo avec sémaphores
RA(){
deposer()
examiner()
if(... tourner()){
tourner
}
poser_la_piece()
}
RB(){
examiner()
if(... tourner()){
tourner
}
enlever_la_piece()
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

@ -0,0 +1,30 @@
int L = N;
int O = @;
write(){
P(L);
tab[ilibre] = V;
ilibre++;
if(ilibre==N) iLibre = @;
V(O);
}
read(){
P(O);
V = tab[ioccupe];
ioccupe++;
if(ioccupe==N) ioccupe = @;
V(L);
}
// Problème d'indice en fonction de qui écrit en premier,
puis problème de si on fini de lire avant de finir d'écrire sur la bonne case
multREAD()
var j;
P(O);
P(COM3);
j = tabTransiOcc[j

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,44 @@
.POSIX:
CC = cc
CFLAGS = -std=c11 -Wall -Wextra -O3 -mcx16 -pthread #-DDEBUG
LDFLAGS = -pthread
#LDLIBS = -latomic
C= $(wildcard *.c)
H= $(wildcard *.h)
PREAMBULE_SRCS := preambule.c
POSIX_SRCS := $(filter-out %preambule.c %Atomic.c %TestAndSet.c, $(C))
ATOMIC_SRCS := $(filter-out %preambule.c %POSIX.c %TestAndSet.c, $(C))
TESTANDSET_SRCS := $(filter-out %preambule.c %POSIX.c %Atomic.c, $(C))
DEPS= $(H:.h)
PREAMBULE_OBJS= $(PREAMBULE_SRCS:.c=.o)
POSIX_OBJS= $(POSIX_SRCS:.c=.o)
ATOMIC_OBJS= $(ATOMIC_SRCS:.c=.o)
TESTANDSET_OBJS= $(TESTANDSET_SRCS:.c=.o)
preambule: $(PREAMBULE_OBJS) $(DEPS)
$(CC) $(LDFLAGS) -o preambule $(PREAMBULE_OBJS) $(LDLIBS)
posix: $(POSIX_OBJS) $(DEPS)
$(CC) $(LDFLAGS) -o mySoftwarePosix $(POSIX_OBJS) $(LDLIBS)
atomic: $(ATOMIC_OBJS) $(DEPS)
$(CC) $(LDFLAGS) -o mySoftwareAtomic $(ATOMIC_OBJS) $(LDLIBS)
testandset: $(TESTANDSET_OBJS) $(DEPS)
$(CC) $(LDFLAGS) -o mySoftwareTestAndSet $(TESTANDSET_OBJS) $(LDLIBS)
clean:
rm -f preambule mySoftwarePosix mySoftwareAtomic mySoftwareTestAndSet $(PREAMBULE_OBJS) $(POSIX_OBJS) $(ATOMIC_OBJS) $(TESTANDSET_OBJS)
runpreambule: clean preambule
./preambule
runposix: clean posix
./mySoftwarePosix
runatomic: clean atomic
./mySoftwareAtomic
runtestandset: clean testandset
./mySoftwareTestAndSet

@ -0,0 +1,26 @@
#ifndef ACQUISITION_MANAGER_H
#define ACQUISITION_MANAGER_H
#include "msg.h"
/**
* Initializes the acquisitions
*/
unsigned int acquisitionManagerInit(void);
/**
* Waits that acquisitions terminate
*/
void acquisitionManagerJoin(void);
/**
* Get producer count (debug output)
*/
unsigned int getProducerCount(void);
/**
* Get new message (blocking)
*/
void getMessage(volatile MSG_BLOCK* mBlock);
#endif

@ -0,0 +1,144 @@
#include <stdio.h>
#include <stdlib.h>
#include <semaphore.h>
#include <unistd.h>
#include <pthread.h>
#include <fcntl.h>
#include "acquisitionManager.h"
#include "msg.h"
#include "iSensor.h"
#include "mySoftware.h"
#include "iAcquisitionManager.h"
#include "debug.h"
//producer count storage
volatile unsigned int produceCount = 0;
pthread_t producers[4];
static void *produce(void *ithread);
/**
* Semaphores and Mutex
*/
pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER;
// Ring buffer
MSG_BLOCK buffer[100];
unsigned int buf_head = 0;
unsigned int buf_tail = 0;
/*
* Creates the synchronization elements.
* @return ERROR_SUCCESS if the init is ok, ERROR_INIT otherwise
*/
static unsigned int createSynchronizationObjects(void);
/*
* Increments the produce count.
*/
static void incrementProducerCount(void);
static unsigned int createSynchronizationObjects(void)
{
//TODO
printf("[acquisitionManager]Semaphore created\n");
return ERROR_SUCCESS;
}
static void incrementProducerCount(void)
{
pthread_mutex_lock(&m1);
produceCount++;
pthread_mutex_unlock(&m1);
}
unsigned int getProducerCount(void)
{
unsigned int p = 0;
pthread_mutex_lock(&m1);
p = produceCount;
pthread_mutex_unlock(&m1);
return p;
}
void getMessage(volatile MSG_BLOCK* mBlock) {
volatile MSG_BLOCK msg;
char done = 0;
// Voir TD Vincent David
// Là c'est une version de personne frustrée ne correspondant pas au TD
while (!done) {
pthread_mutex_lock(&m1);
if (buf_tail > buf_head) {
msg = buffer[buf_tail];
buf_tail++;
done = 1;
}
pthread_mutex_unlock(&m1);
}
*mBlock = msg;
}
unsigned int acquisitionManagerInit(void)
{
unsigned int i;
printf("[acquisitionManager]Synchronization initialization in progress...\n");
fflush( stdout );
if (createSynchronizationObjects() == ERROR_INIT)
return ERROR_INIT;
printf("[acquisitionManager]Synchronization initialization done.\n");
for (i = 0; i < PRODUCER_COUNT; i++)
{
pthread_create(&producers[i], NULL, &produce, &i);
}
return ERROR_SUCCESS;
}
void acquisitionManagerJoin(void)
{
unsigned int i;
for (i = 0; i < PRODUCER_COUNT; i++)
{
pthread_join(producers[i], NULL);
}
//TODO
printf("[acquisitionManager]Semaphore cleaned\n");
}
void *produce(void *ithread)
{
D(printf("[acquisitionManager]Producer created with id %d\n", gettid()));
unsigned int i = 0;
MSG_BLOCK msg;
char done = 0;
while (i < PRODUCER_LOOP_LIMIT)
{
i++;
sleep(PRODUCER_SLEEP_TIME+(rand() % 5));
// Acquire input
getInput(*(int *)ithread, &msg);
// Store in ring buffer
pthread_mutex_lock(&m1);
while (!done) {
pthread_mutex_lock(&m1);
if (buf_head < 100) {
buffer[buf_head] = msg;
buf_head++;
done = 1;
}
pthread_mutex_unlock(&m1);
}
pthread_mutex_unlock(&m1);
}
printf("[acquisitionManager] %ld termination\n", gettid());
pthread_exit(NULL);
}

@ -0,0 +1,6 @@
//C macro to active debug printf
#ifdef DEBUG
# define D(x) x
#else
# define D(x)
#endif

@ -0,0 +1,14 @@
#include "iDisplay.h"
#include <stdlib.h>
#include <stdio.h>
#include "debug.h"
void messageDisplay(volatile MSG_BLOCK* mBlock){
unsigned int i;
messageCheck(mBlock);
printf("Message\n");
D(printf("["));
for(i=0;i < DATA_SIZE;i++)
D(printf("%u ",mBlock->mData[i]));
D(printf("]\n"));
}

@ -0,0 +1,39 @@
#include <unistd.h>
#include <stdio.h>
#include <pthread.h>
#include "displayManager.h"
#include "iDisplay.h"
#include "iAcquisitionManager.h"
#include "iMessageAdder.h"
#include "msg.h"
#include "mySoftware.h"
#include "debug.h"
// DisplayManager thread.
pthread_t displayThread;
/**
* Display manager entry point.
*/
static void *display( void *parameters );
void displayManagerInit(void){
pthread_create(&displayThread, NULL, display, NULL);
}
void displayManagerJoin(void){
pthread_join(displayThread, NULL);
}
static void *display( void *parameters )
{
D(printf("[displayManager] Thread created for display with id %d\n", gettid()));
unsigned int diffCount = 0;
while(diffCount < DISPLAY_LOOP_LIMIT){
sleep(DISPLAY_SLEEP_TIME);
// TODO
}
printf("[displayManager] %ld termination\n", gettid());
pthread_exit(NULL);
}

@ -0,0 +1,14 @@
#ifndef MESSAGE_DISPLAY_H
#define MESSAGE_DISPLAY_H
/**
* Initializes display manager
*/
void displayManagerInit(void);
/**
* Waits that display manager terminates
*/
void displayManagerJoin(void);
#endif

@ -0,0 +1,8 @@
#ifndef I_ACQUISITION_MANAGER_H
#define I_ACQUISITION_MANAGER_H
#include "msg.h"
//TODO create accessors prototype here.
#endif

@ -0,0 +1,12 @@
#ifndef I_DISPLAY_H
#define I_DISPLAY_H
#include "msg.h"
/**
* Displays the message content
* @param mBlock the message pointer
*/
void messageDisplay(volatile MSG_BLOCK* mBlock);
#endif

@ -0,0 +1,9 @@
#ifndef I_MESSAGE_ADDER_H
#define I_MESSAGE_ADDER_H
#include "msg.h"
//TODO create accessors prototype here.
#endif

@ -0,0 +1,13 @@
#ifndef I_SENSOR_H
#define I_SENSOR_H
#include "msg.h"
/**
* Gets the input message.
* @param input the input number
* @param mBlock the message pointer returned
*/
void getInput(const unsigned int input, volatile MSG_BLOCK* mBlock);
#endif

@ -0,0 +1,58 @@
#include <stdio.h>
#include <stdlib.h>
#include <semaphore.h>
#include <unistd.h>
#include <pthread.h>
#include "messageAdder.h"
#include "msg.h"
#include "iMessageAdder.h"
#include "mySoftware.h"
#include "iAcquisitionManager.h"
#include "debug.h"
//consumer thread
pthread_t consumer;
//Message computed
volatile MSG_BLOCK out;
//Consumer count storage
volatile unsigned int consumeCount = 0;
/**
* Increments the consume count.
*/
static void incrementConsumeCount(void);
/**
* Consumer entry point.
*/
static void *sum( void *parameters );
//TODO create accessors to limit semaphore and mutex usage outside of this C module.
void messageAdderInit(void){
out.checksum = 0;
for (size_t i = 0; i < DATA_SIZE; i++)
{
out.mData[i] = 0;
pthread_create(&consumer, NULL, sum, NULL);
}
}
void messageAdderJoin(void){
pthread_join(consumer, NULL);
}
static void *sum( void *parameters )
{
D(printf("[messageAdder] Thread created for sum with id %ld\n", gettid()));
unsigned int i = 0;
while(i<ADDER_LOOP_LIMIT){
i++;
sleep(ADDER_SLEEP_TIME);
//TODO
}
printf("[messageAdder] %ld termination\n", gettid());
pthread_exit(NULL);
}

@ -0,0 +1,14 @@
#ifndef MESSAGE_ADDER_H
#define MESSAGE_ADDER_H
/**
* Initializes message adder module
*/
void messageAdderInit(void);
/**
* Waits that message adder terminates
*/
void messageAdderJoin(void);
#endif

@ -0,0 +1,42 @@
#include <stdlib.h>
#include <stdio.h>
#include "msg.h"
#include "debug.h"
#include <sys/syscall.h>
/**
* Add to the src message the content of add message
* @param src the message pointer
* @param add the message to add
*/
void messageAdd(volatile MSG_BLOCK* src, volatile MSG_BLOCK* add){
unsigned int i;
src->checksum = 0;
for(i=0;i < DATA_SIZE;i++){
src->mData[i] += add->mData[i];
src->checksum ^= src->mData[i];
}
D(printf("[msg]....Sum done...\n"));
}
/**
* Display the message content
* @param mBlock the message pointer
*/
unsigned int messageCheck(volatile MSG_BLOCK* mBlock){
unsigned int i, tcheck=0;
for(i=0;i < DATA_SIZE;i++)
tcheck ^= mBlock->mData[i];
if(tcheck == mBlock->checksum){
printf("[OK ] Checksum validated\n");
return 1;
}else{
printf("[ FAILED] Checksum failed, message corrupted\n");
return 0;
}
}
long gettid(void){
return syscall(SYS_gettid);
}

@ -0,0 +1,31 @@
#ifndef MSG_H
#define MSG_H
//Message data size
#define DATA_SIZE 256
//message type definition
typedef struct MSG_BLOCK_TAG
{
unsigned int checksum;
unsigned int mData[DATA_SIZE];
} MSG_BLOCK;
/**
* Displays the message content
* @param mBlock the message pointer
* @return 1 if the checksum is ok, 0 otherwise
*/
unsigned int messageCheck(volatile MSG_BLOCK* mBlock);
/**
* Adds to the src message the content of add message
* @param src the message pointer
* @param add the message to add
*/
void messageAdd(volatile MSG_BLOCK* src, volatile MSG_BLOCK* add);
long gettid(void);
#endif

@ -0,0 +1,34 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <semaphore.h>
#include "mySoftware.h"
#include "acquisitionManager.h"
#include "displayManager.h"
#include "messageAdder.h"
#include "displayManager.h"
#include "debug.h"
//The entry point of the process
int main( void )
{
printf("[mySoftware]Software initialization in progress...\n");
acquisitionManagerInit();
messageAdderInit();
displayManagerInit();
printf("[mySoftware]Task initialization done.\n");
printf("[mySoftware]Scheduling in progress...\n");
displayManagerJoin();
messageAdderJoin();
acquisitionManagerJoin();
printf("[mySoftware]Threads terminated\n");
exit(EXIT_SUCCESS);
}

@ -0,0 +1,24 @@
#ifndef MY_SOFTWARE_H
#define MY_SOFTWARE_H
#include "msg.h"
//The application return code
#define ERROR_INIT 1
#define ERROR_SUCCESS 0
//The number of producers
#define PRODUCER_COUNT 4
//The number of second the producer shall sleep
#define PRODUCER_SLEEP_TIME 1
//The number producer iterations
#define PRODUCER_LOOP_LIMIT 2
//The number of second the display shall sleep
#define DISPLAY_SLEEP_TIME 3
//The number display iterations
#define DISPLAY_LOOP_LIMIT 2
//The number of second the adder shall sleep
#define ADDER_SLEEP_TIME 2
//The number adder iterations
#define ADDER_LOOP_LIMIT PRODUCER_LOOP_LIMIT * PRODUCER_COUNT * PRODUCER_SLEEP_TIME
#endif

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save