OpenSSL GOST Parameter set - c

If there a way to insert custom parameters into the GOST 2001 parameters set programmatically and what API should be used? After being managed to generate EVP_PKEY by simulating OpenSSLs' function I found out that parameters are bound to NID, so there's a need in adding custom ones there. Ideas anyone?

Problem solved next way:
Upper error FILL_GOST2001_PARAMS:unsupported parameter set appears if you don't set your CurveName as one of already existing parameter set NID, so it should be like this: EC_GROUP_set_curve_name(CurveGroup,NID_id_GostR3410_2001_TestParamSet).
However setting one for default parameters set doesn't mean that It'll be used every time, for example in EC_KEY_check_key() function, you call it. What OpenSSL does is - it takes parameters from your EC_KEY object, so it's easily customizable, as long as those are correct (point is on curve and etc.).

Related

UVM TB and DUT parameter control

Please help to resolve one issue that I am facing with planning my TB.
Let’s assume my DUT has some input port which is parameter, something like:
module Multiplier #(parameter WIDTH = 8) (
input [WIDTH-1:0] addr,
Now I want my test to control this WIDTH parameter.
I want the test to randomize the WIDTH parameter, then apply that parameter to DUT. And based on that parameter value my whole testbench will be changed the transaction signals, driver, monitor and so on.
What is the best way to implement this parametric test?
I am thinking to have the WIDTH parameter in test class, and randomize it there. Then assign it to the DUT during instantiation. And for TB, put the randomize value in config_db and in agent get it and assign it to config class appropriate parameter.
Thanks
Hayk
I would generate a random variable in my Makefile (or whatever build/compilation system you are using). Then depending on your simulator, set the parameter from the simulation run command.
ModelSim:
The Parameters value can be passed with ‘vsim’ command in the ModelSim simulator. Assuming we want to supply a parameter value globally to all the modules:
-gWIDTH=<random_value>
VCS
-pvalue+hierarchical_name_of_parameter=<random_value>
All simulators have an equivalent.

Formatting values with AngularJs filters

I am writing a common control that will be used to format data inside a grid. It has 2 parameters that user can set:
filter (string) that is used to format value
parameters (any[]) that are used by the filter
In the code I am going to call $filter(filter)(value, ...) - here is my problem. How do I pass my parameters? Each filter can have from no parameters to who knows how many. So, is there a nice way to pass variable number of parameters in Angular? So far I did not run into a way of doing it.
You should be able to do:
$filter(filter).apply(this, parameters)

Get table as auto argument when calling C function from the same table field

I have several global integer variables, like A0, A1, A2 in Lua script. They are declared on C side. Each of them contains unique numeric value.
In a script user manipulates device pins using this aliases:
set_pin_bool(A0, 1)
And this calls corresponding C function. I think it is too C-like and not very handy. The better is to call methods like A0.hi(), A0.low(), A0.set(1) etc.
So I tried to declare A0 and others as tables in C(this is just a struct):
lua_newtable(this->luactx);
lua_pushstring(this->luactx, "val");
lua_pushinteger(this->luactx, value);
lua_rawset(this->luactx, -3);
lua_setglobal ( this->luactx, "A0" );
I can create a filed like hi and using lua_pushcfunction register it. But when I call A0.hi(), on C side I won't be able to access a table it was called from to get another fields. And as I googled there is no way to get something like self from C. Is there any way to accomplish it? I don't want to pass table itself as argument, like A0.hi(A0)
There may be a lot of aliases and they can be named differently.
Or may be there are different approaches to the same goal?
Call your hi function like this:
A0:hi()
This is equivalent to:
A0.hi(A0)

setting sampling time in c mex s func

What is the equivalent of the following for a C-mex s function? That is, how do I set discrete sample time of a block to the top level fixed step size in C?
My problem is, I could not find a way to "get" the top level fixed step size parameter in C-mex.
function setup(block)
block.SampleTimes = [str2double(get_param(bdroot, 'FixedStep')) 0];
Use ssGetFixedStepSize to get the base rate of the model. You may also want to ssSetErrorStatus if the that call returns 0, because that means your model is not configured with a FixedStep solver.
If, for some reason, you really want to go about fetching the information similar to what you have in the question, then you might be able to get access to it if you dig through the SimStruct pointer's fields. To do this, breakpoint in the mex file using a debugger and watch that variable.
Another option would be a few mexCallMATLAB calls to get the information you want.

How to design/implement the command pattern when commands have variable number of parameters?

I am constructing a diagram editor in WPF on Windows 7.
Notwithstanding that I am on the verge of learning significant design techniques (TDD, Prism, MVVM, dependency injection), though I understand a handful of established design patterns, here is my question:
As a whole, the commands will have different numbers and type combination of parameters.
(To be clear, each command has a fixed set of parameters)
For example, the following, all of which can be performed with the mouse :
Command Create New Node : parameter = location for new node (Point)
Command Move Node to new position : parameters= Node (graphNode), new location (Point)
Command make an edge connecting two nodes: parameters= From Node(graphNode), To Node(graphNode), Type of Edge (GraphEdgeType)
How ought I apply either the factory or abstract factory pattern to best encapsulate such commands?
What is the preferred way for the client to pass these parameters to the Command executive?
(I have hunted here and elsewhere but not found questions or answers so explicitly framed, and ready to be redirected to something I couldn’t find:-)
[EDIT] I have not been explicit enough:
IF I make a CommandFactory to return Commands, should it be passed commandType (an Enum, say) and a parameter set object ... or should it only be passed the commandType, so that the client subsequently primes the command with parameters?
I suspect that this https://cuttingedge.it/blogs/steven/pivot/entry.php?id=91 (which I found at Command Pattern : How to pass parameters to a command?) is what I am looking for even though I do not yet understand it - it likely transcends any of the melange of techniques I was envisaging but could not express.
How ought I apply either the factory or abstract factory pattern to best encapsulate such commands?
What are you talking about? Just pass in a class with properties for all the "parameters" as parameter.
(If anything this sounds like you need a state machine.)

Resources