Skip to content

Replumbing: Add include/openssl/core.h, initially with core types#8286

Closed
levitte wants to merge 2 commits intoopenssl:masterfrom
levitte:300-coredef
Closed

Replumbing: Add include/openssl/core.h, initially with core types#8286
levitte wants to merge 2 commits intoopenssl:masterfrom
levitte:300-coredef

Conversation

@levitte
Copy link
Member

@levitte levitte commented Feb 19, 2019

Checklist
  • documentation is added or updated
  • tests are added or updated

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing in the design document, I'll submit a proposal for it in the next few days.

Copy link
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor nits

@FdaSilvaYY
Copy link
Contributor

Typo intially in commit message, and PR Title ;)

@levitte levitte changed the title Replumbing: Add include/openssl/core.h, intially with core types Replumbing: Add include/openssl/core.h, initially with core types Feb 20, 2019
@levitte
Copy link
Member Author

levitte commented Feb 21, 2019

Hmmm, hang on, the _PTR part isn't quite right. The intention of the OSSL_PARAM is that it should be possible for the structure to be constant, and for someone responding to a request to handle that...

@levitte levitte changed the title Replumbing: Add include/openssl/core.h, initially with core types WIP: Replumbing: Add include/openssl/core.h, initially with core types Feb 21, 2019
mattcaswell
mattcaswell previously approved these changes Feb 21, 2019
@mattcaswell mattcaswell added the approval: done This pull request has the required number of approvals label Feb 21, 2019
@levitte
Copy link
Member Author

levitte commented Feb 21, 2019

My "hang on" meant that I'll make a change, so the approval came a little early 😉

@levitte
Copy link
Member Author

levitte commented Feb 21, 2019

Ok, reconfirmation needed

@levitte levitte dismissed mattcaswell’s stale review February 21, 2019 13:27

Reapproval needed

@levitte levitte changed the title WIP: Replumbing: Add include/openssl/core.h, initially with core types Replumbing: Add include/openssl/core.h, initially with core types Feb 21, 2019
@levitte
Copy link
Member Author

levitte commented Feb 22, 2019

I'm currently reworking the documentation. OSSL_PARAM is getting a manual of its own, doc/man3/OSSL_PARAM.pod

@levitte levitte changed the title Replumbing: Add include/openssl/core.h, initially with core types WIP: Replumbing: Add include/openssl/core.h, initially with core types Feb 22, 2019
@levitte
Copy link
Member Author

levitte commented Feb 22, 2019

Rework done for now, please have a look. I hope I've been able to make things clearer.

@levitte
Copy link
Member Author

levitte commented Feb 22, 2019

Added a NOTES section with some recommendation on how functions that treat the OSSL_PARAM array should behave

@mattcaswell mattcaswell removed the approval: done This pull request has the required number of approvals label Feb 22, 2019
@paulidale paulidale mentioned this pull request Feb 25, 2019
2 tasks
@levitte levitte changed the title WIP: Replumbing: Add include/openssl/core.h, initially with core types Replumbing: Add include/openssl/core.h, initially with core types Feb 25, 2019
@paulidale
Copy link
Contributor

What can be simpler than treating C scalar types -- int, unsigned long, etc -- as their native types?

This is happening here and in #8320 native types will come across with a straight copy. They are passed as a pointer to the native type rather than the type itself.

@richsalz
Copy link
Contributor

You do run-time byte-order testing, and size/sign fiddling

@paulidale
Copy link
Contributor

Yes, but only if the sizes don't match. Pass an int in and ask for an int out and it is a straight copy, no fiddling. Checking is optimised out and I'm switching to using cpp instead.

@richsalz
Copy link
Contributor

If you put in an int, you should only get an int out. Don't automate widening, etc. C doesn't do that.

@paulidale
Copy link
Contributor

C does widen (and narrow):

int x;
long y;

y = x;    /* widening */
x = y;    /* narrowing */

@richsalz
Copy link
Contributor

Thanks for the C programming lesson :) It does that only in explicit assignments, and you often need a cast or the compiler will complain.

It only does it in ANSI C when a prototype is in-scope, and only for input parameters.

@paulidale
Copy link
Contributor

The OSSL_PARAM structure includes the type, isn't the best correspondence the ANSI C prototype case?

@richsalz
Copy link
Contributor

No, because it doesn't include the fully-specified type and will silently over/under flow if the width is wrong.

@levitte
Copy link
Member Author

levitte commented Feb 26, 2019

I've worked with the assumption that specific parameter will not change data type or size over time, i.e. if an object parameter "h" for a key in the algorithm "blargh" is specified to be a 64-bit unsigned integer, that will not change. Of course, actually knowing this is a matter of documentation with the provider that implements "blargh".

(side note: it should of course also be OK to specify that a certain parameter is an integer of arbitrary size)

@richsalz
Copy link
Contributor

I completely agree with that. Auto-resizing goes against that, and is error-prone.

@levitte
Copy link
Member Author

levitte commented Feb 26, 2019

side note: I keep mentioning "blargh" in my examples... I really should specify that algorithm, and it should be just as good as the name suggests 😉

@levitte
Copy link
Member Author

levitte commented Feb 26, 2019

Auto-resizing goes against that, and is error-prone.

That, however, isn't part of this PR

@richsalz
Copy link
Contributor

well, kinda, because this PR doesn't include enough support to "properly" handle scalars. And you told me to post here, not in #8320 :)

@levitte
Copy link
Member Author

levitte commented Feb 26, 2019

I told you to discuss OSSL_PARAM here. If you want to discuss @paulidale's added functions, #8320 is more appropriate.

@levitte
Copy link
Member Author

levitte commented Feb 26, 2019

this PR doesn't include enough support to "properly" handle scalars.

Dunno what you mean with "properly". Put a pointer to your scalar in param->buffer and you're done! (oh, and its size in param->buffer_size, of course)

@richsalz
Copy link
Contributor

i'll answer in my PR

The names in the NAME section may describe headers, which contain a slash
for OpenSSL headers.  We deal with that by converting slashes to dashes
for the file names.
@levitte
Copy link
Member Author

levitte commented Feb 27, 2019

Meanwhile, I rebased this on top of a fresh master, and squashed all fixup commits

@levitte
Copy link
Member Author

levitte commented Feb 27, 2019

Not only are all the pieces (caller, middle/roundezvous, implementer) all on the same host, they are all in the same address space. Previous discussion among the FIPS sponsors mailing list indicated that going off-process or off-host was not a goal.

I wonder if we may have a misunderstanding here? I can't recall this actually being discussed and indicated, except that we don't expect to see any other provider than the FIPS module and the default provider for 3.0.0 specifically. The stuff here, though, isn't just about 3.0.0, and I would rather stay clear of making too many assumptions about future provider modules.

@mattcaswell
Copy link
Member

Not only are all the pieces (caller, middle/roundezvous, implementer) all on the same host, they are all in the same address space. Previous discussion among the FIPS sponsors mailing list indicated that going off-process or off-host was not a goal.

I wonder if we may have a misunderstanding here? I can't recall this actually being discussed and indicated,

I don't recall having that discussion either. I do expect Provider authors to be able to do those sorts of things (even if we don't have any providers that do it in 3.0.0)

Copy link
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved assuming the nit is fixed. IMO this should go in now in order the we can continue to make progress on the other multiple PRs depending on this one. Any alternative implementation suggestions should be in the form of a PR modifying this code.

@mattcaswell mattcaswell added the approval: done This pull request has the required number of approvals label Feb 27, 2019
@levitte
Copy link
Member Author

levitte commented Feb 27, 2019

Merged.

4ca00f9 OpenSSL::Util::Pod: allow slashes in names
7753be7 Replumbing: Add include/openssl/core.h, initially with core types

@levitte levitte closed this Feb 27, 2019
levitte added a commit that referenced this pull request Feb 27, 2019
levitte added a commit that referenced this pull request Feb 27, 2019
The names in the NAME section may describe headers, which contain a slash
for OpenSSL headers.  We deal with that by converting slashes to dashes
for the file names.

Reviewed-by: Matt Caswell <[email protected]>
(Merged from #8286)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: done This pull request has the required number of approvals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants