-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor functions to build with Ruby's cipher module #1564
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* Copyright (c) 2016, Google Inc. | ||
* | ||
* Permission to use, copy, modify, and/or distribute this software for any | ||
* purpose with or without fee is hereby granted, provided that the above | ||
* copyright notice and this permission notice appear in all copies. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ | ||
|
||
#include <openssl/obj.h> | ||
|
||
#include <assert.h> | ||
#include <string.h> | ||
|
||
#include <openssl/evp.h> | ||
|
||
#include "../../internal.h" | ||
|
||
|
||
struct wrapped_callback { | ||
void (*callback)(const OBJ_NAME *, void *arg); | ||
void *arg; | ||
}; | ||
|
||
static void cipher_callback(const EVP_CIPHER *cipher, const char *name, | ||
const char *unused, void *arg) { | ||
const struct wrapped_callback *wrapped = (struct wrapped_callback *)arg; | ||
OBJ_NAME obj_name; | ||
|
||
OPENSSL_memset(&obj_name, 0, sizeof(obj_name)); | ||
obj_name.type = OBJ_NAME_TYPE_CIPHER_METH; | ||
obj_name.name = name; | ||
obj_name.data = (const char *)cipher; | ||
|
||
wrapped->callback(&obj_name, wrapped->arg); | ||
} | ||
|
||
static void md_callback(const EVP_MD *md, const char *name, const char *unused, | ||
void *arg) { | ||
const struct wrapped_callback *wrapped = (struct wrapped_callback*) arg; | ||
OBJ_NAME obj_name; | ||
|
||
OPENSSL_memset(&obj_name, 0, sizeof(obj_name)); | ||
obj_name.type = OBJ_NAME_TYPE_MD_METH; | ||
obj_name.name = name; | ||
obj_name.data = (const char *)md; | ||
|
||
wrapped->callback(&obj_name, wrapped->arg); | ||
} | ||
|
||
void OBJ_NAME_do_all_sorted(int type, | ||
void (*callback)(const OBJ_NAME *, void *arg), | ||
void *arg) { | ||
struct wrapped_callback wrapped; | ||
wrapped.callback = callback; | ||
wrapped.arg = arg; | ||
|
||
if (type == OBJ_NAME_TYPE_CIPHER_METH) { | ||
EVP_CIPHER_do_all_sorted(cipher_callback, &wrapped); | ||
} else if (type == OBJ_NAME_TYPE_MD_METH) { | ||
EVP_MD_do_all_sorted(md_callback, &wrapped); | ||
} else { | ||
assert(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is a file we had removed way back in abbbd00. I've made sure it's identical to the one we removed in abbbd00#diff-5448a9a310022a1781510fe233459ce3e2caab0da779c18a8a54af0631d87086.
Also cross referenced the implementation upstream, the file hasn't been touched in 8 years: https://github.com/google/boringssl/blob/master/decrepit/obj/obj_decrepit.c